The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Gungho::Inline - Inline Your Providers And Handlers

SYNOPSIS

  use Gungho::Inline;
  use IO::Select;
  
  Gungho::Inline->new({
    provider => sub {
      my ($c, $p) = @_;
      while (IO::Select->new(STDIN)->can_read(0)) {
        return if STDIN->eof;
        my $url = STDIN->getline;
        chomp $url;
        $p->add_request($c->prepare_request(Gungho::Request->new(GET => $url)));
      }
      1;
    },
    handler => sub {
      my ($req, $res) = @_;
      print $res->code, ' ', $req->uri, "\n";
    },
  })->run();

DESCRIPTION

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

METHODS

setup({ provider => $callback, handler => $callback, %args })

Sets up Gungho::Inline with this set of providers

AUTHOR

Original code by Kazuho Oku.