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