line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::FormHandler::Moose::Role; |
2
|
|
|
|
|
|
|
# ABSTRACT: to add sugar to roles |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
3192124
|
use Moose::Role; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use Moose::Exporter; |
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
|
|
|
|
|
|
|
my $class = shift; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my %options = @_; |
17
|
|
|
|
|
|
|
Moose::Role->init_meta(%options); |
18
|
|
|
|
|
|
|
my $meta = Moose::Util::MetaRole::apply_metaroles( |
19
|
|
|
|
|
|
|
for => $options{for_class}, |
20
|
|
|
|
|
|
|
role_metaroles => { role => ['HTML::FormHandler::Meta::Role'] } |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
return $meta; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub has_field { |
27
|
|
|
|
|
|
|
my ( $class, $name, %options ) = @_; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
$class->meta->add_to_field_list( { name => $name, %options } ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub has_block { |
33
|
|
|
|
|
|
|
my ( $class, $name, %options ) = @_; |
34
|
|
|
|
|
|
|
$class->meta->add_to_block_list( { name => $name, %options } ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub apply { |
38
|
|
|
|
|
|
|
my ( $class, $arrayref ) = @_; |
39
|
|
|
|
|
|
|
$class->meta->add_to_apply_list( @{$arrayref} ); |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
use namespace::autoclean; |
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.40057 |
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) 2014 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 |