line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus::Core::Class; |
2
|
|
|
|
|
|
|
|
3
|
87
|
|
|
87
|
|
1554
|
use 5.018; |
|
87
|
|
|
|
|
309
|
|
4
|
|
|
|
|
|
|
|
5
|
87
|
|
|
87
|
|
468
|
use strict; |
|
87
|
|
|
|
|
164
|
|
|
87
|
|
|
|
|
1738
|
|
6
|
87
|
|
|
87
|
|
389
|
use warnings; |
|
87
|
|
|
|
|
150
|
|
|
87
|
|
|
|
|
2192
|
|
7
|
|
|
|
|
|
|
|
8
|
87
|
|
|
87
|
|
396
|
no warnings 'once'; |
|
87
|
|
|
|
|
152
|
|
|
87
|
|
|
|
|
3152
|
|
9
|
|
|
|
|
|
|
|
10
|
87
|
|
|
87
|
|
553
|
use base 'Venus::Core'; |
|
87
|
|
|
|
|
221
|
|
|
87
|
|
|
|
|
48937
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# METHODS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub BUILD { |
15
|
13843
|
|
|
13843
|
0
|
28564
|
my ($self, @data) = @_; |
16
|
|
|
|
|
|
|
|
17
|
87
|
|
|
87
|
|
633
|
no strict 'refs'; |
|
87
|
|
|
|
|
178
|
|
|
87
|
|
|
|
|
9630
|
|
18
|
|
|
|
|
|
|
|
19
|
13843
|
|
|
|
|
20275
|
my @roles = @{$self->META->roles}; |
|
13843
|
|
|
|
|
37765
|
|
20
|
|
|
|
|
|
|
|
21
|
13843
|
|
|
|
|
46270
|
for my $action (grep defined, map *{"${_}::BUILD"}{"CODE"}, @roles) { |
|
258720
|
|
|
|
|
639265
|
|
22
|
22884
|
|
|
|
|
61367
|
$self->$action(@data); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
13834
|
|
|
|
|
45528
|
return $self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub DESTROY { |
29
|
13342
|
|
|
13342
|
|
142660
|
my ($self, @data) = @_; |
30
|
|
|
|
|
|
|
|
31
|
87
|
|
|
87
|
|
617
|
no strict 'refs'; |
|
87
|
|
|
|
|
233
|
|
|
87
|
|
|
|
|
21117
|
|
32
|
|
|
|
|
|
|
|
33
|
13342
|
|
|
|
|
19351
|
my @mixins = @{$self->META->mixins}; |
|
13342
|
|
|
|
|
35044
|
|
34
|
|
|
|
|
|
|
|
35
|
13342
|
|
|
|
|
33180
|
for my $action (grep defined, map *{"${_}::DESTROY"}{"CODE"}, @mixins) { |
|
37
|
|
|
|
|
184
|
|
36
|
0
|
|
|
|
|
0
|
$self->$action(@data); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
13342
|
|
|
|
|
18395
|
my @roles = @{$self->META->roles}; |
|
13342
|
|
|
|
|
27584
|
|
40
|
|
|
|
|
|
|
|
41
|
13342
|
|
|
|
|
28907
|
for my $action (grep defined, map *{"${_}::DESTROY"}{"CODE"}, @roles) { |
|
249489
|
|
|
|
|
587692
|
|
42
|
0
|
|
|
|
|
0
|
$self->$action(@data); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
13342
|
|
|
|
|
148248
|
return $self; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub does { |
49
|
582
|
|
|
582
|
1
|
25205
|
my ($self, @args) = @_; |
50
|
|
|
|
|
|
|
|
51
|
582
|
|
|
|
|
2761
|
return $self->DOES(@args); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub EXPORT { |
55
|
3023
|
|
|
3023
|
0
|
6266
|
my ($self, $into) = @_; |
56
|
|
|
|
|
|
|
|
57
|
3023
|
|
|
|
|
9438
|
return []; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub IMPORT { |
61
|
3023
|
|
|
3023
|
0
|
6651
|
my ($self, $into) = @_; |
62
|
|
|
|
|
|
|
|
63
|
87
|
|
|
87
|
|
1019
|
no strict 'refs'; |
|
87
|
|
|
|
|
237
|
|
|
87
|
|
|
|
|
3641
|
|
64
|
87
|
|
|
87
|
|
593
|
no warnings 'redefine'; |
|
87
|
|
|
|
|
171
|
|
|
87
|
|
|
|
|
26441
|
|
65
|
|
|
|
|
|
|
|
66
|
3023
|
|
|
|
|
4873
|
for my $name (@{$self->EXPORT($into)}) { |
|
3023
|
|
|
|
|
9168
|
|
67
|
0
|
|
|
|
|
0
|
*{"${into}::${name}"} = \&{"@{[$self->NAME]}::${name}"}; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
3023
|
|
|
|
|
191584
|
return $self; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub import { |
74
|
3020
|
|
|
3020
|
|
8991
|
my ($self, @args) = @_; |
75
|
|
|
|
|
|
|
|
76
|
3020
|
|
|
|
|
7869
|
my $target = caller; |
77
|
|
|
|
|
|
|
|
78
|
3020
|
|
|
|
|
12999
|
$self->USE($target); |
79
|
|
|
|
|
|
|
|
80
|
3020
|
|
|
|
|
10070
|
return $self->IMPORT($target, @args); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub meta { |
84
|
34
|
|
|
34
|
1
|
834
|
my ($self) = @_; |
85
|
|
|
|
|
|
|
|
86
|
34
|
|
|
|
|
106
|
return $self->META; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub new { |
90
|
13843
|
|
|
13843
|
1
|
96213
|
my ($self, @args) = @_; |
91
|
|
|
|
|
|
|
|
92
|
13843
|
|
|
|
|
48000
|
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 |