Skip Menu |

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

Report information
The Basics
Id: 66396
Status: resolved
Priority: 0/
Queue: Net-Async-FastCGI

People
Owner: Nobody in particular
Requestors: TEAM [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.22
Fixed in: 0.23



Subject: ->on_request method support as fallback when {on_request} missing
Minor feature request: Currently the ->{on_request} callback is only supported as a parameter to ->configure rather than being the usual fallback to subclass method. Easy to work around (with some minor contortions in ->new / ->configure), just a nice-to-have for the usual consistency reasons. cheers, Tom
On Sat Mar 05 01:50:26 2011, TEAM wrote: Show quoted text
> Minor feature request: > > Currently the ->{on_request} callback is only supported as a parameter > to ->configure rather than being the usual fallback to subclass
method. Show quoted text
> Easy to work around (with some minor contortions in ->new / > ->configure), just a nice-to-have for the usual consistency reasons.
Ah yes. Managed to overlook that one, since that's some very old code from years (literally) before the standard ->invoke_event mechanism. See attached patch. -- Paul Evans
Subject: rt66396.patch
=== modified file 'lib/Net/Async/FastCGI.pm' --- lib/Net/Async/FastCGI.pm 2011-03-07 11:02:09 +0000 +++ lib/Net/Async/FastCGI.pm 2011-03-07 11:17:49 +0000 @@ -61,7 +61,15 @@ =cut -=head1 CONSTRUCTOR +=head1 EVENTS + +The following events are invoked, either using subclass methods or CODE +references in parameters: + +=head2 on_request $req + +Invoked when a new FastCGI request is received. It will be passed a new +L<Net::Async::FastCGI::Request> object. =cut @@ -73,12 +81,7 @@ =item on_request => CODE -Reference to a handler to call when a new FastCGI request is received. -It will be invoked as - - $on_request->( $fcgi, $request ) - -where C<$request> will be a new L<Net::Async::FastCGI::Request> object. +CODE references for C<on_request> event handler. =item default_encoding => STRING @@ -185,7 +188,7 @@ my $self = shift; my ( $req ) = @_; - $self->{on_request}->( $self, $req ); + $self->invoke_event( on_request => $req ); } sub _default_encoding