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