POE::Component::XUL - POE::XUL server
use POE; use POE::Component::XUL; POE::Component::XUL->spawn( { port => 8001, root => '/var/poe-xul/', alias => 'POE-XUL', opts => {}, timeout => 30 * 60, logging => {}, apps => { MyApp => 'My::App', # .... } } ); $poe_kernel->run();
POE::Component::XUL handles all POE and HTTP events for a POE::XUL server.
POE::Component::XUL creates an HTTP server with POE::Component::Server::HTTP.
POE::Component::XUL can server up static files, and a limited form of server-side includes "BUILD FILES". XUL events (under the /xul URI) are passed to POE::XUL::Controler to be handled.
/xul
Any request not under /xul is handled as a static file. For directories, you must provide an index.html; no autoindexing is provided.
index.html
The response's content type is guessed at with MIME::Types.
A sub-set of static files are the build files. They allow you to create a response by including multiple files into one response. This cuts down on HTTP trafic while still allowing you to maintain various parts in individual files and not creating complex Makefiles. Of course, all the sub-files must share a same mime-type.
Given a request for a /path/file.ext, if the build file /path/file.ext.build exists, it is used to build the response. The response is saved in the cache file /path/file.ext.cache and which is sent for subsequent requests for /path/file.ext, unless /path/file.ext.build is updated.
/path/file.ext
/path/file.ext.build
/path/file.ext.cache
A build file is expected to be a text file. It may contain the following command:
@include "other-file.ext"
The file <other-file.ext> is included at that point in the file. The sub-files are themselves parse like build files; they may include further files.
my-xbl.xml.build:
my-xbl.xml.build
<?xml version="1.0"?> <bindings xmlns="http://www.mozilla.org/xbl" xmlns:xbl="http://www.mozilla.org/xbl" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> @include "tag1.xml" @include "tag2.xml" @include "tag3.xml" </bindings>
tag1.xml:
tag1.xml
<binding id="tag1"> <content><children /></content> <implementation> ... </implementation> </binding>
and similarly for tag2.xml and tag3.xml.
Spawns the component. Arguments are:
A hash ref that defines the applications this server handles. Hash keys are the names of the application, as used in the initial URL /start.xul?AppName. The values may be either package names or coderefs. In the former case, the object method spawn is called when a new application instance is needed. In the latter case, the coderef is called.
/start.xul?AppName
spawn
The TCP port the server should listen too. Defaults to what you specified to Makefile.PL (8077).
Path of the static files handled by the server. Must include start.xul and the javascript client library. Defaults to what you specified to Makefile.PL (/usr/local/poe-xul).
start.xul
The number of seconds of inactivity before an application instance is shutdown. Activity is currently defined as events sent from the javascript client library.
The session alias for this component. Defaults to component-poe-xul.
component-poe-xul
Hashref of options passed to POE::Session/create.
POE::Session/create
Parameters passed to POE::XUL::Logging.
As all good components should, POE::Component::XUL has a shutdown event, which also tells the POE::Component::Server::HTTP to 'shutdown'.
Philip Gwyn <gwyn-at-cpan.org>
Based on XUL::Node by Ran Eilam, POE::Component::XUL by David Davis, and of course, POE, by the illustrious Rocco Caputo.
perl(1), POE::XUL, POE::Component::Server::HTTP.
To install POE::XUL::RDF, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::XUL::RDF
CPAN shell
perl -MCPAN -e shell install POE::XUL::RDF
For more information on module installation, please visit the detailed CPAN module installation guide.