Apache::Wombat::Connector - Apache/mod_perl connector
# My/Handler.pm my $connector = Apache::Wombat::Connector->new(); $connector->setName('Apache connector'); $connector->setScheme('http'); $connector->setSecure(undef) # ... create a Service as $service # calls $connector->setContainer() internally $service->addConnector($connector); sub child_init_handler { my $r = shift; $connector->start(); return Apache::Constants::OK; } sub handler { my $r = shift; $connector->process($r); return $r->status(); } sub child_exit_handler { my $r = shift; $connector->stop(); return Apache::Constants::OK; } # httpd.conf: <Location /> SetHandler perl-script PerlChildInitHandler My::Handler::child_init_handler PerlHandler My::Handler::handler PerlChildExitHandler My::Handler::child_exit_handler </Location>
This Connector receives requests from and returns responses to an Apache web server within which Wombat is embedded. It does not listen on a socket but rather provides a process() entry point with which it receives and returns an Apache instance. It provides HttpRequest and HttpResponse implementations that delegate many fields and methods to an underlying Apache::Request instance.
process()
ApacheConnector assumes an Apache 1 & mod_perl 1 single-threaded multi-process environment. It's unknown whether it will work in any other environment.
Requires mod_perl to be compiled with at least one of the following options:
DYNAMIC=1 PERL_TABLE_API=1 EVERYTHING=1
Create and return an instance, initializing fields to default values.
Return the Container used for processing Requests received by this Connector.
Set the Container used for processing Requests received by this Connector.
Parameters:
the Wombat::Container used for processing Requests
Return the display name of this Connector.
Return the scheme that will be assigned to Requests recieved through this Connector. Default value is http.
Set the scheme that will be assigned to Requests received through this Connector.
the scheme
Return the secure connection flag that will be assigned to Requests received through this Connector. Default value is false.
Set the secure connection flag that will be assigned to Requests received through this Connector.
the boolean secure connection flag
Begin listening for requests. Returns immediately since Apache itself listens for requests.
Create and return a Apache::Wombat::Request instance.
Create and return a Apache::Wombat::Response instance.
Process the given Apache request record (converting it to an instance of Apache::Request in the process), generating and sending a response. This method is meant to be called during the content handling phase by a PerlHandler subroutine; after calling this method, the handler should examine the Apache request's status code and return an appropriate value.
the Apache instance
Prepare for active use of this component. This method should be called before any of the public methods of the component are utilized.
Throws:
if the component has already been started
Gracefully terminate active use of this component. Once this method has been called, no public methods of the component should be utilized.
if the component is not started
mod_perl, Apache, Apache::Request, Wombat::Container, Apache::Wombat::Request, Apache::Wombat::Response, Wombat::Exception
Brian Moseley, bcm@maz.org
To install Apache::Wombat, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::Wombat
CPAN shell
perl -MCPAN -e shell install Apache::Wombat
For more information on module installation, please visit the detailed CPAN module installation guide.