line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mars::Kind::Role; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
1489
|
use 5.018; |
|
4
|
|
|
|
|
10
|
|
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
18
|
use strict; |
|
4
|
|
|
|
|
4
|
|
|
4
|
|
|
|
|
60
|
|
6
|
4
|
|
|
4
|
|
14
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
96
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
28
|
use base 'Mars::Kind'; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
775
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# METHODS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub EXPORT { |
13
|
11
|
|
|
11
|
1
|
21
|
my ($self, $into) = @_; |
14
|
|
|
|
|
|
|
|
15
|
11
|
|
|
|
|
32
|
return []; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub IMPORT { |
19
|
22
|
|
|
22
|
1
|
33
|
my ($self, $into) = @_; |
20
|
|
|
|
|
|
|
|
21
|
4
|
|
|
4
|
|
23
|
no strict 'refs'; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
113
|
|
22
|
4
|
|
|
4
|
|
16
|
no warnings 'redefine'; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
584
|
|
23
|
|
|
|
|
|
|
|
24
|
22
|
|
|
|
|
30
|
for my $name (grep !*{"${into}::${_}"}{"CODE"}, @{$self->EXPORT($into)}) { |
|
18
|
|
|
|
|
106
|
|
|
22
|
|
|
|
|
177
|
|
25
|
18
|
|
|
|
|
21
|
*{"${into}::${name}"} = \&{"@{[$self->NAME]}::${name}"}; |
|
18
|
|
|
|
|
51
|
|
|
18
|
|
|
|
|
25
|
|
|
18
|
|
|
|
|
49
|
|
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
22
|
|
|
|
|
42
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Mars::Kind::Role - Role Base Class |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 ABSTRACT |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Role Base Class for Perl 5 |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SYNOPSIS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
package Person; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
use base 'Mars::Kind::Role'; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
package User; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
use base 'Mars::Kind::Class'; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
package main; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
my $user = User->ROLE('Person')->new( |
60
|
|
|
|
|
|
|
fname => 'Elliot', |
61
|
|
|
|
|
|
|
lname => 'Alderson', |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# bless({fname => 'Elliot', lname => 'Alderson'}, 'User') |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 DESCRIPTION |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This package provides a role base class with role building and object |
71
|
|
|
|
|
|
|
construction lifecycle hooks. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 INHERITS |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
This package inherits behaviors from: |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
L |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 METHODS |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This package provides the following methods: |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=cut |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 does |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
does(Str $name) (Bool) |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
The does method returns true if the object is composed of the role provided. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
I> |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=over 4 |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item does example 1 |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
package main; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my $user = User->ROLE('Person')->new( |
104
|
|
|
|
|
|
|
fname => 'Elliot', |
105
|
|
|
|
|
|
|
lname => 'Alderson', |
106
|
|
|
|
|
|
|
); |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
my $does = $user->does('Person'); |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# 1 |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=back |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=cut |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 meta |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
meta() (Meta) |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
The meta method returns a L objects which describes the package's |
121
|
|
|
|
|
|
|
configuration. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
I> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=over 4 |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item meta example 1 |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
package main; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
my $user = User->ROLE('Person')->new( |
132
|
|
|
|
|
|
|
fname => 'Elliot', |
133
|
|
|
|
|
|
|
lname => 'Alderson', |
134
|
|
|
|
|
|
|
); |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
my $meta = $user->meta; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
# bless({...}, 'Mars::Meta') |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=back |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=cut |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 AUTHORS |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Awncorp, C |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=cut |