1CGI::Application::ServeUrs(e3r)Contributed Perl DocumentCaGtIi:o:nApplication::Server(3)
2
3
4

NAME

6       CGI::Application::Server - A simple HTTP server for developing with
7       CGI::Application
8

SYNOPSIS

10         use CGI::Application::Server;
11         use MyCGIApp;
12         use MyCGIApp::Admin;
13         use MyCGI::App::Account::Dispatch;
14         use MyCGIApp::DefaultApp;
15
16         my $server = CGI::Application::Server->new();
17
18         my $object = MyOtherCGIApp->new(PARAMS => { foo => 1, bar => 2 });
19
20         $server->document_root('./htdocs');
21         $server->entry_points({
22             '/'          => 'MyCGIApp::DefaultApp',
23             '/index.cgi' => 'MyCGIApp',
24             '/admin'     => 'MyCGIApp::Admin',
25             '/account'   => 'MyCGIApp::Account::Dispatch',
26             '/users'     => $object,
27             '/static'    => '/usr/local/htdocs',
28         });
29         $server->run();
30

DESCRIPTION

32       This is a simple HTTP server for for use during development with
33       CGI::Application. At this moment, it serves our needs in a very basic
34       way. The plan is to release early and release often, and add features
35       when we need them. That said, we welcome any and all patches, tests and
36       feature requests (the ones with which are accompanied by failing tests
37       will get priority).
38

METHODS

40       new ($port)
41           This acts just like "new" for HTTP::Server::Simple, except it will
42           initialize instance slots that we use.
43
44       handle_request
45           This will check the request uri and dispatch appropriately, either
46           to an entry point, or serve a static file (html, jpeg, gif, etc).
47
48       entry_points (?$entry_points)
49           This accepts a HASH reference in $entry_points, which maps server
50           entry points (uri) to CGI::Application or
51           CGI::Application::Dispatch class names or objects or to directories
52           from which static content will be served by
53           HTTP::Server::Simple::Static.  See the SYNOPSIS above for examples.
54
55       is_valid_entry_point ($uri)
56           This attempts to match the $uri to an entry point.
57
58       document_root (?$document_root)
59           This is the server's document root where all static files will be
60           served from.
61

CAVEATS

63       This is a subclass of HTTP::Server::Simple and all of its caveats apply
64       here as well.
65

BUGS

67       All complex software has bugs lurking in it, and this module is no
68       exception. If you find a bug please either email me, or add the bug to
69       cpan-RT.
70

CODE COVERAGE

72       I use Devel::Cover to test the code coverage of my tests, below is the
73       Devel::Cover report on this module's test suite.
74
75        ---------------------------- ------ ------ ------ ------ ------ ------ ------
76        File                           stmt   bran   cond    sub    pod   time  total
77        ---------------------------- ------ ------ ------ ------ ------ ------ ------
78        ...CGI/Application/Server.pm   94.4   80.0   53.3  100.0  100.0  100.0   88.3
79        Total                          94.4   80.0   53.3  100.0  100.0  100.0   88.3
80        ---------------------------- ------ ------ ------ ------ ------ ------ ------
81

ACKNOWLEDGEMENTS

83       The HTTP response handling was shamelessly stolen from
84       HTTP::Request::AsCGI by chansen
85

AUTHOR

87       Stevan Little <stevan@iinteractive.com>
88
89       Rob Kinyon <rob.kinyon@iinteractive.com>
90
91       Ricardo SIGNES <rjbs@cpan.org>
92
94       Copyright 2006 by Infinity Interactive, Inc.
95
96       <http://www.iinteractive.com>
97
98       This library is free software; you can redistribute it and/or modify it
99       under the same terms as Perl itself.
100
101
102
103perl v5.12.0                      2010-04-30       CGI::Application::Server(3)
Impressum