]>
Dogcows Code - chaz/p5-CGI-Ex/blob - samples/cgi_ex_2.cgi
5 cgi_ex_2.cgi - Rewrite of cgi_ex_1.cgi using CGI::Ex::App
17 ###----------------------------------------------------------------###
22 use base CGI
::Ex
::App
;
23 use CGI
::Ex
::Dump
qw(debug);
29 push @$path, 'userinfo';
33 ### this will work for both userinfo_hash_common and success_hash_common
37 title
=> 'My Application',
38 script
=> $ENV{SCRIPT_NAME
},
39 color
=> ['#ccf', '#aaf'],
40 history
=> $self->history,
46 return $self->form->{processing
} ? 1 : 0;
49 ###----------------------------------------------------------------###
51 sub userinfo_hash_validation
{
53 'group order' => ['username', 'password'],
59 # could probably all be done with match => 'm/^\w{3,30}$/'
66 validate_if
=> 'password',
72 sub userinfo_hash_swap
{
74 my $hash = $self->form;
75 $hash->{form_name
} = 'formfoo';
76 $hash->{js_val
} = $self->vob->generate_js($self->userinfo_hash_validation(),
78 "$ENV{SCRIPT_NAME}/js");
82 ###----------------------------------------------------------------###
84 sub userinfo_file_print
{
88 <title
>[% title
%]</title
>
98 <h1 style
='color:blue'>Please Enter information
</h1
>
99 <span style
='color:red'>[% error_header
%]</span
>
102 <form name
="[% form_name %]">
103 <input type
=hidden name
=processing value
=1>
106 <tr bgcolor
=[% color
.0 %]>
109 <input type
=text size
=30 name
=username
>
110 <span
class=error id
=username_error
>[% username_error
%]</span></td
>
112 <tr bgcolor
=[% color
.1 %]>
114 <td
><input type
=password size
=20 name
=password
>
115 <span
class=error id
=password_error
>[% password_error
%]</span></td
>
117 <tr bgcolor
=[% color
.0 %]>
118 <td
>Password Verify
:</td
>
119 <td
><input type
=password size
=20 name
=password_verify
>
120 <span
class=error id
=password_verify_error
>[% password_verify_error
%]</span></td
>
122 <tr bgcolor
=[% color
.1 %]>
123 <td colspan
=2 align
=right
><input type
=submit value
=Submit
></td
>
136 sub success_file_print
{
139 <head><title>[% title %]</title></head>
141 <h1 style='color:green'>Success</h1>
143 print "I can now continue on with the rest of my script!";
This page took 0.04203 seconds and 4 git commands to generate.