X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fp5-CGI-Ex;a=blobdiff_plain;f=samples%2Fapp%2Fapp1%2Flib%2FApp1.pm;fp=samples%2Fapp%2Fapp1%2Flib%2FApp1.pm;h=a86c1a00f2a46588660099821e4d01b0b3eaf47d;hp=0000000000000000000000000000000000000000;hb=ed00221d27dfab1e82ec2ea040ab4c399a91c545;hpb=0b04f67c06c1db11969096f07dfc7dbb23bf99ba diff --git a/samples/app/app1/lib/App1.pm b/samples/app/app1/lib/App1.pm new file mode 100644 index 0000000..a86c1a0 --- /dev/null +++ b/samples/app/app1/lib/App1.pm @@ -0,0 +1,46 @@ +package App1; + +=head1 NAME + +App1 - base class for use in app1.pl + +=cut + +use strict; +use warnings; +use base qw(CGI::Ex::App); +use FindBin qw($Bin); +use CGI::Ex::Dump qw(debug); + +###----------------------------------------------------------------### + +# preload these so that their load times don't affect the dump_history times +use CGI; +use Template::Alloy qw(Parse Play Compile); + +sub post_navigate { + my $self = shift; + debug $self->dump_history + if ! $self->{'no_history'}; +} + +###----------------------------------------------------------------### + +sub load_conf { 1 } # let configuration be read from a file +sub conf_file { "$Bin/app1.yaml" } +sub conf_validation { {path => {required => 1, max_values => 100}} } + +sub allow_morph { 1 } # allow each step to be in a separate file + +sub name_module { "" } # allow content files to be in /tt/ directory directly +sub template_path { "$Bin/tt" } +sub template_args { {COMPILE_DIR => "/tmp/tt/app1.cache"} } + +# if we want automatic javascript validation, and we have overridden the path, +# we need to give the script a way to find the validate.js +sub js_uri_path { (my $path = $ENV{'SCRIPT_NAME'}) =~ s|[^/]+$|js.pl|; $path } + +# setting this instructs the flow to continue until a step does not have data +sub validate_when_data { 1 } + +1;