http://search.cpan.org/perldoc?Plack::Handler::Apache2
http://search.cpan.org/perldoc?Plack
↑これらのurlに記載されている通りですが、自分用の練習です。
まず、次のperl scriptをhello.psgiというファイル名で保存。
#!/usr/local/bin/perl use strict; use Data::Dumper; my $app = sub { my $env = shift; return [ 200, [ 'Content-Type' => 'text/plain' ], [ "Hello World" ], ]; };
次にhttpd.confに「
LoadModule perl_module modules/mod_perl.so PerlModule Apache2::Reload PerlInitHandler Apache2::Reload PerlSetVar ReloadDebug Off PerlRequire "/home/endo/local/apache22/conf/startup.pl" <Location /perl-status> SetHandler perl-script PerlHandler Apache2::Status </Location> <Location "/plack"> SetHandler perl-script PerlResponseHandler Plack::Handler::Apache2 PerlSetVar psgi_app /home/endo/dev/plack/hello.psgi </Location>
最後にapache2を再起動し、ブラウザでアクセスすると、次のように表示されます。
正しく動いているようにホントかな?
まっ、詳細は後日、ということで