CGI-Snapp-Demo-Two
view release on metacpan or search on metacpan
lib/CGI/Snapp/Demo/Two.pm view on Meta::CPAN
# --------------------------------------------------
# You don't see the output from this method because it runs after the run modes have build the HTML.
sub teardown
{
my($self) = @_;
} # End of teardown.
# ------------------------------------------------
sub third_rm_method
{
my($self) = @_;
my($ara) = $self -> param('run_mode_visited');
push @$ara, 'third_rm_method()';
$self -> param(run_mode_visited => $ara);
return $self -> build_head . $self -> build_form($self -> get_current_runmode, 'first_rm') . $self -> build_visits . $self -> build_tail;
} # End of third_rm_method.
# ------------------------------------------------
1;
=pod
=head1 NAME
CGI::Snapp::Demo::Two - A template-free demo of CGI::Snapp using N run modes
=head1 Synopsis
After installing the module, do one or both of:
=over 4
=item o Use the L<CGI> script
Unpack the distro and copy http/cgi-bin/cgi.snapp.two.cgi to your web server's cgi-bin/ directory, and make it executable.
Then browse to http://127.0.0.1/cgi-bin/cgi.snapp.two.cgi.
=item o Use the L<PSGI> script
Note: In order to not require users to install L<Starman> or L<Plack>, they have been commented out in Build.PL and Makefile.PL.
Edit httpd/cgi-bin/cgi.snapp.two.psgi and change my value for the web server's doc root from /dev/shm/html to match your set up.
/dev/shm/ is a directory provided by L<Debian|http://www.debian.org/> which is actually a RAM disk, and within that my doc root is the sub-directory /dev/shm/html/.
Then, install L<Plack> and L<Starman> and then do one or both of:
=over 4
=item o Use L<Starman>
Start starman with: starman -l 127.0.0.1:5172 --workers 1 httpd/cgi-bin/cgi.snapp.two.psgi &
=item o Use L<Plack>
Start plackup with: plackup -l 127.0.0.1:5172 httpd/cgi-bin/cgi.snapp.two.psgi &
=back
Then, with either starman or plackup, direct your browser to hit 127.0.0.1:5172/.
These commands are copied from comments within httpd/cgi-bin/cgi.snapp.two.psgi. The value 5172 is of course just a suggestion. All demos in this series use port 5171 and up.
=back
=head1 Description
Shows how to write a CGI script using L<CGI::Snapp>, with several run modes.
The output reports which methods were and were not entered per run mode.
=head1 Distributions
This module is available as a Unix-style distro (*.tgz).
See L<http://savage.net.au/Perl-modules/html/installing-a-module.html>
for help on unpacking and installing distros.
=head1 Installation
Install L<CGI::Snapp::Demo::Two> as you would for any C<Perl> module:
Run:
cpanm CGI::Snapp::Demo::Two
or run:
sudo cpan CGI::Snapp::Demo::Two
or unpack the distro, and then either:
perl Build.PL
./Build
./Build test
sudo ./Build install
or:
perl Makefile.PL
make (or dmake or nmake)
make test
make install
=head1 Constructor and Initialization
C<new()> is called as C<< my($app) = CGI::Snapp::Demo::Two -> new(k1 => v1, k2 => v2, ...) >>.
It returns a new object of type C<CGI::Snapp::Demo::Two>.
See http/cgi-bin/cgi.snapp.two.cgi.
=head1 Methods
=head2 run()
Runs the code which responds to HTTP requests.
See http/cgi-bin/cgi.snapp.two.cgi.
( run in 0.530 second using v1.01-cache-2.11-cpan-e93a5daba3e )