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.40067'; |
4
|
6
|
|
|
6
|
|
412777
|
use Moose::Role; |
|
6
|
|
|
|
|
927775
|
|
|
6
|
|
|
|
|
33
|
|
5
|
6
|
|
|
6
|
|
21014
|
use Moose::Exporter; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
956
|
|
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
|
5268
|
my $class = shift; |
15
|
|
|
|
|
|
|
|
16
|
9
|
|
|
|
|
28
|
my %options = @_; |
17
|
9
|
|
|
|
|
40
|
Moose::Role->init_meta(%options); |
18
|
|
|
|
|
|
|
my $meta = Moose::Util::MetaRole::apply_metaroles( |
19
|
|
|
|
|
|
|
for => $options{for_class}, |
20
|
9
|
|
|
|
|
20522
|
role_metaroles => { role => ['HTML::FormHandler::Meta::Role'] } |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
9
|
|
|
|
|
8190
|
return $meta; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub has_field { |
27
|
39
|
|
|
39
|
0
|
6646
|
my ( $class, $name, %options ) = @_; |
28
|
|
|
|
|
|
|
|
29
|
39
|
|
|
|
|
113
|
$class->meta->add_to_field_list( { name => $name, %options } ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub has_block { |
33
|
3
|
|
|
3
|
0
|
194
|
my ( $class, $name, %options ) = @_; |
34
|
3
|
|
|
|
|
14
|
$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
|
|
3451
|
use namespace::autoclean; |
|
6
|
|
|
|
|
25419
|
|
|
6
|
|
|
|
|
28
|
|
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.40067 |
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) 2016 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 |