Skip to content

Commit

Permalink
show emitted events more consistently
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jul 13, 2012
1 parent 9baed51 commit 00974cc
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/Mojo/EventEmitter.pm
Expand Up @@ -26,7 +26,8 @@ sub emit_safe {
my ($self, $name) = (shift, shift);

if (my $s = $self->{events}{$name}) {
warn "-- Safe $name in @{[blessed($self)]} (@{[scalar(@$s)]})\n" if DEBUG;
warn "-- Emit $name in @{[blessed($self)]} safely (@{[scalar(@$s)]})\n"
if DEBUG;
for my $cb (@$s) {
if (!eval { $self->$cb(@_); 1 } && $name ne 'error') {
$self->once(error => sub { warn $_[1] })
Expand All @@ -35,7 +36,7 @@ sub emit_safe {
}
}
}
elsif (DEBUG) { warn "-- Safe $name in @{[blessed($self)]} (0)\n" }
elsif (DEBUG) { warn "-- Emit $name in @{[blessed($self)]} safely (0)\n" }

return $self;
}
Expand Down

0 comments on commit 00974cc

Please sign in to comment.