]>
Dogcows Code - chaz/p5-CGI-Ex/blob - samples/app/cgi_ex_2.cgi
5 cgi_ex_2.cgi - Rewrite of cgi_ex_1.cgi using CGI::Ex::App
10 use base
qw(CGI::Ex::App);
11 use CGI
::Ex
::Dump
qw(debug);
14 __PACKAGE__-
>navigate;
17 ### show what hooks ran when we are done
18 sub post_navigate
{ debug shift-
>dump_history }
20 ### this will work for both userinfo_hash_common and _success_hash_common
23 title
=> 'My Application',
24 color
=> ['#ccccff', '#aaaaff'],
28 ###----------------------------------------------------------------###
30 sub main_hash_validation
{
32 'group order' => ['username', 'password'],
38 # could probably all be done with match => 'm/^\w{3,30}$/'
45 validate_if
=> 'password',
53 my $form = $self->form;
58 sub main_next_step
{ '_success' }
64 <title
>[% title
%]</title
>
74 <h1 style
='color:blue'>Please Enter information
</h1
>
75 <span style
='color:red'>[% error_header
%]</span
>
78 <form name
="[% form_name %]" action
="[% script_name %]" method="POST">
79 <input type
=hidden name
=processing value
=1>
82 <tr bgcolor
=[% color
.0 %]>
85 <input type
=text size
=30 name
=username
>
86 <span
class=error id
=username_error
>[% username_error
%]</span></td
>
88 <tr bgcolor
=[% color
.1 %]>
90 <td
><input type
=password size
=20 name
=password
>
91 <span
class=error id
=password_error
>[% password_error
%]</span></td
>
93 <tr bgcolor
=[% color
.0 %]>
94 <td
>Password Verify
:</td
>
95 <td
><input type
=password size
=20 name
=password_verify
>
96 <span
class=error id
=password_verify_error
>[% password_verify_error
%]</span></td
>
98 <tr bgcolor
=[% color
.1 %]>
99 <td colspan
=2 align
=right
><input type
=submit value
=Submit
></td
>
112 ###----------------------------------------------------------------###
114 sub _success_file_print
{
117 <head><title>[% title %]</title></head>
119 <h1 style='color:green'>Success</h1>
121 I can now continue on with the rest of my script!
127 ###----------------------------------------------------------------###
128 ### These methods override the base functionality of CGI::Ex::App
130 sub ready_validate
{ shift-
>form->{'processing'} ? 1 : 0 }
132 sub set_ready_validate
{
134 my ($step, $is_ready) = (@_ == 2) ? @_ : (undef, shift);
136 $self->form->{'processing'} = 1;
138 delete $self->form->{'processing'};
This page took 0.044783 seconds and 4 git commands to generate.