GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Gantry::Server(3) User Contributed Perl Documentation Gantry::Server(3)

Gantry::Server - HTTP::Server::Simple::CGI subclass providing stand alone server

    #!/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();

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 {
        #...
    }

set_engine_object
You must call this before calling run. Pass it a Gantry::Engine::CGI object.
run
This starts the server and never returns.
handler
This method overrides the parent version to avoid taking form parameters prematurely.
handle_request
This method functions as a little web server processing http requests (but it leans heavily on HTTP::Server::Simple::CGI).
handle_request_test
This method pretends to be a web server, but only handles a single request before returning. This is useful for testing your Gantry app without having to use sockets.
handle_request_test_post
This is the same as handle_request_test, but it treats the request as a POST. This is mainly used for form testing.
handle_request_test_xml
This method is like "handle_request_test", but for SOAP packets. Call it with the location you want to hit and the XML packet to PUT there. Returns whatever the server returns.
net_server
Retrieves the defined Net::Sever engine type
set_net_server
optionaly you can set a Net::Sever engine type ( see Net::Server ).

 $server->set_net_server( 'Net::Server::PreForkSimple' );
    
setup_server_url
Builds and sets the SERVER_URL environment variable.

Phil Crow <philcrow2000@yahoo.com>

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.

2022-04-07 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.