line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus::Core::Class; |
2
|
|
|
|
|
|
|
|
3
|
87
|
|
|
87
|
|
1536
|
use 5.018; |
|
87
|
|
|
|
|
304
|
|
4
|
|
|
|
|
|
|
|
5
|
87
|
|
|
87
|
|
467
|
use strict; |
|
87
|
|
|
|
|
159
|
|
|
87
|
|
|
|
|
1723
|
|
6
|
87
|
|
|
87
|
|
408
|
use warnings; |
|
87
|
|
|
|
|
164
|
|
|
87
|
|
|
|
|
2113
|
|
7
|
|
|
|
|
|
|
|
8
|
87
|
|
|
87
|
|
393
|
no warnings 'once'; |
|
87
|
|
|
|
|
173
|
|
|
87
|
|
|
|
|
3137
|
|
9
|
|
|
|
|
|
|
|
10
|
87
|
|
|
87
|
|
540
|
use base 'Venus::Core'; |
|
87
|
|
|
|
|
191
|
|
|
87
|
|
|
|
|
48788
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# METHODS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub BUILD { |
15
|
13851
|
|
|
13851
|
0
|
28052
|
my ($self, @data) = @_; |
16
|
|
|
|
|
|
|
|
17
|
87
|
|
|
87
|
|
623
|
no strict 'refs'; |
|
87
|
|
|
|
|
183
|
|
|
87
|
|
|
|
|
9537
|
|
18
|
|
|
|
|
|
|
|
19
|
13851
|
|
|
|
|
20599
|
my @roles = @{$self->META->roles}; |
|
13851
|
|
|
|
|
36995
|
|
20
|
|
|
|
|
|
|
|
21
|
13851
|
|
|
|
|
45197
|
for my $action (grep defined, map *{"${_}::BUILD"}{"CODE"}, @roles) { |
|
258694
|
|
|
|
|
631036
|
|
22
|
22870
|
|
|
|
|
60587
|
$self->$action(@data); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
13842
|
|
|
|
|
46210
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub DESTROY { |
29
|
13350
|
|
|
13350
|
|
139585
|
my ($self, @data) = @_; |
30
|
|
|
|
|
|
|
|
31
|
87
|
|
|
87
|
|
567
|
no strict 'refs'; |
|
87
|
|
|
|
|
228
|
|
|
87
|
|
|
|
|
20765
|
|
32
|
|
|
|
|
|
|
|
33
|
13350
|
|
|
|
|
19333
|
my @mixins = @{$self->META->mixins}; |
|
13350
|
|
|
|
|
34292
|
|
34
|
|
|
|
|
|
|
|
35
|
13350
|
|
|
|
|
32806
|
for my $action (grep defined, map *{"${_}::DESTROY"}{"CODE"}, @mixins) { |
|
37
|
|
|
|
|
190
|
|
36
|
0
|
|
|
|
|
0
|
$self->$action(@data); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
13350
|
|
|
|
|
19330
|
my @roles = @{$self->META->roles}; |
|
13350
|
|
|
|
|
27790
|
|
40
|
|
|
|
|
|
|
|
41
|
13350
|
|
|
|
|
28169
|
for my $action (grep defined, map *{"${_}::DESTROY"}{"CODE"}, @roles) { |
|
249460
|
|
|
|
|
586544
|
|
42
|
0
|
|
|
|
|
0
|
$self->$action(@data); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
13350
|
|
|
|
|
144728
|
return $self; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub does { |
49
|
583
|
|
|
583
|
1
|
24698
|
my ($self, @args) = @_; |
50
|
|
|
|
|
|
|
|
51
|
583
|
|
|
|
|
2649
|
return $self->DOES(@args); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub EXPORT { |
55
|
3023
|
|
|
3023
|
0
|
5961
|
my ($self, $into) = @_; |
56
|
|
|
|
|
|
|
|
57
|
3023
|
|
|
|
|
9463
|
return []; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub IMPORT { |
61
|
3023
|
|
|
3023
|
0
|
6522
|
my ($self, $into) = @_; |
62
|
|
|
|
|
|
|
|
63
|
87
|
|
|
87
|
|
653
|
no strict 'refs'; |
|
87
|
|
|
|
|
206
|
|
|
87
|
|
|
|
|
3587
|
|
64
|
87
|
|
|
87
|
|
638
|
no warnings 'redefine'; |
|
87
|
|
|
|
|
171
|
|
|
87
|
|
|
|
|
26264
|
|
65
|
|
|
|
|
|
|
|
66
|
3023
|
|
|
|
|
5240
|
for my $name (@{$self->EXPORT($into)}) { |
|
3023
|
|
|
|
|
8736
|
|
67
|
0
|
|
|
|
|
0
|
*{"${into}::${name}"} = \&{"@{[$self->NAME]}::${name}"}; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
3023
|
|
|
|
|
188668
|
return $self; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub import { |
74
|
3020
|
|
|
3020
|
|
8754
|
my ($self, @args) = @_; |
75
|
|
|
|
|
|
|
|
76
|
3020
|
|
|
|
|
7331
|
my $target = caller; |
77
|
|
|
|
|
|
|
|
78
|
3020
|
|
|
|
|
12118
|
$self->USE($target); |
79
|
|
|
|
|
|
|
|
80
|
3020
|
|
|
|
|
9471
|
return $self->IMPORT($target, @args); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub meta { |
84
|
34
|
|
|
34
|
1
|
1305
|
my ($self) = @_; |
85
|
|
|
|
|
|
|
|
86
|
34
|
|
|
|
|
206
|
return $self->META; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub new { |
90
|
13851
|
|
|
13851
|
1
|
96180
|
my ($self, @args) = @_; |
91
|
|
|
|
|
|
|
|
92
|
13851
|
|
|
|
|
45241
|
return $self->BLESS(@args); |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub unimport { |
96
|
0
|
|
|
0
|
|
|
my ($self, @args) = @_; |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
my $target = caller; |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
return $self->UNIMPORT($target, @args); |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 NAME |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Venus::Core::Class - Class Base Class |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 ABSTRACT |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Class Base Class for Perl 5 |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 SYNOPSIS |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
package User; |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
use base 'Venus::Core::Class'; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
package main; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
my $user = User->new( |
128
|
|
|
|
|
|
|
fname => 'Elliot', |
129
|
|
|
|
|
|
|
lname => 'Alderson', |
130
|
|
|
|
|
|
|
); |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
# bless({fname => 'Elliot', lname => 'Alderson'}, 'User') |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=cut |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 DESCRIPTION |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This package provides a class base class with class building and object |
139
|
|
|
|
|
|
|
construction lifecycle hooks. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 INHERITS |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This package inherits behaviors from: |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
L |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 METHODS |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
This package provides the following methods: |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=cut |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 does |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
does(Str $name) (Bool) |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
The does method returns true if the object is composed of the role provided. |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
I> |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=over 4 |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item does example 1 |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
# given: synopsis |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
my $does = $user->does('Identity'); |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
# 0 |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=back |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=cut |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head2 import |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
import(Any @args) (Any) |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
The import method invokes the C lifecycle hook and is invoked whenever |
184
|
|
|
|
|
|
|
the L declaration is used. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
I> |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=over 4 |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item import example 1 |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
package main; |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
use User; |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
# () |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=back |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head2 meta |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
meta() (Meta) |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
The meta method returns a L objects which describes the package's |
207
|
|
|
|
|
|
|
configuration. |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
I> |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=over 4 |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=item meta example 1 |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
package main; |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
my $user = User->new( |
218
|
|
|
|
|
|
|
fname => 'Elliot', |
219
|
|
|
|
|
|
|
lname => 'Alderson', |
220
|
|
|
|
|
|
|
); |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
my $meta = $user->meta; |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
# bless({...}, 'Venus::Meta') |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=back |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
=cut |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
=head2 new |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
new(Any %args | HashRef $args) (Object) |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
The new method instantiates the class and returns a new object. |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
I> |
237
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
=over 4 |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=item new example 1 |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
package main; |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
my $user = User->new( |
245
|
|
|
|
|
|
|
fname => 'Elliot', |
246
|
|
|
|
|
|
|
lname => 'Alderson', |
247
|
|
|
|
|
|
|
); |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
# bless({fname => 'Elliot', lname => 'Alderson'}, 'User') |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=back |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=over 4 |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=item new example 2 |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
package main; |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
my $user = User->new({ |
260
|
|
|
|
|
|
|
fname => 'Elliot', |
261
|
|
|
|
|
|
|
lname => 'Alderson', |
262
|
|
|
|
|
|
|
}); |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
# bless({fname => 'Elliot', lname => 'Alderson'}, 'User') |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=back |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
=cut |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=head2 unimport |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
unimport(Any @args) (Any) |
273
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
The unimport method invokes the C lifecycle hook and is invoked |
275
|
|
|
|
|
|
|
whenever the L declaration is used. |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
I> |
278
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=over 4 |
280
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=item unimport example 1 |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
package main; |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
no User; |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
# () |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=back |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
=cut |
292
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
=head1 AUTHORS |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
Awncorp, C |
296
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=cut |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
=head1 LICENSE |
300
|
|
|
|
|
|
|
|
301
|
|
|
|
|
|
|
Copyright (C) 2000, Al Newkirk. |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
304
|
|
|
|
|
|
|
the terms of the Apache license version 2.0. |
305
|
|
|
|
|
|
|
|
306
|
|
|
|
|
|
|
=cut |