line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Moose::Meta::Attribute::Native::Trait::Code; |
2
|
|
|
|
|
|
|
our $VERSION = '2.2205'; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
1181
|
use Moose::Role; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
17
|
|
5
|
|
|
|
|
|
|
with 'Moose::Meta::Attribute::Native::Trait'; |
6
|
|
|
|
|
|
|
|
7
|
21
|
|
|
21
|
|
85
|
sub _helper_type { 'CodeRef' } |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
14
|
no Moose::Role; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
1; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# ABSTRACT: Helper trait for CodeRef attributes |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
__END__ |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=pod |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=encoding UTF-8 |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 NAME |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Moose::Meta::Attribute::Native::Trait::Code - Helper trait for CodeRef attributes |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 VERSION |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
version 2.2205 |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 SYNOPSIS |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
package Foo; |
32
|
|
|
|
|
|
|
use Moose; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has 'callback' => ( |
35
|
|
|
|
|
|
|
traits => ['Code'], |
36
|
|
|
|
|
|
|
is => 'ro', |
37
|
|
|
|
|
|
|
isa => 'CodeRef', |
38
|
|
|
|
|
|
|
default => sub { |
39
|
|
|
|
|
|
|
sub { print "called" } |
40
|
|
|
|
|
|
|
}, |
41
|
|
|
|
|
|
|
handles => { |
42
|
|
|
|
|
|
|
call => 'execute', |
43
|
|
|
|
|
|
|
}, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
my $foo = Foo->new; |
47
|
|
|
|
|
|
|
$foo->call; # prints "called" |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 DESCRIPTION |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
This trait provides native delegation methods for code references. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DEFAULT TYPE |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
If you don't provide an C<isa> value for your attribute, it will default to |
56
|
|
|
|
|
|
|
C<CodeRef>. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 PROVIDED METHODS |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=over 4 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item * B<execute(@args)> |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Calls the coderef with the given args. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item * B<execute_method(@args)> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Calls the coderef with the instance as invocant and given args. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=back |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 BUGS |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
See L<Moose/BUGS> for details on reporting bugs. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head1 AUTHORS |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=over 4 |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Stevan Little <stevan@cpan.org> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=item * |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Jesse Luehrs <doy@cpan.org> |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=item * |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Shawn M Moore <sartak@cpan.org> |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=item * |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=item * |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=item * |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Hans Dieter Pearcey <hdp@cpan.org> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item * |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Chris Prather <chris@prather.org> |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item * |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Matt S Trout <mstrout@cpan.org> |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=back |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
This software is copyright (c) 2006 by Infinity Interactive, Inc. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
127
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |