CGI::Application::Dispatch::Server - A simple HTTP server for developing with CGI::Application::Dispatch
This module is no longer maintained or recommended. Use CGI::Application::Server instead, which can do all this can and more.
use CGI::Application::Dispatch::Server; my $server = CGI::Application::Dispatch::Server->new( class => 'MyClass::Dispatch' root_dir => '/home/project/www', ); $server->run;
This is a simple HTTP server for for use during development with CGI::Application::Dispatch.
It's a helpful tool for working on a private copy of a website on a personal computer. It's especially useful for working offline when you don't have easy access to a full-blown webserver.
If you have customized dispatch args, it's recommended that you put them in their own class, as described in the CGI::Application::Dispatch docs. That way, they can be accessed directly through CGI::Application::Dispatch, or through here.
my $server = CGI::Application::Dispatch::Server->new( port => '80', # optional, defaults to 8080 class => 'MyClass::Dispatch', # optional, defaults CGI::Application::Dispatch root_dir => './alphasite', # optional, defaults to "." );
Initialize the server. If you've subclassed CGI::Application::Dispatch to provide your own
dispatch_args(), let us know that here.
If you are also serving some static content, define "root_dir" with the root directory of this content.
This accepts a hashref of arguments and merges it into CGI::Application::Dispatch's dispatch() arguments.
Be aware that this is a shallow merge, so a top level key name in the new hash will completely replace one in the old hash with the same name.
It is recommended that you put your dispatch args in a separate class instead, as mentioned in the DESCRIPTION.
This will check the request URI and handle it appropriately, printing to STDOUT upon success. There's generally no reason to call this directly.
This is a subclass of HTTP::Server::Simple and all of its caveats apply here as well.
If you are not sure the behavior is a bug, please discuss it on the cgiapp mailing list ( email@example.com ). If you feel certain if you have found a bug, please report it through rt.cpan.org.
George Hartzell <firstname.lastname@example.org> Mark Stosberg
Copyright 2006 by George Hartzell
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.