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.
%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.
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.
_setup
CGISimple
RunModes
Output
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.
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.
_grepMode
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.
start
next
op
WWW::Pipeline Application::Pipeline
WWW::Pipeline::Services::RunModes WWW::Pipeline::Services::Output WWW::Pipeline::Services::CGISimple
CGI::Application
Stephen Howard <stephen@thunkit.com>
This module may be distributed under the same terms as Perl itself.
To install WWW::Pipeline, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Pipeline
CPAN shell
perl -MCPAN -e shell install WWW::Pipeline
For more information on module installation, please visit the detailed CPAN module installation guide.