line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormHandler::Moose; |
2
|
|
|
|
|
|
|
# ABSTRACT: to add FormHandler sugar |
3
|
|
|
|
|
|
|
$HTML::FormHandler::Moose::VERSION = '0.40067'; |
4
|
143
|
|
|
143
|
|
8725606
|
use Moose; |
|
143
|
|
|
|
|
34033509
|
|
|
143
|
|
|
|
|
856
|
|
5
|
143
|
|
|
143
|
|
668374
|
use Moose::Exporter; |
|
143
|
|
|
|
|
227
|
|
|
143
|
|
|
|
|
681
|
|
6
|
143
|
|
|
143
|
|
5162
|
use Moose::Util::MetaRole; |
|
143
|
|
|
|
|
178
|
|
|
143
|
|
|
|
|
3005
|
|
7
|
143
|
|
|
143
|
|
72832
|
use HTML::FormHandler::Meta::Role; |
|
143
|
|
|
|
|
316
|
|
|
143
|
|
|
|
|
42394
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Moose::Exporter->setup_import_methods( |
11
|
|
|
|
|
|
|
with_meta => [ 'has_field', 'has_page', 'has_block', 'apply' ], |
12
|
|
|
|
|
|
|
also => 'Moose', |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub init_meta { |
16
|
434
|
|
|
434
|
0
|
532361
|
my $class = shift; |
17
|
|
|
|
|
|
|
|
18
|
434
|
|
|
|
|
1705
|
my %options = @_; |
19
|
434
|
|
|
|
|
2073
|
Moose->init_meta(%options); |
20
|
|
|
|
|
|
|
my $meta = Moose::Util::MetaRole::apply_metaroles( |
21
|
|
|
|
|
|
|
for => $options{for_class}, |
22
|
434
|
|
|
|
|
1355675
|
class_metaroles => { |
23
|
|
|
|
|
|
|
class => [ 'HTML::FormHandler::Meta::Role' ] |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
); |
26
|
434
|
|
|
|
|
516914
|
return $meta; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub has_field { |
30
|
825
|
|
|
825
|
0
|
728373
|
my ( $meta, $name, %options ) = @_; |
31
|
825
|
100
|
|
|
|
2119
|
my $names = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ]; |
32
|
|
|
|
|
|
|
|
33
|
825
|
100
|
|
|
|
23015
|
unless ($meta->found_hfh) { |
34
|
217
|
|
|
|
|
903
|
my @linearized_isa = $meta->linearized_isa; |
35
|
217
|
100
|
|
|
|
1832
|
if( grep { $_ eq 'HTML::FormHandler' || $_ eq 'HTML::FormHandler::Field' } @linearized_isa ) { |
|
872
|
100
|
|
|
|
3921
|
|
36
|
216
|
|
|
|
|
6352
|
$meta->found_hfh(1); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
1
|
|
|
|
|
27
|
die "Package '" . $linearized_isa[0] . "' uses HTML::FormHandler::Moose without extending HTML::FormHandler[::Field]"; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
824
|
|
|
|
|
28886
|
$meta->add_to_field_list( { name => $_, %options } ) for @$names; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub has_page { |
47
|
3
|
|
|
3
|
0
|
32
|
my ( $meta, $name, %options ) = @_; |
48
|
3
|
50
|
|
|
|
6
|
my $names = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ]; |
49
|
|
|
|
|
|
|
|
50
|
3
|
|
|
|
|
103
|
$meta->add_to_page_list( { name => $_, %options } ) for @$names; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub has_block { |
54
|
11
|
|
|
11
|
0
|
13714
|
my ( $meta, $name, %options ) = @_; |
55
|
11
|
|
|
|
|
424
|
$meta->add_to_block_list( { name => $name, %options } ); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub apply { |
59
|
23
|
|
|
23
|
0
|
321
|
my ( $meta, $arrayref ) = @_; |
60
|
|
|
|
|
|
|
|
61
|
23
|
|
|
|
|
43
|
$meta->add_to_apply_list( @{$arrayref} ); |
|
23
|
|
|
|
|
934
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
143
|
|
|
143
|
|
869
|
use namespace::autoclean; |
|
143
|
|
|
|
|
182
|
|
|
143
|
|
|
|
|
558
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=pod |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=encoding UTF-8 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 NAME |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
HTML::FormHandler::Moose - to add FormHandler sugar |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 VERSION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
version 0.40067 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SYNOPSIS |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Enables the use of field specification sugar (has_field). |
84
|
|
|
|
|
|
|
Use this module instead of C< use Moose; > |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
package MyApp::Form::Foo; |
87
|
|
|
|
|
|
|
use HTML::FormHandler::Moose; |
88
|
|
|
|
|
|
|
extends 'HTML::FormHandler'; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
has_field 'username' => ( type => 'Text', ... ); |
91
|
|
|
|
|
|
|
has_field 'something_else' => ( ... ); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
no HTML::FormHandler::Moose; |
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 AUTHOR |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
FormHandler Contributors - see HTML::FormHandler |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Gerda Shank. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
105
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |