Stephen Howard > WWW-Pipeline-0.1.1 > WWW::Pipeline::Example

Download:
WWW-Pipeline-0.1.1.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.1   Source  

WWW::Pipeline::Example ^

This module is a simple example application to demonstrate the very basic pieces of building an application with WWW::Pipeline. In order to run this application, create an instance script that looks like the following:

 #!/usr/bin/perl

 use strict;
 use warnings;

 use WWW::Pipeline::Example;

 my $application = WWW::Pipeline::Example->new();
 $application->run();

 exit(0);

Give it the appropriate executable permissions and place it in a web-accessible directory. Assuming everything has been set correctly, pointing your browser at the script should give you access to a very simple two page application.

the %plan

  For this application we've set up two handlers.  During the Initialization
Phase, we've registered the C<_setup> method.  During the ParseRequest Phase,
we've added the C<_grepMode> method.  Other phases of the pipeline are populated
by a few plugins we load in the C<_setup> method.

the Handlers

_setup

During the _setup method we load the plugins CGISimple, RunModes, and Output. CGISimple gives us a query() method which returns a CGI::Simple instance. RunModes provides an easy way to manage the multiple screens that need to be generated for the typical web application. Output provides means for setting http headers and sending the formulated response back to the client.

Once we've got RunModes loaded we also take this opportunity to tell our application which run modes this application will have. The two implemented run modes are described later.

_grepMode

The _grepMode method is run during the ParseRequest phase of the pipeline, and looks for the query parameter 'op' to tell the application which run mode it should run.

Run Modes

Since we're using the RunModes plugin to manage our application state for any given request, we have defined two run modes, start and next. Each generate a simple html page with a link to the other. They link to each other by defining the op parameter in the url's query string, which is picked up by the application's _grepMode handler to determine which page should be generated.

See Also

WWW::Pipeline Application::Pipeline

WWW::Pipeline::Services::RunModes WWW::Pipeline::Services::Output WWW::Pipeline::Services::CGISimple

CGI::Application

Authors

Stephen Howard <stephen@thunkit.com>

License

This module may be distributed under the same terms as Perl itself.

syntax highlighting: