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.40068'; |
4
|
145
|
|
|
145
|
|
11702613
|
use Moose; |
|
145
|
|
|
|
|
49113989
|
|
|
145
|
|
|
|
|
1134
|
|
5
|
145
|
|
|
145
|
|
1039561
|
use Moose::Exporter; |
|
145
|
|
|
|
|
415
|
|
|
145
|
|
|
|
|
890
|
|
6
|
145
|
|
|
145
|
|
6402
|
use Moose::Util::MetaRole; |
|
145
|
|
|
|
|
329
|
|
|
145
|
|
|
|
|
3422
|
|
7
|
145
|
|
|
145
|
|
83696
|
use HTML::FormHandler::Meta::Role; |
|
145
|
|
|
|
|
1043
|
|
|
145
|
|
|
|
|
48337
|
|
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
|
439
|
|
|
439
|
0
|
772961
|
my $class = shift; |
17
|
|
|
|
|
|
|
|
18
|
439
|
|
|
|
|
2565
|
my %options = @_; |
19
|
439
|
|
|
|
|
3022
|
Moose->init_meta(%options); |
20
|
|
|
|
|
|
|
my $meta = Moose::Util::MetaRole::apply_metaroles( |
21
|
|
|
|
|
|
|
for => $options{for_class}, |
22
|
439
|
|
|
|
|
2081494
|
class_metaroles => { |
23
|
|
|
|
|
|
|
class => [ 'HTML::FormHandler::Meta::Role' ] |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
); |
26
|
439
|
|
|
|
|
788097
|
return $meta; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub has_field { |
30
|
831
|
|
|
831
|
0
|
1113616
|
my ( $meta, $name, %options ) = @_; |
31
|
831
|
100
|
|
|
|
3366
|
my $names = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ]; |
32
|
|
|
|
|
|
|
|
33
|
831
|
100
|
|
|
|
25964
|
unless ($meta->found_hfh) { |
34
|
219
|
|
|
|
|
1258
|
my @linearized_isa = $meta->linearized_isa; |
35
|
219
|
100
|
|
|
|
2577
|
if( grep { $_ eq 'HTML::FormHandler' || $_ eq 'HTML::FormHandler::Field' } @linearized_isa ) { |
|
880
|
100
|
|
|
|
4674
|
|
36
|
218
|
|
|
|
|
7204
|
$meta->found_hfh(1); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
1
|
|
|
|
|
28
|
die "Package '" . $linearized_isa[0] . "' uses HTML::FormHandler::Moose without extending HTML::FormHandler[::Field]"; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
830
|
|
|
|
|
31886
|
$meta->add_to_field_list( { name => $_, %options } ) for @$names; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub has_page { |
47
|
3
|
|
|
3
|
0
|
47
|
my ( $meta, $name, %options ) = @_; |
48
|
3
|
50
|
|
|
|
10
|
my $names = ( ref($name) eq 'ARRAY' ) ? $name : [ ($name) ]; |
49
|
|
|
|
|
|
|
|
50
|
3
|
|
|
|
|
106
|
$meta->add_to_page_list( { name => $_, %options } ) for @$names; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub has_block { |
54
|
13
|
|
|
13
|
0
|
18327
|
my ( $meta, $name, %options ) = @_; |
55
|
13
|
|
|
|
|
512
|
$meta->add_to_block_list( { name => $name, %options } ); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub apply { |
59
|
23
|
|
|
23
|
0
|
483
|
my ( $meta, $arrayref ) = @_; |
60
|
|
|
|
|
|
|
|
61
|
23
|
|
|
|
|
73
|
$meta->add_to_apply_list( @{$arrayref} ); |
|
23
|
|
|
|
|
989
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
145
|
|
|
145
|
|
1356
|
use namespace::autoclean; |
|
145
|
|
|
|
|
391
|
|
|
145
|
|
|
|
|
794
|
|
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.40068 |
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) 2017 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 |