CGI-Snapp-Demo-One
view release on metacpan or search on metacpan
lib/CGI/Snapp/Demo/One.pm view on Meta::CPAN
} # End of build_tail.
# ------------------------------------------------
sub first_rm_method
{
my($self) = @_;
my($package) = __PACKAGE__;
return $self -> build_head . $self -> build_tail;
} # End of first_rm_method.
# ------------------------------------------------
sub setup
{
my($self) = @_;
$self -> start_mode('first_rm');
$self -> run_modes(first_rm => 'first_rm_method');
} # End of setup.
# ------------------------------------------------
1;
=pod
=head1 NAME
CGI::Snapp::Demo::One - A template-free demo of CGI::Snapp using just 1 run mode
=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.one.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.one.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.one.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/or 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:5171 --workers 1 httpd/cgi-bin/cgi.snapp.one.psgi &
=item o Use L<Plack>
Start plackup with: plackup -l 127.0.0.1:5171 httpd/cgi-bin/cgi.snapp.one.psgi &
=back
Then, with either starman or plackup, direct your browser to hit 127.0.0.1:5171/.
These commands are copied from comments within httpd/cgi-bin/cgi.snapp.one.psgi. The value 5171 is of course just a suggestion. All demos in this series use port 5171 and up.
=back
=head1 Description
Shows how to write a minimal CGI script using L<CGI::Snapp>, with 1 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::One> as you would for any C<Perl> module:
Run:
cpanm CGI::Snapp::Demo::One
or run:
sudo cpan CGI::Snapp::Demo::One
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::One -> new(k1 => v1, k2 => v2, ...) >>.
It returns a new object of type C<CGI::Snapp::Demo::One>.
See http/cgi-bin/cgi.snapp.one.cgi.
=head1 Methods
=head2 run()
Runs the code which responds to HTTP requests.
See http/cgi-bin/cgi.snapp.one.cgi.
=head1 Troubleshooting
( run in 1.076 second using v1.01-cache-2.11-cpan-e93a5daba3e )