Gungho::Inline - Inline Your Providers And Handlers
use Gungho::Inline; use IO::Select; Gungho::Inline->run( $config, { provider => sub { my ($provider, $c) = @_; while (IO::Select->new(STDIN)->can_read(0)) { return if STDIN->eof; my $url = STDIN->getline; chomp $url; $provider->add_request($c->prepare_request(Gungho::Request->new(GET => $url))); } }, handler => sub { my ($handler, $c, $req, $res) = @_; print $res->code, ' ', $req->uri, "\n"; } } );
Sometimes you don't need the full power of an independent Gungho Provider and or Handler. In those cases, Gungho::Inline saves you from creating separate packages
This module is still experimental. Feedback welcome
From version 0.08 of Gungho::Inline, the parameter list passed to the handler and providers, as well as the run method has been changed. You can enable the old behavior if you do
env GUNGHO_INLINE_OLD_PARAMETER_LIST=1 gungho
or, somewhere in your code, create a subroutine constant:
BEGIN { sub Gungho::Inline::OLD_PARAMETER_LIST { 1 }; } use Gungho::Inline;
If true, uses the old-style parameter list
Sets up Gungho::Inline with this set of providers
Original code by Kazuho Oku.
To install Gungho, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Gungho
CPAN shell
perl -MCPAN -e shell install Gungho
For more information on module installation, please visit the detailed CPAN module installation guide.