|
NAMEHTTP::Server::Simple::Static - Serve static files with HTTP::Server::Simple VERSIONThis documentation refers to HTTP::Server::Simple::Static version 0.13 SYNOPSIS package MyServer;
use base qw(HTTP::Server::Simple::CGI);
use HTTP::Server::Simple::Static;
my $webroot = '/var/www';
sub handle_request {
my ( $self, $cgi ) = @_;
if ( !$self->serve_static( $cgi, $webroot ) ) {
print "HTTP/1.0 404 Not found\r\n";
print $cgi->header,
$cgi->start_html('Not found'),
$cgi->h1('Not found'),
$cgi->end_html;
}
}
package main;
my $server = MyServer->new();
$server->run();
DESCRIPTIONthis mixin adds a method to serve static files from your HTTP::Server::Simple subclass. SUBROUTINES/METHODS
BUGS AND LIMITATIONSBugs or wishlist requests should be submitted via http://rt.cpan.org/ DEPENDENCIESThe File::LibMagic module is used to detect the MIME-type of a file. The URI::Escape module is used for URI handling. The HTTP::Date module is used to format the timestamp in the Last-Modified HTTP header. SEE ALSOHTTP::Server::Simple, HTTP::Server::Simple::CGI AUTHORStephen Quinney "sjq-perl@jadevine.org.uk" Thanks to Marcus Ramberg "marcus@thefeed.no" and Simon Cozens for initial implementation. LICENSE AND COPYRIGHTCopyright 2006 - 2017. Stephen Quinney "sjq-perl@jadevine.org.uk" You may distribute this code under the same terms as Perl itself.
|