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