]> Dogcows Code - chaz/p5-CGI-Ex/blob - samples/app/app1/lib/App1/PickDomain.pm
CGI::Ex 2.24
[chaz/p5-CGI-Ex] / samples / app / app1 / lib / App1 / PickDomain.pm
1 package App1::PickDomain;
2
3 =head1 NAME
4
5 App1::PickDomain - usually the first step - pick a domain
6
7 =cut
8
9 use strict;
10 use warnings;
11 use base qw(App1);
12
13 sub hash_swap {
14 my $self = shift;
15 return {
16 remote_addr => $ENV{'REMOTE_ADDR'},
17 time => scalar(localtime),
18 };
19 }
20
21 sub hash_validation {
22 return {
23 'group no_alert' => 1,
24 'group no_confirm' => 1,
25 domain => {
26 required => 1,
27 to_lower_case => 1,
28 type => 'DOMAIN',
29 type_error => 'Please enter a valid domain',
30 },
31 };
32 }
33
34 sub finalize {
35 my $self = shift;
36 my $domain = $self->form->{'domain'};
37
38 # contrived "check" for availability
39 # in theory - these checks would also cache with something like memcache
40 if ($domain =~ /^(\w+)\.com$/) { # for this test - .com isn't available
41 $self->stash->{'domain_prefix'} = $1;
42 } else {
43 $self->stash->{'domain_available'} = 1;
44 }
45
46 return 1;
47 }
48
49 1;
This page took 0.0323 seconds and 4 git commands to generate.