Home | Wiki | OI 1.x Docs | OI 2.x Docs OI logo

NAME

HTTP::Daemon::OpenInteract2 - Standalone HTTP daemon for OpenInteract 2

SYNOPSIS

 my $daemon = HTTP::Daemon::OpenInteract2->new(
                  { website_dir => $website_dir });
 print "OpenInteract now running at URL '", $daemon->url, "'\n";
 
 while (1) {
     my $client = $daemon->accept;
     next unless ( $client );
     my $child = fork();
     unless ( defined $child ) {
         die "Cannot fork child: $!\n";
     }
     if ( $child == 0 ) {
         $daemon->interact( $client );
         $daemon->close;
         exit(0);
     }
     $client->close();
 }
 $daemon->run;

DESCRIPTION

This module uses HTTP::Daemon to implement a standalone web server running OpenInteract 2. Once it's started you shouldn't be able to tell the difference between its OpenInteract the same application running on Apache, Apache2, or CGI -- it will have the same users, hit the same database, manipulate the same packages, etc.

Performance note: this daemon will not win any speed contests. It will work fine for a handful of users, but if you're seriously deploying an application you should look strongly at Apache and mod_perl.

Subclass of HTTP::Daemon that just overrides the product_tokens() method to add the current OpenInteract version to the server header.

OpenInteract2::File.

Entries under 'static_path' should not have any deployment context. For static files the server will respond to the same request off the root context and the deployment context. So if we deployed this application under '/intranet' you'd keep the static path as '/images' and the following would happen (assuming the server was running on 'localhost' port 8080):

 Request                                 Result
 ====================                    ====================
 http://localhost:8080/images            Static file sent
 http://localhost:8080/intranet/images   Static file sent
 http://localhost:8080/bar/images        Non-context request error page

You can have as many static path declarations as needed.

Tracking Running Server

The parent server stores its process ID (pid) in a file at startup. This file is called oi2.pid and is stored in the same directory where the daemon configuration file is kept. You can also access the filename from the daemon object (pid_file) as well as the pid (pid).

SEE ALSO

HTTP::Daemon

COPYRIGHT

Copyright (c) 2002-2003 Chris Winters. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS

Chris Winters <chris@cwinters.com>

Generated from the OpenInteract 1.99_03 source.


Home | Wiki | OI 1.x Docs | OI 2.x Docs
SourceForge Logo