NAME
Gantry::Server - HTTP::Server::Simple::CGI subclass providing stand alone server
SYNOPSIS
#!/usr/bin/perl
use strict;
use Gantry::Server;
use lib '/home/myhome/lib';
use YourApp qw{ -Engine=CGI -TemplateEngine=Default };
my $cgi_engine = Gantry::Engine::CGI->new();
$cgi_engine->add_location( '/', 'YourApp' );
my $server = Gantry::Server->new();
# pass a port number to the above constructor if you don't want 8080.
$server->set_engine_object( $cgi_engine );
$server->run();
DESCRIPTION
This module subclasses HTTP::Server::Simple::CGI to provide a stand alone server for any Gantry app. Pretend you are deploying to a CGI environment, but replace
$cgi_engine->dispatch();
with
use Gantry::Server;
my $server = Gantry::Server->new();
$server->set_engine_object( $cgi_engine );
$server->run();
Note that you must call set_engine_object before calling run, and you must pass it a valid Gantry::Engine::CGI object with the proper locations and config definitions.
By default, your server will start on port 8080. If you want a different port, pass it to the constructor. You can generate the above script, with port control, in bigtop by doing this in your config section:
config {
engine CGI;
CGI Gantry { with_server 1; }
#...
}
app YourApp {
#...
}
AUTHOR
Phil Crow <philcrow2000@yahoo.com>
COPYRIGHT and LICENSE
Copyright (c) 2006, Phil Crow.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.