Skip Menu |

This queue is for tickets about the IO-Async CPAN distribution.

Report information
The Basics
Id: 105921
Status: rejected
Priority: 0/
Queue: IO-Async

People
Owner: Nobody in particular
Requestors: richardipsum [...] fastmail.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.67
Fixed in: (no value)



Subject: on_finish, on_exception documentation error
Hi :) The documentation for IO::Async::Process suggests that the on_finish CODE is supplied with just the $exit_code as its argument[1] but invoke_event also passes a reference to our IO::Async::Process object, from IO::Async::Notifier, sub invoke_event { my $self = shift; my ( $event_name, @args ) = @_; my $code = $self->can_event( $event_name ) or croak "$self cannot handle $event_name event"; $self->_debug_printf_event( scalar caller, $event_name ) if $IO::Async::Debug::DEBUG; return $code->( $self, @args ); } I've hacked this on my local installation so that invoke_event calls $code->( @args ); if the $event_name is 'on_finish' or 'on_exception' and this seems to work. Since other events seem to use the $self reference I imagine it may be that the real error is just that the documentation has not been updated to match? Thanks, Richard Ipsum [1] http://search.cpan.org/~pevans/IO-Async-0.67/lib/IO/Async/Process.pm#on_finish_$exitcode
Show quoted text
> Since other events seem to use the $self reference I imagine it may be > that > the real error is just that the documentation has not been updated to > match?
The documentation and code are in agreement, for some definition of "agreement". Since every EVENT on every kind of Notifier could be invoked as a self-method, or by invoking a stored CODE ref, they are always passed $self. It's a standard convention of events, that the individual entries in the EVENTS section per Notifier doesn't need to reiterate. -- Paul Evans