HTTP::Server::BrickSimple pure perl http server for prototyping "in the style of" Ruby's WEBrick | |
Download |
HTTP::Server::Brick Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Mark Aufflick
- Publisher web site:
- http://search.cpan.org/~aufflick/
HTTP::Server::Brick Tags
HTTP::Server::Brick Description
Simple pure perl http server for prototyping "in the style of" Ruby's WEBrick HTTP::Server::Brick is a simple pure Perl HTTP server for prototyping "in the style of" Ruby's WEBrick.SYNOPSIS use HTTP::Server::Brick; use HTTP::Status; my $server = HTTP::Server::Brick->new( port => 8888 ); $server->mount( '/foo/bar' => { path => '/some/directory/htdocs', }); $server->mount( '/test/proc' => { handler => sub { my ($req, $res) = @_; $res->add_content(" Path info: $req->{path_info} "); 1; }, wildcard => 1, }); $server->mount( '/test/proc/texty' => { handler => sub { my ($req, $res) = @_; $res->add_content("flubber"); $res->header('Content-type', 'text/plain'); 1; }, wildcard => 1, }); # these next two are equivalent $server->mount( '/favicon.ico' => { handler => sub { RC_NOT_FOUND }, }); $server->mount( '/favicon.ico' => { handler => sub { my ($req, $res) = @_; $res->code(RC_NOT_FOUND); 1; }, }); # start accepting requests (won't return unless/until process # receives a HUP signal) $server->start;For an SSL (https) server, replace the new() line above with: use HTTP::Daemon::SSL; my $server = HTTP::Server::Brick->new( port => 8889, daemon_class => 'HTTP::Daemon::SSL', daemon_args => , ); Requirements: · Perl
HTTP::Server::Brick Related Software