Japanese, and few English. In the future, I will write and share this slide of English version, perhaps. • I speach by Japanese language. • If you do not known Japanese language, please fun and feel from some Perl code and few English description on this slide.
use Apache2::RequestRec (); # for $r->content_type() use Apache2::RequestIO (); # for $r->print() use Apache2::Const -compile => qw(OK); sub handler { my $r = shift; # "Apache2::RequestRec" object $r->content_type('text/plain'); $r->print("Hello! mod_perl2.\n"); return Apache2::Const::OK; } 1;
Apache::Constants qw(DECLINED); sub handler { my $r = shift; my $uri = $r->uri(); # e.g. "/path/to/foo.html" ### ... modify $uri ... $r->uri($uri); return DECLINED; # I tell a lie that I do nothing. } 1;
Apache2::RequestRec (); # for $r->uri() use Apache2::Const -compile => qw(DECLINED); sub handler { my $r = shift; my $uri = $r->uri(); # e.g. "/path/to/foo.html" ### ... modify $uri ... $r->uri($uri); # set $uri return Apache2::Const::DECLINED; # I tell a lie that I do nothing. } 1;
use warnings; use threads; use threads::shared; my @queue :shared; sub push_queue { my $value = shift; return 0 if !defined $value; push @queue, $value; return 1; } sub shift_queue { return shift @queue } 1;
use warnings; use threads; use Apache2::RequestRec (); use Apache2::RequestIO (); use Apache2::Const -compile => qw(OK HTTP_METHOD_NOT_ALLOWED); use My::Queue; my $READ_CHUNK_LENGH = 2048; ### ### ... following sub handler { ... } ... ###