line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormHandler::Moose::Role; |
2
|
|
|
|
|
|
|
# ABSTRACT: to add sugar to roles |
3
|
|
|
|
|
|
|
$HTML::FormHandler::Moose::Role::VERSION = '0.40068'; |
4
|
6
|
|
|
6
|
|
520554
|
use Moose::Role; |
|
6
|
|
|
|
|
1252634
|
|
|
6
|
|
|
|
|
36
|
|
5
|
6
|
|
|
6
|
|
30546
|
use Moose::Exporter; |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
31
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Moose::Exporter->setup_import_methods( |
9
|
|
|
|
|
|
|
with_caller => [ 'has_field', 'has_block', 'apply' ], |
10
|
|
|
|
|
|
|
also => 'Moose::Role', |
11
|
|
|
|
|
|
|
); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub init_meta { |
14
|
9
|
|
|
9
|
0
|
7579
|
my $class = shift; |
15
|
|
|
|
|
|
|
|
16
|
9
|
|
|
|
|
58
|
my %options = @_; |
17
|
9
|
|
|
|
|
59
|
Moose::Role->init_meta(%options); |
18
|
|
|
|
|
|
|
my $meta = Moose::Util::MetaRole::apply_metaroles( |
19
|
|
|
|
|
|
|
for => $options{for_class}, |
20
|
9
|
|
|
|
|
26184
|
role_metaroles => { role => ['HTML::FormHandler::Meta::Role'] } |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
9
|
|
|
|
|
11547
|
return $meta; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub has_field { |
27
|
39
|
|
|
39
|
0
|
9211
|
my ( $class, $name, %options ) = @_; |
28
|
|
|
|
|
|
|
|
29
|
39
|
|
|
|
|
162
|
$class->meta->add_to_field_list( { name => $name, %options } ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub has_block { |
33
|
3
|
|
|
3
|
0
|
113
|
my ( $class, $name, %options ) = @_; |
34
|
3
|
|
|
|
|
15
|
$class->meta->add_to_block_list( { name => $name, %options } ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub apply { |
38
|
0
|
|
|
0
|
0
|
|
my ( $class, $arrayref ) = @_; |
39
|
0
|
|
|
|
|
|
$class->meta->add_to_apply_list( @{$arrayref} ); |
|
0
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
6
|
|
|
6
|
|
3473
|
use namespace::autoclean; |
|
6
|
|
|
|
|
26200
|
|
|
6
|
|
|
|
|
38
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=pod |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=encoding UTF-8 |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 NAME |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
HTML::FormHandler::Moose::Role - to add sugar to roles |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 VERSION |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
version 0.40068 |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 SYNOPSIS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Enables the use of field specification sugar (has_field) in roles. |
62
|
|
|
|
|
|
|
Use this module instead of C< use Moose::Role; > |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
package MyApp::Form::Foo; |
65
|
|
|
|
|
|
|
use HTML::FormHandler::Moose::Role; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
has_field 'username' => ( type => 'Text', ... ); |
68
|
|
|
|
|
|
|
has_field 'something_else' => ( ... ); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
no HTML::FormHandler::Moose::Role; |
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 AUTHOR |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
FormHandler Contributors - see HTML::FormHandler |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Gerda Shank. |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
82
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |