| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package HTML::FormHandler::Pages; |
|
2
|
|
|
|
|
|
|
# ABSTRACT: used in Wizard |
|
3
|
|
|
|
|
|
|
$HTML::FormHandler::Pages::VERSION = '0.40067'; |
|
4
|
1
|
|
|
1
|
|
424
|
use Moose::Role; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has 'pages' => ( |
|
7
|
|
|
|
|
|
|
traits => ['Array'], |
|
8
|
|
|
|
|
|
|
isa => 'ArrayRef[HTML::FormHandler::Page]', |
|
9
|
|
|
|
|
|
|
is => 'rw', |
|
10
|
|
|
|
|
|
|
default => sub { [] }, |
|
11
|
|
|
|
|
|
|
auto_deref => 1, |
|
12
|
|
|
|
|
|
|
handles => { |
|
13
|
|
|
|
|
|
|
all_pages => 'elements', |
|
14
|
|
|
|
|
|
|
clear_pages => 'clear', |
|
15
|
|
|
|
|
|
|
push_page => 'push', |
|
16
|
|
|
|
|
|
|
num_pages => 'count', |
|
17
|
|
|
|
|
|
|
has_pages => 'count', |
|
18
|
|
|
|
|
|
|
set_page_at => 'set', |
|
19
|
|
|
|
|
|
|
get_page => 'get', |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has 'page_name_space' => ( |
|
24
|
|
|
|
|
|
|
isa => 'Str|ArrayRef[Str]|Undef', |
|
25
|
|
|
|
|
|
|
is => 'rw', |
|
26
|
|
|
|
|
|
|
lazy => 1, |
|
27
|
|
|
|
|
|
|
builder => 'build_page_name_space', |
|
28
|
|
|
|
|
|
|
); |
|
29
|
|
|
|
|
|
|
|
|
30
|
2
|
|
|
2
|
0
|
51
|
sub build_page_name_space { '' } |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub page_index { |
|
33
|
6
|
|
|
6
|
0
|
6
|
my ( $self, $name ) = @_; |
|
34
|
6
|
|
|
|
|
7
|
my $index = 0; |
|
35
|
6
|
|
|
|
|
195
|
for my $page ( $self->all_pages ) { |
|
36
|
6
|
50
|
|
|
|
139
|
return $index if $page->name eq $name; |
|
37
|
6
|
|
|
|
|
6
|
$index++; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
6
|
|
|
|
|
10
|
return; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub page { |
|
43
|
4
|
|
|
4
|
0
|
7
|
my ( $self, $name, $die ) = @_; |
|
44
|
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
5
|
my $index; |
|
46
|
|
|
|
|
|
|
# if this is a full_name for a compound page |
|
47
|
|
|
|
|
|
|
# walk through the pages to get to it |
|
48
|
4
|
50
|
|
|
|
9
|
return undef unless ( defined $name ); |
|
49
|
4
|
50
|
|
|
|
12
|
if ( $name =~ /\./ ) { |
|
50
|
0
|
|
|
|
|
0
|
my @names = split /\./, $name; |
|
51
|
0
|
|
0
|
|
|
0
|
my $f = $self->form || $self; |
|
52
|
0
|
|
|
|
|
0
|
foreach my $pname (@names) { |
|
53
|
0
|
|
|
|
|
0
|
$f = $f->page($pname); |
|
54
|
0
|
0
|
|
|
|
0
|
return unless $f; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
0
|
|
|
|
|
0
|
return $f; |
|
57
|
|
|
|
|
|
|
} |
|
58
|
|
|
|
|
|
|
else # not a compound name |
|
59
|
|
|
|
|
|
|
{ |
|
60
|
4
|
|
|
|
|
138
|
for my $page ( $self->all_pages ) { |
|
61
|
4
|
50
|
|
|
|
94
|
return $page if ( $page->name eq $name ); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
} |
|
64
|
0
|
0
|
|
|
|
|
return unless $die; |
|
65
|
0
|
|
|
|
|
|
die "Page '$name' not found in '$self'"; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=pod |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=encoding UTF-8 |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 NAME |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
HTML::FormHandler::Pages - used in Wizard |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 VERSION |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
version 0.40067 |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 AUTHOR |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
FormHandler Contributors - see HTML::FormHandler |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Gerda Shank. |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
93
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |