]> Dogcows Code - chaz/p5-CGI-Ex/blob - samples/app/app1/lib/App1/PickDomainAlternate.pm
CGI::Ex 2.24
[chaz/p5-CGI-Ex] / samples / app / app1 / lib / App1 / PickDomainAlternate.pm
1 package App1::PickDomainAlternate;
2
3 =head1 NAME
4
5 App1::PickDomainAlternate - pick from a list of generated alternates when pick_domain fails
6
7 =cut
8
9 use strict;
10 use warnings;
11 use base qw(App1);
12
13 sub skip { return 1 if shift->stash->{'domain_available'} }
14
15 sub hash_swap {
16 my $self = shift;
17 return $self->{'pda_hash_swap'} ||= do { # cache since hash_fill is using us also
18 my $dom = $self->stash->{'domain_prefix'} || die "Missing domain_prefix";
19
20 my @domains = map {"$dom.$_"} qw(net org biz info us); # contrived availability check
21 my $hash = {domains => \@domains};
22 };
23 }
24
25 sub hash_fill {
26 my $self = shift;
27 my $doms = $self->hash_swap->{'domains'};
28 return {
29 domain => $doms->[1], # promote .org #[rand @$doms],
30 };
31 }
32
33 sub info_complete { 0 } # step always shows when called
34
35 1;
This page took 0.033267 seconds and 4 git commands to generate.