#!/usr/bin/perl
package Foo;
use strict;
use warnings;
use base qw(CGI::Ex::App);
Foo->new->navigate;
exit;
sub base_dir_abs { '/var/www/templates' }
### tell the application to
### look for a module to handle each run mode (step)
sub allow_morph { 1 }
{
# This could be in its own file - or
# embedded in here is fine
# you can get here by going to
# /cgi-bin/my_cgi
# or /cgi-bin/my_cgi/main
# or /cgi-bin/my_cgi?step=main
package Foo::Main;
sub file_print {
return \ <<'HERE';
Step Main
This is the default run mode.
You said [% hello %].
HERE
sub hash_swap {
return {hello => "I'm main!"};
}
} # end of Foo::Main
# you get to step2 by calling
# /cgi-bin/my_cgi?step=step2
# or
# /cgi-bin/my_cgi/step2
# these methods are just sitting the the Foo class
sub step2_file_print {
return \ <<'HERE';
I'm in step 2
You said [% hello %].
HERE
sub step2_hash_swap {
return {hello => 'Hello Step2'};
}
# uncomment for a trace of which methods were looked for
# sub post_navigate {
# use CGI::Ex::Dump qw(debug);
# debug shift->dump_history;
#}