Skip to content

Instantly share code, notes, and snippets.

@augensalat
Created June 24, 2015 09:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save augensalat/6a1fe8647c3d009a2385 to your computer and use it in GitHub Desktop.
Save augensalat/6a1fe8647c3d009a2385 to your computer and use it in GitHub Desktop.
extended debugging for Mojo::EventEmitter
--- a/lib/Mojo/EventEmitter.pm
+++ b/lib/Mojo/EventEmitter.pm
@@ -12,7 +12,11 @@ sub emit {
if (my $s = $self->{events}{$name}) {
warn "-- Emit $name in @{[blessed $self]} (@{[scalar @$s]})\n" if DEBUG;
- for my $cb (@$s) { $self->$cb(@_) }
+ my $i = 0;
+ for my $cb (@$s) {
+ warn "xx call cb #@{[$i++]} $name in @{[blessed $self]}\n" if DEBUG;
+ $self->$cb(@_);
+ }
}
else {
warn "-- Emit $name in @{[blessed $self]} (0)\n" if DEBUG;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment