line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus::Space; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
70222
|
use 5.018; |
|
10
|
|
|
|
|
53
|
|
4
|
|
|
|
|
|
|
|
5
|
10
|
|
|
10
|
|
64
|
use strict; |
|
10
|
|
|
|
|
23
|
|
|
10
|
|
|
|
|
234
|
|
6
|
10
|
|
|
10
|
|
62
|
use warnings; |
|
10
|
|
|
|
|
25
|
|
|
10
|
|
|
|
|
328
|
|
7
|
|
|
|
|
|
|
|
8
|
10
|
|
|
10
|
|
511
|
use Venus::Class 'base'; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
77
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
base 'Venus::Name'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
state $SERIAL = 0; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# BUILDERS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub build_self { |
17
|
499
|
|
|
499
|
0
|
914
|
my ($self, $data) = @_; |
18
|
|
|
|
|
|
|
|
19
|
499
|
50
|
|
|
|
1420
|
$self->{value} = $self->package if !$self->lookslike_a_pragma; |
20
|
|
|
|
|
|
|
|
21
|
499
|
|
|
|
|
1160
|
return $self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# METHODS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub all { |
27
|
3
|
|
|
3
|
1
|
8
|
my ($self, $name, @args) = @_; |
28
|
|
|
|
|
|
|
|
29
|
3
|
|
|
|
|
5
|
my $result = []; |
30
|
3
|
|
|
|
|
18
|
my $class = $self->class; |
31
|
|
|
|
|
|
|
|
32
|
3
|
|
|
|
|
10
|
for my $package ($self->package, @{$self->inherits}) { |
|
3
|
|
|
|
|
20
|
|
33
|
7
|
|
|
|
|
23
|
push @$result, [$package, $class->new($package)->$name(@args)]; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
3
|
|
|
|
|
22
|
return $result; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub append { |
40
|
9
|
|
|
9
|
1
|
32
|
my ($self, @args) = @_; |
41
|
|
|
|
|
|
|
|
42
|
9
|
|
|
|
|
36
|
my $class = $self->class; |
43
|
|
|
|
|
|
|
|
44
|
9
|
|
|
|
|
43
|
my $path = join '/', |
45
|
|
|
|
|
|
|
$self->path, map $class->new($_)->path, @args; |
46
|
|
|
|
|
|
|
|
47
|
9
|
|
|
|
|
50
|
return $class->new($path); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub array { |
51
|
11
|
|
|
11
|
1
|
37
|
my ($self, $name, @data) = @_; |
52
|
|
|
|
|
|
|
|
53
|
10
|
|
|
10
|
|
90
|
no strict 'refs'; |
|
10
|
|
|
|
|
27
|
|
|
10
|
|
|
|
|
1261
|
|
54
|
|
|
|
|
|
|
|
55
|
11
|
|
|
|
|
30
|
my $class = $self->package; |
56
|
|
|
|
|
|
|
|
57
|
11
|
100
|
|
|
|
43
|
@{"${class}::${name}"} = @data if @data; |
|
2
|
|
|
|
|
49
|
|
58
|
|
|
|
|
|
|
|
59
|
11
|
|
|
|
|
24
|
return [@{"${class}::${name}"}]; |
|
11
|
|
|
|
|
120
|
|
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub arrays { |
63
|
2
|
|
|
2
|
1
|
16
|
my ($self) = @_; |
64
|
|
|
|
|
|
|
|
65
|
10
|
|
|
10
|
|
247
|
no strict 'refs'; |
|
10
|
|
|
|
|
27
|
|
|
10
|
|
|
|
|
4626
|
|
66
|
|
|
|
|
|
|
|
67
|
2
|
|
|
|
|
18
|
my $class = $self->package; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
my $arrays = [ |
70
|
6
|
|
|
|
|
32
|
sort grep !!@{"${class}::$_"}, |
71
|
2
|
|
|
|
|
14
|
grep /^[_a-zA-Z]\w*$/, keys %{"${class}::"} |
|
2
|
|
|
|
|
39
|
|
72
|
|
|
|
|
|
|
]; |
73
|
|
|
|
|
|
|
|
74
|
2
|
|
|
|
|
28
|
return $arrays; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub attributes { |
78
|
2
|
|
|
2
|
1
|
6
|
my ($self) = @_; |
79
|
|
|
|
|
|
|
|
80
|
2
|
|
|
|
|
7
|
return $self->meta->local('attrs'); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub authority { |
84
|
2
|
|
|
2
|
1
|
6
|
my ($self) = @_; |
85
|
|
|
|
|
|
|
|
86
|
2
|
|
|
|
|
9
|
return $self->scalar('AUTHORITY'); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
sub basename { |
90
|
2
|
|
|
2
|
1
|
14
|
my ($self) = @_; |
91
|
|
|
|
|
|
|
|
92
|
2
|
|
|
|
|
15
|
return $self->parse->[-1]; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub blessed { |
96
|
7
|
|
|
7
|
1
|
17
|
my ($self, $data) = @_; |
97
|
|
|
|
|
|
|
|
98
|
7
|
|
100
|
|
|
31
|
$data //= {}; |
99
|
|
|
|
|
|
|
|
100
|
7
|
|
|
|
|
26
|
my $class = $self->load; |
101
|
|
|
|
|
|
|
|
102
|
7
|
|
|
|
|
50
|
return CORE::bless($data, $class); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub build { |
106
|
3
|
|
|
3
|
1
|
10
|
my ($self, @args) = @_; |
107
|
|
|
|
|
|
|
|
108
|
3
|
|
|
|
|
11
|
my $class = $self->load; |
109
|
|
|
|
|
|
|
|
110
|
3
|
|
|
|
|
18
|
return $self->call('new', $class, @args); |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub call { |
114
|
42
|
|
|
42
|
1
|
101
|
my ($self, $func, @args) = @_; |
115
|
|
|
|
|
|
|
|
116
|
42
|
|
|
|
|
90
|
my $class = $self->load; |
117
|
|
|
|
|
|
|
|
118
|
42
|
50
|
|
|
|
120
|
unless ($func) { |
119
|
0
|
|
|
|
|
0
|
$self->error({ |
120
|
|
|
|
|
|
|
throw => 'error_on_call_undefined', |
121
|
|
|
|
|
|
|
package => $class, |
122
|
|
|
|
|
|
|
routine => $func, |
123
|
|
|
|
|
|
|
}); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
42
|
|
|
|
|
227
|
my $next = $class->can($func); |
127
|
|
|
|
|
|
|
|
128
|
42
|
100
|
|
|
|
88
|
unless ($next) { |
129
|
2
|
100
|
|
|
|
19
|
if ($class->can('AUTOLOAD')) { |
130
|
10
|
|
|
10
|
|
80
|
$next = sub { no strict 'refs'; &{"${class}::${func}"}(@args) }; |
|
10
|
|
|
1
|
|
21
|
|
|
10
|
|
|
|
|
6255
|
|
|
1
|
|
|
|
|
17
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
28
|
|
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
42
|
100
|
|
|
|
85
|
unless ($next) { |
135
|
1
|
|
|
|
|
21
|
$self->error({ |
136
|
|
|
|
|
|
|
throw => 'error_on_call_missing', |
137
|
|
|
|
|
|
|
package => $class, |
138
|
|
|
|
|
|
|
routine => $func, |
139
|
|
|
|
|
|
|
}); |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
41
|
|
|
|
|
101
|
@_ = @args; goto $next; |
|
41
|
|
|
|
|
242
|
|
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub chain { |
146
|
3
|
|
|
3
|
1
|
8
|
my ($self, @steps) = @_; |
147
|
|
|
|
|
|
|
|
148
|
3
|
|
|
|
|
6
|
my $result = $self; |
149
|
|
|
|
|
|
|
|
150
|
3
|
|
|
|
|
10
|
for my $step (@steps) { |
151
|
5
|
100
|
|
|
|
18
|
my ($name, @args) = (ref($step) eq 'ARRAY') ? @$step : ($step); |
152
|
|
|
|
|
|
|
|
153
|
5
|
|
|
|
|
56
|
$result = $result->$name(@args); |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
3
|
|
|
|
|
16
|
return $result; |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
sub child { |
160
|
6
|
|
|
6
|
1
|
22
|
my ($self, @args) = @_; |
161
|
|
|
|
|
|
|
|
162
|
6
|
|
|
|
|
18
|
return $self->append(@args); |
163
|
|
|
|
|
|
|
} |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub children { |
166
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
167
|
|
|
|
|
|
|
|
168
|
1
|
|
|
|
|
6
|
my %list; |
169
|
|
|
|
|
|
|
my $path; |
170
|
1
|
|
|
|
|
0
|
my $type; |
171
|
|
|
|
|
|
|
|
172
|
1
|
|
|
|
|
4
|
$path = quotemeta $self->path; |
173
|
1
|
|
|
|
|
2
|
$type = 'pm'; |
174
|
|
|
|
|
|
|
|
175
|
1
|
|
|
|
|
26
|
my $regexp = qr/$path\/[^\/]+\.$type/; |
176
|
|
|
|
|
|
|
|
177
|
1
|
|
|
|
|
75
|
for my $item (keys %INC) { |
178
|
157
|
50
|
|
|
|
435
|
$list{$item}++ if $item =~ /$regexp$/; |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
1
|
|
|
|
|
9
|
my %seen; |
182
|
|
|
|
|
|
|
|
183
|
1
|
|
|
|
|
5
|
for my $dir (@INC) { |
184
|
11
|
100
|
|
|
|
49
|
next if $seen{$dir}++; |
185
|
|
|
|
|
|
|
|
186
|
9
|
|
|
|
|
23
|
my $re = quotemeta $dir; |
187
|
27
|
|
|
|
|
118
|
map { s/^$re\///; $list{$_}++ } |
|
27
|
|
|
|
|
93
|
|
188
|
9
|
|
|
|
|
20
|
grep !$list{$_}, glob "$dir/@{[$self->path]}/*.$type"; |
|
9
|
|
|
|
|
27
|
|
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
1
|
|
|
|
|
14
|
my $class = $self->class; |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
return [ |
194
|
|
|
|
|
|
|
map $class->new($_), |
195
|
1
|
|
|
|
|
20
|
map {s/(.*)\.$type$/$1/r} |
|
27
|
|
|
|
|
158
|
|
196
|
|
|
|
|
|
|
sort keys %list |
197
|
|
|
|
|
|
|
]; |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub cop { |
201
|
2
|
|
|
2
|
1
|
8
|
my ($self, $func, @args) = @_; |
202
|
|
|
|
|
|
|
|
203
|
2
|
|
|
|
|
7
|
my $class = $self->load; |
204
|
|
|
|
|
|
|
|
205
|
2
|
50
|
|
|
|
9
|
if (!$func) { |
206
|
0
|
|
|
|
|
0
|
$self->error({ |
207
|
|
|
|
|
|
|
throw => 'error_on_cop_undefined', |
208
|
|
|
|
|
|
|
package => $class, |
209
|
|
|
|
|
|
|
routine => $func, |
210
|
|
|
|
|
|
|
}); |
211
|
|
|
|
|
|
|
} |
212
|
|
|
|
|
|
|
|
213
|
2
|
|
|
|
|
15
|
my $next = $class->can($func); |
214
|
|
|
|
|
|
|
|
215
|
2
|
100
|
|
|
|
6
|
unless ($next) { |
216
|
1
|
|
|
|
|
9
|
$self->error({ |
217
|
|
|
|
|
|
|
throw => 'error_on_cop_missing', |
218
|
|
|
|
|
|
|
package => $class, |
219
|
|
|
|
|
|
|
routine => $func, |
220
|
|
|
|
|
|
|
}); |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
1
|
50
|
|
1
|
|
10
|
return sub { $next->(@args ? (@args, @_) : @_) }; |
|
1
|
|
|
|
|
32
|
|
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub data { |
227
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
228
|
|
|
|
|
|
|
|
229
|
10
|
|
|
10
|
|
80
|
no strict 'refs'; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
3386
|
|
230
|
|
|
|
|
|
|
|
231
|
1
|
|
|
|
|
3
|
my $class = $self->package; |
232
|
|
|
|
|
|
|
|
233
|
1
|
|
|
|
|
5
|
local $.; |
234
|
|
|
|
|
|
|
|
235
|
1
|
|
|
|
|
3
|
my $handle = \*{"${class}::DATA"}; |
|
1
|
|
|
|
|
7
|
|
236
|
|
|
|
|
|
|
|
237
|
1
|
50
|
|
|
|
10
|
return '' if !fileno $handle; |
238
|
|
|
|
|
|
|
|
239
|
0
|
|
|
|
|
0
|
seek $handle, 0, 0; |
240
|
|
|
|
|
|
|
|
241
|
0
|
|
|
|
|
0
|
my $data = join '', <$handle>; |
242
|
|
|
|
|
|
|
|
243
|
0
|
|
|
|
|
0
|
$data =~ s/^.*\n__DATA__\r?\n/\n/s; |
244
|
0
|
|
|
|
|
0
|
$data =~ s/\n__END__\r?\n.*$/\n/s; |
245
|
|
|
|
|
|
|
|
246
|
0
|
|
|
|
|
0
|
return $data; |
247
|
|
|
|
|
|
|
} |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
sub eval { |
250
|
13
|
|
|
13
|
1
|
55
|
my ($self, @args) = @_; |
251
|
|
|
|
|
|
|
|
252
|
13
|
|
|
|
|
27
|
local $@; |
253
|
|
|
|
|
|
|
|
254
|
13
|
|
|
1
|
|
32
|
my $result = eval join ' ', map "$_", "package @{[$self->package]};", @args; |
|
13
|
|
|
1
|
|
51
|
|
|
1
|
|
|
1
|
|
7
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
69
|
|
|
1
|
|
|
|
|
17
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
68
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
65
|
|
255
|
|
|
|
|
|
|
|
256
|
13
|
100
|
|
|
|
95
|
if (my $error = $@) { |
257
|
2
|
|
|
|
|
15
|
$self->error({ |
258
|
|
|
|
|
|
|
throw => 'error_on_eval', |
259
|
|
|
|
|
|
|
package => $self->package, |
260
|
|
|
|
|
|
|
error => $error, |
261
|
|
|
|
|
|
|
}); |
262
|
|
|
|
|
|
|
} |
263
|
|
|
|
|
|
|
|
264
|
11
|
|
|
|
|
89
|
return $result; |
265
|
|
|
|
|
|
|
} |
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
sub explain { |
268
|
54
|
|
|
54
|
1
|
2828
|
my ($self) = @_; |
269
|
|
|
|
|
|
|
|
270
|
54
|
|
|
|
|
173
|
return $self->package; |
271
|
|
|
|
|
|
|
} |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
sub hash { |
274
|
2
|
|
|
2
|
1
|
6
|
my ($self, $name, @data) = @_; |
275
|
|
|
|
|
|
|
|
276
|
10
|
|
|
10
|
|
79
|
no strict 'refs'; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
1127
|
|
277
|
|
|
|
|
|
|
|
278
|
2
|
|
|
|
|
6
|
my $class = $self->package; |
279
|
|
|
|
|
|
|
|
280
|
2
|
100
|
|
|
|
17
|
%{"${class}::${name}"} = (@data) if @data; |
|
1
|
|
|
|
|
8
|
|
281
|
|
|
|
|
|
|
|
282
|
2
|
|
|
|
|
3
|
return {%{"${class}::${name}"}}; |
|
2
|
|
|
|
|
24
|
|
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
sub hashes { |
286
|
2
|
|
|
2
|
1
|
9
|
my ($self) = @_; |
287
|
|
|
|
|
|
|
|
288
|
10
|
|
|
10
|
|
71
|
no strict 'refs'; |
|
10
|
|
|
|
|
17
|
|
|
10
|
|
|
|
|
2932
|
|
289
|
|
|
|
|
|
|
|
290
|
2
|
|
|
|
|
8
|
my $class = $self->package; |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
return [ |
293
|
14
|
|
|
|
|
50
|
sort grep !!%{"${class}::$_"}, |
294
|
2
|
|
|
|
|
13
|
grep /^[_a-zA-Z]\w*$/, keys %{"${class}::"} |
|
2
|
|
|
|
|
43
|
|
295
|
|
|
|
|
|
|
]; |
296
|
|
|
|
|
|
|
} |
297
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
sub id { |
299
|
2
|
|
|
2
|
1
|
8
|
my ($self) = @_; |
300
|
|
|
|
|
|
|
|
301
|
2
|
|
|
|
|
13
|
return $self->label; |
302
|
|
|
|
|
|
|
} |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
sub init { |
305
|
6
|
|
|
6
|
1
|
24
|
my ($self) = @_; |
306
|
|
|
|
|
|
|
|
307
|
6
|
|
|
|
|
74
|
$self->tryload; |
308
|
|
|
|
|
|
|
|
309
|
6
|
100
|
|
|
|
32
|
$self->eval('sub import') if !$self->loaded; |
310
|
|
|
|
|
|
|
|
311
|
6
|
|
|
|
|
30
|
return $self->package; |
312
|
|
|
|
|
|
|
} |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
sub inherits { |
315
|
8
|
|
|
8
|
1
|
17
|
my ($self) = @_; |
316
|
|
|
|
|
|
|
|
317
|
8
|
|
|
|
|
23
|
return $self->array('ISA'); |
318
|
|
|
|
|
|
|
} |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
sub included { |
321
|
428
|
|
|
428
|
1
|
721
|
my ($self) = @_; |
322
|
|
|
|
|
|
|
|
323
|
428
|
|
|
|
|
1233
|
return $INC{$self->format('path', '%s.pm')}; |
324
|
|
|
|
|
|
|
} |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
sub inject { |
327
|
1
|
|
|
1
|
1
|
4
|
my ($self, $name, $coderef) = @_; |
328
|
|
|
|
|
|
|
|
329
|
10
|
|
|
10
|
|
81
|
no strict 'refs'; |
|
10
|
|
|
|
|
22
|
|
|
10
|
|
|
|
|
375
|
|
330
|
10
|
|
|
10
|
|
56
|
no warnings 'redefine'; |
|
10
|
|
|
|
|
26
|
|
|
10
|
|
|
|
|
9478
|
|
331
|
|
|
|
|
|
|
|
332
|
1
|
|
|
|
|
5
|
my $class = $self->package; |
333
|
|
|
|
|
|
|
|
334
|
1
|
|
50
|
0
|
|
32
|
return *{"${class}::${name}"} = $coderef || sub{$class}; |
|
1
|
|
|
|
|
20
|
|
|
0
|
|
|
|
|
0
|
|
335
|
|
|
|
|
|
|
} |
336
|
|
|
|
|
|
|
|
337
|
|
|
|
|
|
|
sub integrates { |
338
|
2
|
|
|
2
|
1
|
9
|
my ($self) = @_; |
339
|
|
|
|
|
|
|
|
340
|
2
|
|
|
|
|
10
|
my $roles = $self->meta->roles; |
341
|
|
|
|
|
|
|
|
342
|
2
|
|
50
|
|
|
10
|
return $roles || []; |
343
|
|
|
|
|
|
|
} |
344
|
|
|
|
|
|
|
|
345
|
|
|
|
|
|
|
sub lfile { |
346
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
347
|
|
|
|
|
|
|
|
348
|
1
|
|
|
|
|
5
|
return $self->format('path', '%s.pm'); |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
|
351
|
|
|
|
|
|
|
sub load { |
352
|
325
|
|
|
325
|
1
|
595
|
my ($self) = @_; |
353
|
|
|
|
|
|
|
|
354
|
325
|
|
|
|
|
754
|
my $class = $self->package; |
355
|
|
|
|
|
|
|
|
356
|
325
|
100
|
66
|
|
|
1216
|
return $class if $class eq 'main' || $self->loaded; |
357
|
|
|
|
|
|
|
|
358
|
19
|
|
|
|
|
66
|
my $error = do{local $@; eval "require $class"; $@}; |
|
19
|
|
|
|
|
36
|
|
|
19
|
|
|
|
|
1131
|
|
|
19
|
|
|
|
|
295212
|
|
359
|
|
|
|
|
|
|
|
360
|
19
|
100
|
|
|
|
123
|
if ($error) { |
361
|
6
|
|
50
|
|
|
102
|
$self->error({ |
362
|
|
|
|
|
|
|
throw => 'error_on_load', |
363
|
|
|
|
|
|
|
error => $error || 'cause unknown', |
364
|
|
|
|
|
|
|
package => $class, |
365
|
|
|
|
|
|
|
}); |
366
|
|
|
|
|
|
|
} |
367
|
|
|
|
|
|
|
|
368
|
13
|
|
|
|
|
205
|
return $class; |
369
|
|
|
|
|
|
|
} |
370
|
|
|
|
|
|
|
|
371
|
|
|
|
|
|
|
sub loaded { |
372
|
427
|
|
|
427
|
1
|
766
|
my ($self) = @_; |
373
|
|
|
|
|
|
|
|
374
|
427
|
100
|
100
|
|
|
903
|
return ($self->included || @{$self->routines}) ? true : false; |
375
|
|
|
|
|
|
|
} |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
sub locate { |
378
|
5
|
|
|
5
|
1
|
14
|
my ($self) = @_; |
379
|
|
|
|
|
|
|
|
380
|
5
|
|
|
|
|
16
|
my $found = ''; |
381
|
|
|
|
|
|
|
|
382
|
5
|
|
|
|
|
24
|
my $file = $self->format('path', '%s.pm'); |
383
|
|
|
|
|
|
|
|
384
|
5
|
|
|
|
|
20
|
for my $path (@INC) { |
385
|
26
|
100
|
|
|
|
554
|
do { $found = "$path/$file"; last } if -f "$path/$file"; |
|
4
|
|
|
|
|
18
|
|
|
4
|
|
|
|
|
11
|
|
386
|
|
|
|
|
|
|
} |
387
|
|
|
|
|
|
|
|
388
|
5
|
|
|
|
|
39
|
return $found; |
389
|
|
|
|
|
|
|
} |
390
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
sub meta { |
392
|
5
|
|
|
5
|
1
|
18
|
my ($self) = @_; |
393
|
|
|
|
|
|
|
|
394
|
5
|
|
|
|
|
32
|
require Venus::Meta; |
395
|
|
|
|
|
|
|
|
396
|
5
|
|
|
|
|
24
|
return Venus::Meta->new(name => $self->package); |
397
|
|
|
|
|
|
|
} |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
sub mock { |
400
|
1
|
|
|
1
|
1
|
16
|
my ($self) = @_; |
401
|
|
|
|
|
|
|
|
402
|
1
|
|
|
|
|
31
|
my $name = sprintf '%s::Mock::%04d::%s', $self->class, ++$SERIAL, $self->package; |
403
|
|
|
|
|
|
|
|
404
|
1
|
|
|
|
|
7
|
my $space = $self->class->new($name); |
405
|
|
|
|
|
|
|
|
406
|
1
|
50
|
|
|
|
18
|
$space->do('init')->array('ISA', $self->package) if !$space->loaded; |
407
|
|
|
|
|
|
|
|
408
|
1
|
|
|
|
|
6
|
return $space; |
409
|
|
|
|
|
|
|
} |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
sub name { |
412
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
413
|
|
|
|
|
|
|
|
414
|
1
|
|
|
|
|
4
|
return $self->package; |
415
|
|
|
|
|
|
|
} |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
sub parent { |
418
|
3
|
|
|
3
|
1
|
9
|
my ($self) = @_; |
419
|
|
|
|
|
|
|
|
420
|
3
|
|
|
|
|
7
|
my @parts = @{$self->parse}; |
|
3
|
|
|
|
|
20
|
|
421
|
|
|
|
|
|
|
|
422
|
3
|
50
|
|
|
|
21
|
pop @parts if @parts > 1; |
423
|
|
|
|
|
|
|
|
424
|
3
|
|
|
|
|
21
|
my $class = $self->class; |
425
|
|
|
|
|
|
|
|
426
|
3
|
|
|
|
|
23
|
return $class->new(join '/', @parts); |
427
|
|
|
|
|
|
|
} |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
sub parse { |
430
|
18
|
|
|
18
|
1
|
51
|
my ($self) = @_; |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
return [ |
433
|
18
|
|
|
|
|
75
|
map ucfirst, |
434
|
|
|
|
|
|
|
map join('', map(ucfirst, split /[-_]/)), |
435
|
|
|
|
|
|
|
split /[^-_a-zA-Z0-9.]+/, |
436
|
|
|
|
|
|
|
$self->path |
437
|
|
|
|
|
|
|
]; |
438
|
|
|
|
|
|
|
} |
439
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
sub parts { |
441
|
7
|
|
|
7
|
1
|
15
|
my ($self) = @_; |
442
|
|
|
|
|
|
|
|
443
|
7
|
|
|
|
|
21
|
return $self->parse; |
444
|
|
|
|
|
|
|
} |
445
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
sub pfile { |
447
|
1
|
|
|
1
|
1
|
11
|
my ($self) = @_; |
448
|
|
|
|
|
|
|
|
449
|
1
|
|
|
|
|
15
|
return $self->format('path', '%s.pod'); |
450
|
|
|
|
|
|
|
} |
451
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
sub prepend { |
453
|
3
|
|
|
3
|
1
|
10
|
my ($self, @args) = @_; |
454
|
|
|
|
|
|
|
|
455
|
3
|
|
|
|
|
12
|
my $class = $self->class; |
456
|
|
|
|
|
|
|
|
457
|
3
|
|
|
|
|
14
|
my $path = join '/', |
458
|
|
|
|
|
|
|
(map $class->new($_)->path, @args), $self->path; |
459
|
|
|
|
|
|
|
|
460
|
3
|
|
|
|
|
13
|
return $class->new($path); |
461
|
|
|
|
|
|
|
} |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
sub purge { |
464
|
1
|
|
|
1
|
1
|
8
|
my ($self) = @_; |
465
|
|
|
|
|
|
|
|
466
|
1
|
50
|
|
|
|
9
|
return $self if $self->unloaded; |
467
|
|
|
|
|
|
|
|
468
|
1
|
|
|
|
|
4
|
my $package = $self->package; |
469
|
|
|
|
|
|
|
|
470
|
10
|
|
|
10
|
|
77
|
no strict 'refs'; |
|
10
|
|
|
|
|
24
|
|
|
10
|
|
|
|
|
4018
|
|
471
|
|
|
|
|
|
|
|
472
|
1
|
|
|
|
|
5
|
for my $name (grep !/\A[^:]+::\z/, keys %{"${package}::"}) { |
|
1
|
|
|
|
|
17
|
|
473
|
5
|
|
|
|
|
11
|
undef *{"${package}::${name}"}; delete ${"${package}::"}{$name}; |
|
5
|
|
|
|
|
26
|
|
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
16
|
|
474
|
|
|
|
|
|
|
} |
475
|
|
|
|
|
|
|
|
476
|
1
|
|
|
|
|
6
|
delete $INC{$self->format('path', '%s.pm')}; |
477
|
|
|
|
|
|
|
|
478
|
1
|
|
|
|
|
12
|
return $self; |
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
|
481
|
|
|
|
|
|
|
sub rebase { |
482
|
1
|
|
|
1
|
1
|
4
|
my ($self, @args) = @_; |
483
|
|
|
|
|
|
|
|
484
|
1
|
|
|
|
|
10
|
my $class = $self->class; |
485
|
|
|
|
|
|
|
|
486
|
1
|
|
|
|
|
6
|
my $path = join '/', map $class->new($_)->path, @args; |
487
|
|
|
|
|
|
|
|
488
|
1
|
|
|
|
|
13
|
return $class->new($self->basename)->prepend($path); |
489
|
|
|
|
|
|
|
} |
490
|
|
|
|
|
|
|
|
491
|
|
|
|
|
|
|
sub reload { |
492
|
2
|
|
|
2
|
1
|
5
|
my ($self) = @_; |
493
|
|
|
|
|
|
|
|
494
|
2
|
|
|
|
|
14
|
$self->unload; |
495
|
|
|
|
|
|
|
|
496
|
2
|
|
|
|
|
8
|
return $self->load; |
497
|
|
|
|
|
|
|
} |
498
|
|
|
|
|
|
|
|
499
|
|
|
|
|
|
|
sub require { |
500
|
4
|
|
|
4
|
1
|
16
|
my ($self, $target) = @_; |
501
|
|
|
|
|
|
|
|
502
|
4
|
50
|
|
|
|
71
|
$target = "'$target'" if -f $target; |
503
|
|
|
|
|
|
|
|
504
|
4
|
|
|
|
|
32
|
return $self->eval("require $target"); |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
sub root { |
508
|
1
|
|
|
1
|
1
|
4
|
my ($self) = @_; |
509
|
|
|
|
|
|
|
|
510
|
1
|
|
|
|
|
6
|
return $self->parse->[0]; |
511
|
|
|
|
|
|
|
} |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
sub routine { |
514
|
3
|
|
|
3
|
1
|
10
|
my ($self, $name, $code) = @_; |
515
|
|
|
|
|
|
|
|
516
|
10
|
|
|
10
|
|
77
|
no strict 'refs'; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
1268
|
|
517
|
|
|
|
|
|
|
|
518
|
3
|
|
|
|
|
14
|
my $class = $self->package; |
519
|
|
|
|
|
|
|
|
520
|
3
|
100
|
|
|
|
28
|
*{"${class}::${name}"} = $code if $code; |
|
2
|
|
|
|
|
23
|
|
521
|
|
|
|
|
|
|
|
522
|
3
|
|
|
|
|
9
|
return *{"${class}::${name}"}{"CODE"}; |
|
3
|
|
|
|
|
21
|
|
523
|
|
|
|
|
|
|
} |
524
|
|
|
|
|
|
|
|
525
|
|
|
|
|
|
|
sub routines { |
526
|
209
|
|
|
209
|
1
|
406
|
my ($self) = @_; |
527
|
|
|
|
|
|
|
|
528
|
10
|
|
|
10
|
|
75
|
no strict 'refs'; |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
1545
|
|
529
|
|
|
|
|
|
|
|
530
|
209
|
|
|
|
|
517
|
my $class = $self->package; |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
return [ |
533
|
8050
|
|
|
|
|
17005
|
sort grep *{"${class}::$_"}{"CODE"}, |
534
|
209
|
|
|
|
|
479
|
grep /^[_a-zA-Z]\w*$/, keys %{"${class}::"} |
|
209
|
|
|
|
|
5350
|
|
535
|
|
|
|
|
|
|
]; |
536
|
|
|
|
|
|
|
} |
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
sub scalar { |
539
|
6
|
|
|
6
|
1
|
30
|
my ($self, $name, @data) = @_; |
540
|
|
|
|
|
|
|
|
541
|
10
|
|
|
10
|
|
75
|
no strict 'refs'; |
|
10
|
|
|
|
|
33
|
|
|
10
|
|
|
|
|
1204
|
|
542
|
|
|
|
|
|
|
|
543
|
6
|
|
|
|
|
22
|
my $class = $self->package; |
544
|
|
|
|
|
|
|
|
545
|
6
|
100
|
|
|
|
36
|
${"${class}::${name}"} = $data[0] if @data; |
|
1
|
|
|
|
|
13
|
|
546
|
|
|
|
|
|
|
|
547
|
6
|
|
|
|
|
20
|
return ${"${class}::${name}"}; |
|
6
|
|
|
|
|
53
|
|
548
|
|
|
|
|
|
|
} |
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
sub scalars { |
551
|
2
|
|
|
2
|
1
|
26
|
my ($self) = @_; |
552
|
|
|
|
|
|
|
|
553
|
10
|
|
|
10
|
|
92
|
no strict 'refs'; |
|
10
|
|
|
|
|
40
|
|
|
10
|
|
|
|
|
9585
|
|
554
|
|
|
|
|
|
|
|
555
|
2
|
|
|
|
|
9
|
my $class = $self->package; |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
return [ |
558
|
19
|
|
|
|
|
91
|
sort grep defined ${"${class}::$_"}, |
559
|
2
|
|
|
|
|
13
|
grep /^[_a-zA-Z]\w*$/, keys %{"${class}::"} |
|
2
|
|
|
|
|
55
|
|
560
|
|
|
|
|
|
|
]; |
561
|
|
|
|
|
|
|
} |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
sub sibling { |
564
|
1
|
|
|
1
|
1
|
6
|
my ($self, @args) = @_; |
565
|
|
|
|
|
|
|
|
566
|
1
|
|
|
|
|
7
|
return $self->parent->append(@args); |
567
|
|
|
|
|
|
|
} |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
sub siblings { |
570
|
1
|
|
|
1
|
1
|
5
|
my ($self) = @_; |
571
|
|
|
|
|
|
|
|
572
|
1
|
|
|
|
|
9
|
my %list; |
573
|
|
|
|
|
|
|
my $path; |
574
|
1
|
|
|
|
|
0
|
my $type; |
575
|
|
|
|
|
|
|
|
576
|
1
|
|
|
|
|
7
|
$path = quotemeta $self->parent->path; |
577
|
1
|
|
|
|
|
4
|
$type = 'pm'; |
578
|
|
|
|
|
|
|
|
579
|
1
|
|
|
|
|
64
|
my $regexp = qr/$path\/[^\/]+\.$type/; |
580
|
|
|
|
|
|
|
|
581
|
1
|
|
|
|
|
611
|
for my $item (keys %INC) { |
582
|
219
|
100
|
|
|
|
577
|
$list{$item}++ if $item =~ /$regexp$/; |
583
|
|
|
|
|
|
|
} |
584
|
|
|
|
|
|
|
|
585
|
1
|
|
|
|
|
13
|
my %seen; |
586
|
|
|
|
|
|
|
|
587
|
1
|
|
|
|
|
4
|
for my $dir (@INC) { |
588
|
14
|
100
|
|
|
|
78
|
next if $seen{$dir}++; |
589
|
|
|
|
|
|
|
|
590
|
10
|
|
|
|
|
29
|
my $re = quotemeta $dir; |
591
|
2
|
|
|
|
|
31
|
map { s/^$re\///; $list{$_}++ } |
|
2
|
|
|
|
|
21
|
|
592
|
10
|
|
|
|
|
23
|
grep !$list{$_}, glob "$dir/@{[$self->path]}/*.$type"; |
|
10
|
|
|
|
|
33
|
|
593
|
|
|
|
|
|
|
} |
594
|
|
|
|
|
|
|
|
595
|
1
|
|
|
|
|
13
|
my $class = $self->class; |
596
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
return [ |
598
|
|
|
|
|
|
|
map $class->new($_), |
599
|
1
|
|
|
|
|
9
|
map {s/(.*)\.$type$/$1/r} |
|
5
|
|
|
|
|
60
|
|
600
|
|
|
|
|
|
|
sort keys %list |
601
|
|
|
|
|
|
|
]; |
602
|
|
|
|
|
|
|
} |
603
|
|
|
|
|
|
|
|
604
|
|
|
|
|
|
|
sub splice { |
605
|
4
|
|
|
4
|
1
|
10
|
my ($self, $offset, $length, @list) = @_; |
606
|
|
|
|
|
|
|
|
607
|
4
|
|
|
|
|
13
|
my $class = $self->class; |
608
|
4
|
|
|
|
|
15
|
my $parts = $self->parts; |
609
|
|
|
|
|
|
|
|
610
|
4
|
100
|
|
|
|
23
|
if (@list) { |
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
611
|
1
|
|
|
|
|
2
|
CORE::splice(@{$parts}, $offset, $length, @list); |
|
1
|
|
|
|
|
5
|
|
612
|
|
|
|
|
|
|
} |
613
|
|
|
|
|
|
|
elsif (defined $length) { |
614
|
2
|
|
|
|
|
5
|
CORE::splice(@{$parts}, $offset, $length); |
|
2
|
|
|
|
|
5
|
|
615
|
|
|
|
|
|
|
} |
616
|
|
|
|
|
|
|
elsif (defined $offset) { |
617
|
1
|
|
|
|
|
2
|
CORE::splice(@{$parts}, $offset); |
|
1
|
|
|
|
|
3
|
|
618
|
|
|
|
|
|
|
} |
619
|
|
|
|
|
|
|
|
620
|
4
|
|
|
|
|
18
|
return $class->new(join '/', @$parts); |
621
|
|
|
|
|
|
|
} |
622
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
sub swap { |
624
|
2
|
|
|
2
|
1
|
9
|
my ($self, $name, $code) = @_; |
625
|
|
|
|
|
|
|
|
626
|
2
|
|
|
|
|
8
|
my $orig = (my $package = $self->package)->can($name); |
627
|
|
|
|
|
|
|
|
628
|
2
|
50
|
|
|
|
9
|
return $orig if !$code; |
629
|
|
|
|
|
|
|
|
630
|
2
|
100
|
|
|
|
8
|
if (!$orig) { |
631
|
1
|
|
|
|
|
20
|
$self->error({ |
632
|
|
|
|
|
|
|
throw => 'error_on_swap', |
633
|
|
|
|
|
|
|
package => $package, |
634
|
|
|
|
|
|
|
routine => $name, |
635
|
|
|
|
|
|
|
}); |
636
|
|
|
|
|
|
|
} |
637
|
|
|
|
|
|
|
|
638
|
1
|
|
|
1
|
|
23
|
$self->routine($name, sub {$code->($orig, @_)}); |
|
1
|
|
|
|
|
726
|
|
639
|
|
|
|
|
|
|
|
640
|
1
|
|
|
|
|
6
|
return $orig; |
641
|
|
|
|
|
|
|
} |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
sub tfile { |
644
|
1
|
|
|
1
|
1
|
9
|
my ($self) = @_; |
645
|
|
|
|
|
|
|
|
646
|
1
|
|
|
|
|
8
|
return $self->format('label', '%s.t'); |
647
|
|
|
|
|
|
|
} |
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
sub tryload { |
650
|
10
|
|
|
10
|
1
|
33
|
my ($self) = @_; |
651
|
|
|
|
|
|
|
|
652
|
10
|
|
|
|
|
20
|
return do { local $@; eval { $self->load }; int!$@ }; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
27
|
|
|
10
|
|
|
|
|
39
|
|
|
10
|
|
|
|
|
60
|
|
653
|
|
|
|
|
|
|
} |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
sub use { |
656
|
3
|
|
|
3
|
1
|
11
|
my ($self, $target, @params) = @_; |
657
|
|
|
|
|
|
|
|
658
|
3
|
|
|
|
|
5
|
my $version; |
659
|
|
|
|
|
|
|
|
660
|
3
|
100
|
|
|
|
15
|
($target, $version) = @$target if ref $target eq 'ARRAY'; |
661
|
|
|
|
|
|
|
|
662
|
3
|
|
|
|
|
13
|
$self->require($target); |
663
|
|
|
|
|
|
|
|
664
|
3
|
|
|
|
|
12
|
require Scalar::Util; |
665
|
|
|
|
|
|
|
|
666
|
3
|
100
|
|
|
|
41
|
my @statement = ( |
667
|
|
|
|
|
|
|
'no strict "subs";', |
668
|
|
|
|
|
|
|
( |
669
|
|
|
|
|
|
|
Scalar::Util::looks_like_number($version) |
670
|
|
|
|
|
|
|
? "${target}->VERSION($version);" : () |
671
|
|
|
|
|
|
|
), |
672
|
|
|
|
|
|
|
'sub{ my ($target, @params) = @_; $target->import(@params)}' |
673
|
|
|
|
|
|
|
); |
674
|
|
|
|
|
|
|
|
675
|
3
|
|
|
|
|
16
|
$self->eval(join("\n", @statement))->($target, @params); |
676
|
|
|
|
|
|
|
|
677
|
2
|
|
|
|
|
29
|
return $self; |
678
|
|
|
|
|
|
|
} |
679
|
|
|
|
|
|
|
|
680
|
|
|
|
|
|
|
sub variables { |
681
|
1
|
|
|
1
|
1
|
3
|
my ($self) = @_; |
682
|
|
|
|
|
|
|
|
683
|
1
|
|
|
|
|
5
|
return [map [$_, [sort @{$self->$_}]], qw(arrays hashes scalars)]; |
|
3
|
|
|
|
|
32
|
|
684
|
|
|
|
|
|
|
} |
685
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
sub version { |
687
|
2
|
|
|
2
|
1
|
5
|
my ($self) = @_; |
688
|
|
|
|
|
|
|
|
689
|
2
|
|
|
|
|
7
|
return $self->scalar('VERSION'); |
690
|
|
|
|
|
|
|
} |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
sub unload { |
693
|
87
|
|
|
87
|
1
|
489
|
my ($self) = @_; |
694
|
|
|
|
|
|
|
|
695
|
87
|
100
|
|
|
|
281
|
return $self if $self->unloaded; |
696
|
|
|
|
|
|
|
|
697
|
53
|
|
|
|
|
233
|
my $package = $self->package; |
698
|
|
|
|
|
|
|
|
699
|
10
|
|
|
10
|
|
85
|
no strict 'refs'; |
|
10
|
|
|
|
|
27
|
|
|
10
|
|
|
|
|
2226
|
|
700
|
|
|
|
|
|
|
|
701
|
53
|
|
|
|
|
152
|
for my $name (grep !/\A[^:]+::\z/, keys %{"${package}::"}) { |
|
53
|
|
|
|
|
1284
|
|
702
|
3555
|
|
|
|
|
4105
|
undef *{"${package}::${name}"}; |
|
3555
|
|
|
|
|
9449
|
|
703
|
|
|
|
|
|
|
} |
704
|
|
|
|
|
|
|
|
705
|
53
|
|
|
|
|
370
|
delete $INC{$self->format('path', '%s.pm')}; |
706
|
|
|
|
|
|
|
|
707
|
53
|
|
|
|
|
264
|
return $self; |
708
|
|
|
|
|
|
|
} |
709
|
|
|
|
|
|
|
|
710
|
|
|
|
|
|
|
sub unloaded { |
711
|
90
|
|
|
90
|
0
|
208
|
my ($self) = @_; |
712
|
|
|
|
|
|
|
|
713
|
90
|
100
|
|
|
|
262
|
return $self->loaded ? false : true; |
714
|
|
|
|
|
|
|
} |
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
sub visible { |
717
|
6
|
|
|
6
|
1
|
19
|
my ($self) = @_; |
718
|
|
|
|
|
|
|
|
719
|
10
|
|
|
10
|
|
87
|
no strict 'refs'; |
|
10
|
|
|
|
|
27
|
|
|
10
|
|
|
|
|
10785
|
|
720
|
|
|
|
|
|
|
|
721
|
6
|
|
|
|
|
25
|
my $package = $self->package; |
722
|
|
|
|
|
|
|
|
723
|
6
|
100
|
|
|
|
21
|
return (grep !/\A[^:]+::\z/, keys %{"${package}::"}) ? true : false; |
|
6
|
|
|
|
|
91
|
|
724
|
|
|
|
|
|
|
} |
725
|
|
|
|
|
|
|
|
726
|
|
|
|
|
|
|
# ERRORS |
727
|
|
|
|
|
|
|
|
728
|
|
|
|
|
|
|
sub error_on_call_missing { |
729
|
2
|
|
|
2
|
1
|
10
|
my ($self, $data) = @_; |
730
|
|
|
|
|
|
|
|
731
|
2
|
|
|
|
|
14
|
my $message = 'Unable to locate class method "{{routine}}" via package "{{package}}"'; |
732
|
|
|
|
|
|
|
|
733
|
|
|
|
|
|
|
my $stash = { |
734
|
|
|
|
|
|
|
package => $data->{package}, |
735
|
|
|
|
|
|
|
routine => $data->{routine}, |
736
|
2
|
|
|
|
|
12
|
}; |
737
|
|
|
|
|
|
|
|
738
|
2
|
|
|
|
|
13
|
my $result = { |
739
|
|
|
|
|
|
|
name => 'on.call.missing', |
740
|
|
|
|
|
|
|
raise => true, |
741
|
|
|
|
|
|
|
stash => $stash, |
742
|
|
|
|
|
|
|
message => $message, |
743
|
|
|
|
|
|
|
}; |
744
|
|
|
|
|
|
|
|
745
|
2
|
|
|
|
|
9
|
return $result; |
746
|
|
|
|
|
|
|
} |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
sub error_on_call_undefined { |
749
|
1
|
|
|
1
|
1
|
5
|
my ($self, $data) = @_; |
750
|
|
|
|
|
|
|
|
751
|
1
|
|
|
|
|
3
|
my $message = join ' ', 'Attempt to call undefined class method', |
752
|
|
|
|
|
|
|
'in package "{{package}}"'; |
753
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
my $stash = { |
755
|
|
|
|
|
|
|
package => $data->{package}, |
756
|
|
|
|
|
|
|
routine => $data->{routine}, |
757
|
1
|
|
|
|
|
5
|
}; |
758
|
|
|
|
|
|
|
|
759
|
1
|
|
|
|
|
7
|
my $result = { |
760
|
|
|
|
|
|
|
name => 'on.call.undefined', |
761
|
|
|
|
|
|
|
raise => true, |
762
|
|
|
|
|
|
|
stash => $stash, |
763
|
|
|
|
|
|
|
message => $message, |
764
|
|
|
|
|
|
|
}; |
765
|
|
|
|
|
|
|
|
766
|
1
|
|
|
|
|
6
|
return $result; |
767
|
|
|
|
|
|
|
} |
768
|
|
|
|
|
|
|
|
769
|
|
|
|
|
|
|
sub error_on_cop_missing { |
770
|
2
|
|
|
2
|
1
|
9
|
my ($self, $data) = @_; |
771
|
|
|
|
|
|
|
|
772
|
2
|
|
|
|
|
19
|
my $message = join ' ', 'Unable to locate object method "{{routine}}"', |
773
|
|
|
|
|
|
|
'via package "{{package}}"'; |
774
|
|
|
|
|
|
|
|
775
|
|
|
|
|
|
|
my $stash = { |
776
|
|
|
|
|
|
|
package => $data->{package}, |
777
|
|
|
|
|
|
|
routine => $data->{routine}, |
778
|
2
|
|
|
|
|
17
|
}; |
779
|
|
|
|
|
|
|
|
780
|
2
|
|
|
|
|
16
|
my $result = { |
781
|
|
|
|
|
|
|
name => 'on.cop.missing', |
782
|
|
|
|
|
|
|
raise => true, |
783
|
|
|
|
|
|
|
stash => $stash, |
784
|
|
|
|
|
|
|
message => $message, |
785
|
|
|
|
|
|
|
}; |
786
|
|
|
|
|
|
|
|
787
|
2
|
|
|
|
|
10
|
return $result; |
788
|
|
|
|
|
|
|
} |
789
|
|
|
|
|
|
|
|
790
|
|
|
|
|
|
|
sub error_on_cop_undefined { |
791
|
1
|
|
|
1
|
1
|
4
|
my ($self, $data) = @_; |
792
|
|
|
|
|
|
|
|
793
|
1
|
|
|
|
|
6
|
my $message = join ' ', 'Attempt to cop undefined object method', |
794
|
|
|
|
|
|
|
'from package "{{package}}"'; |
795
|
|
|
|
|
|
|
|
796
|
|
|
|
|
|
|
my $stash = { |
797
|
|
|
|
|
|
|
package => $data->{package}, |
798
|
|
|
|
|
|
|
routine => $data->{routine}, |
799
|
1
|
|
|
|
|
4
|
}; |
800
|
|
|
|
|
|
|
|
801
|
1
|
|
|
|
|
11
|
my $result = { |
802
|
|
|
|
|
|
|
name => 'on.cop.undefined', |
803
|
|
|
|
|
|
|
raise => true, |
804
|
|
|
|
|
|
|
stash => $stash, |
805
|
|
|
|
|
|
|
message => $message, |
806
|
|
|
|
|
|
|
}; |
807
|
|
|
|
|
|
|
|
808
|
1
|
|
|
|
|
9
|
return $result; |
809
|
|
|
|
|
|
|
} |
810
|
|
|
|
|
|
|
|
811
|
|
|
|
|
|
|
sub error_on_eval { |
812
|
3
|
|
|
3
|
1
|
13
|
my ($self, $data) = @_; |
813
|
|
|
|
|
|
|
|
814
|
3
|
|
|
|
|
10
|
my $message = $data->{error}; |
815
|
|
|
|
|
|
|
|
816
|
|
|
|
|
|
|
my $stash = { |
817
|
|
|
|
|
|
|
error => $message, |
818
|
|
|
|
|
|
|
package => $data->{package}, |
819
|
3
|
|
|
|
|
25
|
}; |
820
|
|
|
|
|
|
|
|
821
|
3
|
|
|
|
|
22
|
my $result = { |
822
|
|
|
|
|
|
|
name => 'on.eval', |
823
|
|
|
|
|
|
|
raise => true, |
824
|
|
|
|
|
|
|
stash => $stash, |
825
|
|
|
|
|
|
|
message => $message, |
826
|
|
|
|
|
|
|
}; |
827
|
|
|
|
|
|
|
|
828
|
3
|
|
|
|
|
12
|
return $result; |
829
|
|
|
|
|
|
|
} |
830
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
sub error_on_load { |
832
|
7
|
|
|
7
|
1
|
29
|
my ($self, $data) = @_; |
833
|
|
|
|
|
|
|
|
834
|
7
|
|
|
|
|
28
|
my $message = 'Error attempting to load {{package}}: "{{error}}"'; |
835
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
my $stash = { |
837
|
|
|
|
|
|
|
error => $data->{error}, |
838
|
|
|
|
|
|
|
package => $data->{package}, |
839
|
7
|
|
|
|
|
35
|
}; |
840
|
|
|
|
|
|
|
|
841
|
7
|
|
|
|
|
47
|
my $result = { |
842
|
|
|
|
|
|
|
name => 'on.load', |
843
|
|
|
|
|
|
|
raise => true, |
844
|
|
|
|
|
|
|
stash => $stash, |
845
|
|
|
|
|
|
|
message => $message, |
846
|
|
|
|
|
|
|
}; |
847
|
|
|
|
|
|
|
|
848
|
7
|
|
|
|
|
35
|
return $result; |
849
|
|
|
|
|
|
|
} |
850
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
sub error_on_swap { |
852
|
2
|
|
|
2
|
1
|
11
|
my ($self, $data) = @_; |
853
|
|
|
|
|
|
|
|
854
|
2
|
|
|
|
|
4
|
my $message = 'Attempt to swap undefined subroutine in package "{{package}}"'; |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
my $stash = { |
857
|
|
|
|
|
|
|
package => $data->{package}, |
858
|
|
|
|
|
|
|
routine => $data->{routine}, |
859
|
2
|
|
|
|
|
12
|
}; |
860
|
|
|
|
|
|
|
|
861
|
2
|
|
|
|
|
12
|
my $result = { |
862
|
|
|
|
|
|
|
name => 'on.swap', |
863
|
|
|
|
|
|
|
raise => true, |
864
|
|
|
|
|
|
|
stash => $stash, |
865
|
|
|
|
|
|
|
message => $message, |
866
|
|
|
|
|
|
|
}; |
867
|
|
|
|
|
|
|
|
868
|
2
|
|
|
|
|
8
|
return $result; |
869
|
|
|
|
|
|
|
} |
870
|
|
|
|
|
|
|
|
871
|
|
|
|
|
|
|
1; |
872
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
|
875
|
|
|
|
|
|
|
=head1 NAME |
876
|
|
|
|
|
|
|
|
877
|
|
|
|
|
|
|
Venus::Space - Space Class |
878
|
|
|
|
|
|
|
|
879
|
|
|
|
|
|
|
=cut |
880
|
|
|
|
|
|
|
|
881
|
|
|
|
|
|
|
=head1 ABSTRACT |
882
|
|
|
|
|
|
|
|
883
|
|
|
|
|
|
|
Space Class for Perl 5 |
884
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
=cut |
886
|
|
|
|
|
|
|
|
887
|
|
|
|
|
|
|
=head1 SYNOPSIS |
888
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
package main; |
890
|
|
|
|
|
|
|
|
891
|
|
|
|
|
|
|
use Venus::Space; |
892
|
|
|
|
|
|
|
|
893
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/bar'); |
894
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
# $space->package; # Foo::Bar |
896
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
=cut |
898
|
|
|
|
|
|
|
|
899
|
|
|
|
|
|
|
=head1 DESCRIPTION |
900
|
|
|
|
|
|
|
|
901
|
|
|
|
|
|
|
This package provides methods for parsing and manipulating package namespaces. |
902
|
|
|
|
|
|
|
|
903
|
|
|
|
|
|
|
=cut |
904
|
|
|
|
|
|
|
|
905
|
|
|
|
|
|
|
=head1 INHERITS |
906
|
|
|
|
|
|
|
|
907
|
|
|
|
|
|
|
This package inherits behaviors from: |
908
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
L |
910
|
|
|
|
|
|
|
|
911
|
|
|
|
|
|
|
=cut |
912
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
=head1 METHODS |
914
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
This package provides the following methods: |
916
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
=cut |
918
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
=head2 all |
920
|
|
|
|
|
|
|
|
921
|
|
|
|
|
|
|
all(Str $method, Any @args) (ArrayRef[Tuple[Str, Any]]) |
922
|
|
|
|
|
|
|
|
923
|
|
|
|
|
|
|
The all method executes any available method on the instance and all instances |
924
|
|
|
|
|
|
|
representing packages inherited by the package represented by the invocant. |
925
|
|
|
|
|
|
|
This method supports dispatching, i.e. providing a method name and arguments |
926
|
|
|
|
|
|
|
whose return value will be acted on by this method. |
927
|
|
|
|
|
|
|
|
928
|
|
|
|
|
|
|
I> |
929
|
|
|
|
|
|
|
|
930
|
|
|
|
|
|
|
=over 4 |
931
|
|
|
|
|
|
|
|
932
|
|
|
|
|
|
|
=item all example 1 |
933
|
|
|
|
|
|
|
|
934
|
|
|
|
|
|
|
package main; |
935
|
|
|
|
|
|
|
|
936
|
|
|
|
|
|
|
use Venus::Space; |
937
|
|
|
|
|
|
|
|
938
|
|
|
|
|
|
|
my $space = Venus::Space->new('Venus'); |
939
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
my $all = $space->all('id'); |
941
|
|
|
|
|
|
|
|
942
|
|
|
|
|
|
|
# [["Venus", "Venus"]] |
943
|
|
|
|
|
|
|
|
944
|
|
|
|
|
|
|
=back |
945
|
|
|
|
|
|
|
|
946
|
|
|
|
|
|
|
=over 4 |
947
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
=item all example 2 |
949
|
|
|
|
|
|
|
|
950
|
|
|
|
|
|
|
package main; |
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
use Venus::Space; |
953
|
|
|
|
|
|
|
|
954
|
|
|
|
|
|
|
my $space = Venus::Space->new('Venus/Space'); |
955
|
|
|
|
|
|
|
|
956
|
|
|
|
|
|
|
my $all = $space->all('inherits'); |
957
|
|
|
|
|
|
|
|
958
|
|
|
|
|
|
|
# [ |
959
|
|
|
|
|
|
|
# [ |
960
|
|
|
|
|
|
|
# "Venus::Space", ["Venus::Name"] |
961
|
|
|
|
|
|
|
# ], |
962
|
|
|
|
|
|
|
# [ |
963
|
|
|
|
|
|
|
# "Venus::Name", ["Venus::Kind::Utility"] |
964
|
|
|
|
|
|
|
# ], |
965
|
|
|
|
|
|
|
# ] |
966
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
=back |
968
|
|
|
|
|
|
|
|
969
|
|
|
|
|
|
|
=over 4 |
970
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
=item all example 3 |
972
|
|
|
|
|
|
|
|
973
|
|
|
|
|
|
|
package main; |
974
|
|
|
|
|
|
|
|
975
|
|
|
|
|
|
|
use Venus::Space; |
976
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
my $space = Venus::Space->new('Venus/Space'); |
978
|
|
|
|
|
|
|
|
979
|
|
|
|
|
|
|
my $all = $space->all('locate'); |
980
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
# [ |
982
|
|
|
|
|
|
|
# [ |
983
|
|
|
|
|
|
|
# "Venus::Space", |
984
|
|
|
|
|
|
|
# "/path/to/lib/Venus/Space.pm", |
985
|
|
|
|
|
|
|
# ], |
986
|
|
|
|
|
|
|
# [ |
987
|
|
|
|
|
|
|
# "Venus::Name", |
988
|
|
|
|
|
|
|
# "/path/to/lib/Venus/Name.pm", |
989
|
|
|
|
|
|
|
# ], |
990
|
|
|
|
|
|
|
# ] |
991
|
|
|
|
|
|
|
|
992
|
|
|
|
|
|
|
=back |
993
|
|
|
|
|
|
|
|
994
|
|
|
|
|
|
|
=cut |
995
|
|
|
|
|
|
|
|
996
|
|
|
|
|
|
|
=head2 append |
997
|
|
|
|
|
|
|
|
998
|
|
|
|
|
|
|
append(Str @path) (Space) |
999
|
|
|
|
|
|
|
|
1000
|
|
|
|
|
|
|
The append method modifies the object by appending to the package namespace |
1001
|
|
|
|
|
|
|
parts. |
1002
|
|
|
|
|
|
|
|
1003
|
|
|
|
|
|
|
I> |
1004
|
|
|
|
|
|
|
|
1005
|
|
|
|
|
|
|
=over 4 |
1006
|
|
|
|
|
|
|
|
1007
|
|
|
|
|
|
|
=item append example 1 |
1008
|
|
|
|
|
|
|
|
1009
|
|
|
|
|
|
|
# given: synopsis; |
1010
|
|
|
|
|
|
|
|
1011
|
|
|
|
|
|
|
my $append = $space->append('baz'); |
1012
|
|
|
|
|
|
|
|
1013
|
|
|
|
|
|
|
# bless({ value => "Foo/Bar/Baz" }, "Venus::Space") |
1014
|
|
|
|
|
|
|
|
1015
|
|
|
|
|
|
|
=back |
1016
|
|
|
|
|
|
|
|
1017
|
|
|
|
|
|
|
=over 4 |
1018
|
|
|
|
|
|
|
|
1019
|
|
|
|
|
|
|
=item append example 2 |
1020
|
|
|
|
|
|
|
|
1021
|
|
|
|
|
|
|
# given: synopsis; |
1022
|
|
|
|
|
|
|
|
1023
|
|
|
|
|
|
|
my $append = $space->append('baz', 'bax'); |
1024
|
|
|
|
|
|
|
|
1025
|
|
|
|
|
|
|
# bless({ value => "Foo/Bar/Baz/Bax" }, "Venus::Space") |
1026
|
|
|
|
|
|
|
|
1027
|
|
|
|
|
|
|
=back |
1028
|
|
|
|
|
|
|
|
1029
|
|
|
|
|
|
|
=cut |
1030
|
|
|
|
|
|
|
|
1031
|
|
|
|
|
|
|
=head2 array |
1032
|
|
|
|
|
|
|
|
1033
|
|
|
|
|
|
|
array(Str $name, Any @data) (ArrayRef) |
1034
|
|
|
|
|
|
|
|
1035
|
|
|
|
|
|
|
The array method gets or sets the value for the given package array variable name. |
1036
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
I> |
1038
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
=over 4 |
1040
|
|
|
|
|
|
|
|
1041
|
|
|
|
|
|
|
=item array example 1 |
1042
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
# given: synopsis; |
1044
|
|
|
|
|
|
|
|
1045
|
|
|
|
|
|
|
package Foo::Bar; |
1046
|
|
|
|
|
|
|
|
1047
|
|
|
|
|
|
|
our @handler = 'start'; |
1048
|
|
|
|
|
|
|
|
1049
|
|
|
|
|
|
|
package main; |
1050
|
|
|
|
|
|
|
|
1051
|
|
|
|
|
|
|
my $array = $space->array('handler'); |
1052
|
|
|
|
|
|
|
|
1053
|
|
|
|
|
|
|
# ["start"] |
1054
|
|
|
|
|
|
|
|
1055
|
|
|
|
|
|
|
=back |
1056
|
|
|
|
|
|
|
|
1057
|
|
|
|
|
|
|
=over 4 |
1058
|
|
|
|
|
|
|
|
1059
|
|
|
|
|
|
|
=item array example 2 |
1060
|
|
|
|
|
|
|
|
1061
|
|
|
|
|
|
|
# given: synopsis; |
1062
|
|
|
|
|
|
|
|
1063
|
|
|
|
|
|
|
package Foo::Bar; |
1064
|
|
|
|
|
|
|
|
1065
|
|
|
|
|
|
|
our @handler = 'start'; |
1066
|
|
|
|
|
|
|
|
1067
|
|
|
|
|
|
|
package main; |
1068
|
|
|
|
|
|
|
|
1069
|
|
|
|
|
|
|
my $array = $space->array('handler', 'restart'); |
1070
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
# ["restart"] |
1072
|
|
|
|
|
|
|
|
1073
|
|
|
|
|
|
|
=back |
1074
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
=cut |
1076
|
|
|
|
|
|
|
|
1077
|
|
|
|
|
|
|
=head2 arrays |
1078
|
|
|
|
|
|
|
|
1079
|
|
|
|
|
|
|
arrays() (ArrayRef) |
1080
|
|
|
|
|
|
|
|
1081
|
|
|
|
|
|
|
The arrays method searches the package namespace for arrays and returns their |
1082
|
|
|
|
|
|
|
names. |
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
I> |
1085
|
|
|
|
|
|
|
|
1086
|
|
|
|
|
|
|
=over 4 |
1087
|
|
|
|
|
|
|
|
1088
|
|
|
|
|
|
|
=item arrays example 1 |
1089
|
|
|
|
|
|
|
|
1090
|
|
|
|
|
|
|
# given: synopsis; |
1091
|
|
|
|
|
|
|
|
1092
|
|
|
|
|
|
|
package Foo::Bar; |
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
our @handler = 'start'; |
1095
|
|
|
|
|
|
|
our @initial = ('next', 'prev'); |
1096
|
|
|
|
|
|
|
|
1097
|
|
|
|
|
|
|
package main; |
1098
|
|
|
|
|
|
|
|
1099
|
|
|
|
|
|
|
my $arrays = $space->arrays; |
1100
|
|
|
|
|
|
|
|
1101
|
|
|
|
|
|
|
# ["handler", "initial"] |
1102
|
|
|
|
|
|
|
|
1103
|
|
|
|
|
|
|
=back |
1104
|
|
|
|
|
|
|
|
1105
|
|
|
|
|
|
|
=cut |
1106
|
|
|
|
|
|
|
|
1107
|
|
|
|
|
|
|
=head2 attributes |
1108
|
|
|
|
|
|
|
|
1109
|
|
|
|
|
|
|
attributes() (ArrayRef) |
1110
|
|
|
|
|
|
|
|
1111
|
|
|
|
|
|
|
The attributes method searches the package namespace for attributes and returns |
1112
|
|
|
|
|
|
|
their names. This will not include attributes from roles, mixins, or superclasses. |
1113
|
|
|
|
|
|
|
|
1114
|
|
|
|
|
|
|
I> |
1115
|
|
|
|
|
|
|
|
1116
|
|
|
|
|
|
|
=over 4 |
1117
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
=item attributes example 1 |
1119
|
|
|
|
|
|
|
|
1120
|
|
|
|
|
|
|
package Foo::Attrs; |
1121
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
use Venus::Class 'attr'; |
1123
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
attr 'start'; |
1125
|
|
|
|
|
|
|
attr 'abort'; |
1126
|
|
|
|
|
|
|
|
1127
|
|
|
|
|
|
|
package main; |
1128
|
|
|
|
|
|
|
|
1129
|
|
|
|
|
|
|
use Venus::Space; |
1130
|
|
|
|
|
|
|
|
1131
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/attrs'); |
1132
|
|
|
|
|
|
|
|
1133
|
|
|
|
|
|
|
my $attributes = $space->attributes; |
1134
|
|
|
|
|
|
|
|
1135
|
|
|
|
|
|
|
# ["start", "abort"] |
1136
|
|
|
|
|
|
|
|
1137
|
|
|
|
|
|
|
=back |
1138
|
|
|
|
|
|
|
|
1139
|
|
|
|
|
|
|
=over 4 |
1140
|
|
|
|
|
|
|
|
1141
|
|
|
|
|
|
|
=item attributes example 2 |
1142
|
|
|
|
|
|
|
|
1143
|
|
|
|
|
|
|
package Foo::Base; |
1144
|
|
|
|
|
|
|
|
1145
|
|
|
|
|
|
|
use Venus::Class 'attr', 'base'; |
1146
|
|
|
|
|
|
|
|
1147
|
|
|
|
|
|
|
attr 'start'; |
1148
|
|
|
|
|
|
|
attr 'abort'; |
1149
|
|
|
|
|
|
|
|
1150
|
|
|
|
|
|
|
package Foo::Attrs; |
1151
|
|
|
|
|
|
|
|
1152
|
|
|
|
|
|
|
use Venus::Class 'attr'; |
1153
|
|
|
|
|
|
|
|
1154
|
|
|
|
|
|
|
attr 'show'; |
1155
|
|
|
|
|
|
|
attr 'hide'; |
1156
|
|
|
|
|
|
|
|
1157
|
|
|
|
|
|
|
package main; |
1158
|
|
|
|
|
|
|
|
1159
|
|
|
|
|
|
|
use Venus::Space; |
1160
|
|
|
|
|
|
|
|
1161
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/attrs'); |
1162
|
|
|
|
|
|
|
|
1163
|
|
|
|
|
|
|
my $attributes = $space->attributes; |
1164
|
|
|
|
|
|
|
|
1165
|
|
|
|
|
|
|
# ["show", "hide"] |
1166
|
|
|
|
|
|
|
|
1167
|
|
|
|
|
|
|
=back |
1168
|
|
|
|
|
|
|
|
1169
|
|
|
|
|
|
|
=cut |
1170
|
|
|
|
|
|
|
|
1171
|
|
|
|
|
|
|
=head2 authority |
1172
|
|
|
|
|
|
|
|
1173
|
|
|
|
|
|
|
authority() (Maybe[Str]) |
1174
|
|
|
|
|
|
|
|
1175
|
|
|
|
|
|
|
The authority method returns the C declared on the target package, |
1176
|
|
|
|
|
|
|
if any. |
1177
|
|
|
|
|
|
|
|
1178
|
|
|
|
|
|
|
I> |
1179
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
=over 4 |
1181
|
|
|
|
|
|
|
|
1182
|
|
|
|
|
|
|
=item authority example 1 |
1183
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
package Foo::Boo; |
1185
|
|
|
|
|
|
|
|
1186
|
|
|
|
|
|
|
package main; |
1187
|
|
|
|
|
|
|
|
1188
|
|
|
|
|
|
|
use Venus::Space; |
1189
|
|
|
|
|
|
|
|
1190
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/boo'); |
1191
|
|
|
|
|
|
|
|
1192
|
|
|
|
|
|
|
my $authority = $space->authority; |
1193
|
|
|
|
|
|
|
|
1194
|
|
|
|
|
|
|
# undef |
1195
|
|
|
|
|
|
|
|
1196
|
|
|
|
|
|
|
=back |
1197
|
|
|
|
|
|
|
|
1198
|
|
|
|
|
|
|
=over 4 |
1199
|
|
|
|
|
|
|
|
1200
|
|
|
|
|
|
|
=item authority example 2 |
1201
|
|
|
|
|
|
|
|
1202
|
|
|
|
|
|
|
package Foo::Boo; |
1203
|
|
|
|
|
|
|
|
1204
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:CPANERY'; |
1205
|
|
|
|
|
|
|
|
1206
|
|
|
|
|
|
|
package main; |
1207
|
|
|
|
|
|
|
|
1208
|
|
|
|
|
|
|
use Venus::Space; |
1209
|
|
|
|
|
|
|
|
1210
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/boo'); |
1211
|
|
|
|
|
|
|
|
1212
|
|
|
|
|
|
|
my $authority = $space->authority; |
1213
|
|
|
|
|
|
|
|
1214
|
|
|
|
|
|
|
# "cpan:CPANERY" |
1215
|
|
|
|
|
|
|
|
1216
|
|
|
|
|
|
|
=back |
1217
|
|
|
|
|
|
|
|
1218
|
|
|
|
|
|
|
=cut |
1219
|
|
|
|
|
|
|
|
1220
|
|
|
|
|
|
|
=head2 basename |
1221
|
|
|
|
|
|
|
|
1222
|
|
|
|
|
|
|
basename() (Str) |
1223
|
|
|
|
|
|
|
|
1224
|
|
|
|
|
|
|
The basename method returns the last segment of the package namespace parts. |
1225
|
|
|
|
|
|
|
|
1226
|
|
|
|
|
|
|
I> |
1227
|
|
|
|
|
|
|
|
1228
|
|
|
|
|
|
|
=over 4 |
1229
|
|
|
|
|
|
|
|
1230
|
|
|
|
|
|
|
=item basename example 1 |
1231
|
|
|
|
|
|
|
|
1232
|
|
|
|
|
|
|
# given: synopsis; |
1233
|
|
|
|
|
|
|
|
1234
|
|
|
|
|
|
|
my $basename = $space->basename; |
1235
|
|
|
|
|
|
|
|
1236
|
|
|
|
|
|
|
# "Bar" |
1237
|
|
|
|
|
|
|
|
1238
|
|
|
|
|
|
|
=back |
1239
|
|
|
|
|
|
|
|
1240
|
|
|
|
|
|
|
=cut |
1241
|
|
|
|
|
|
|
|
1242
|
|
|
|
|
|
|
=head2 blessed |
1243
|
|
|
|
|
|
|
|
1244
|
|
|
|
|
|
|
blessed(Ref $data) (Self) |
1245
|
|
|
|
|
|
|
|
1246
|
|
|
|
|
|
|
The blessed method blesses the given value into the package namespace and |
1247
|
|
|
|
|
|
|
returns an object. If no value is given, an empty hashref is used. |
1248
|
|
|
|
|
|
|
|
1249
|
|
|
|
|
|
|
I> |
1250
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
=over 4 |
1252
|
|
|
|
|
|
|
|
1253
|
|
|
|
|
|
|
=item blessed example 1 |
1254
|
|
|
|
|
|
|
|
1255
|
|
|
|
|
|
|
# given: synopsis; |
1256
|
|
|
|
|
|
|
|
1257
|
|
|
|
|
|
|
package Foo::Bar; |
1258
|
|
|
|
|
|
|
|
1259
|
|
|
|
|
|
|
sub import; |
1260
|
|
|
|
|
|
|
|
1261
|
|
|
|
|
|
|
package main; |
1262
|
|
|
|
|
|
|
|
1263
|
|
|
|
|
|
|
my $blessed = $space->blessed; |
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
# bless({}, "Foo::Bar") |
1266
|
|
|
|
|
|
|
|
1267
|
|
|
|
|
|
|
=back |
1268
|
|
|
|
|
|
|
|
1269
|
|
|
|
|
|
|
=over 4 |
1270
|
|
|
|
|
|
|
|
1271
|
|
|
|
|
|
|
=item blessed example 2 |
1272
|
|
|
|
|
|
|
|
1273
|
|
|
|
|
|
|
# given: synopsis; |
1274
|
|
|
|
|
|
|
|
1275
|
|
|
|
|
|
|
package Foo::Bar; |
1276
|
|
|
|
|
|
|
|
1277
|
|
|
|
|
|
|
sub import; |
1278
|
|
|
|
|
|
|
|
1279
|
|
|
|
|
|
|
package main; |
1280
|
|
|
|
|
|
|
|
1281
|
|
|
|
|
|
|
my $blessed = $space->blessed({okay => 1}); |
1282
|
|
|
|
|
|
|
|
1283
|
|
|
|
|
|
|
# bless({ okay => 1 }, "Foo::Bar") |
1284
|
|
|
|
|
|
|
|
1285
|
|
|
|
|
|
|
=back |
1286
|
|
|
|
|
|
|
|
1287
|
|
|
|
|
|
|
=cut |
1288
|
|
|
|
|
|
|
|
1289
|
|
|
|
|
|
|
=head2 build |
1290
|
|
|
|
|
|
|
|
1291
|
|
|
|
|
|
|
build(Any @args) (Self) |
1292
|
|
|
|
|
|
|
|
1293
|
|
|
|
|
|
|
The build method attempts to call C on the package namespace and if |
1294
|
|
|
|
|
|
|
successful returns the resulting object. |
1295
|
|
|
|
|
|
|
|
1296
|
|
|
|
|
|
|
I> |
1297
|
|
|
|
|
|
|
|
1298
|
|
|
|
|
|
|
=over 4 |
1299
|
|
|
|
|
|
|
|
1300
|
|
|
|
|
|
|
=item build example 1 |
1301
|
|
|
|
|
|
|
|
1302
|
|
|
|
|
|
|
# given: synopsis; |
1303
|
|
|
|
|
|
|
|
1304
|
|
|
|
|
|
|
package Foo::Bar::Baz; |
1305
|
|
|
|
|
|
|
|
1306
|
|
|
|
|
|
|
sub new { |
1307
|
|
|
|
|
|
|
bless {}, $_[0]; |
1308
|
|
|
|
|
|
|
} |
1309
|
|
|
|
|
|
|
|
1310
|
|
|
|
|
|
|
package main; |
1311
|
|
|
|
|
|
|
|
1312
|
|
|
|
|
|
|
my $build = $space->child('baz')->build; |
1313
|
|
|
|
|
|
|
|
1314
|
|
|
|
|
|
|
# bless({}, "Foo::Bar::Baz") |
1315
|
|
|
|
|
|
|
|
1316
|
|
|
|
|
|
|
=back |
1317
|
|
|
|
|
|
|
|
1318
|
|
|
|
|
|
|
=over 4 |
1319
|
|
|
|
|
|
|
|
1320
|
|
|
|
|
|
|
=item build example 2 |
1321
|
|
|
|
|
|
|
|
1322
|
|
|
|
|
|
|
# given: synopsis; |
1323
|
|
|
|
|
|
|
|
1324
|
|
|
|
|
|
|
package Foo::Bar::Bax; |
1325
|
|
|
|
|
|
|
|
1326
|
|
|
|
|
|
|
sub new { |
1327
|
|
|
|
|
|
|
bless $_[1], $_[0]; |
1328
|
|
|
|
|
|
|
} |
1329
|
|
|
|
|
|
|
|
1330
|
|
|
|
|
|
|
package main; |
1331
|
|
|
|
|
|
|
|
1332
|
|
|
|
|
|
|
my $build = $space->child('bax')->build({okay => 1}); |
1333
|
|
|
|
|
|
|
|
1334
|
|
|
|
|
|
|
# bless({ okay => 1 }, "Foo::Bar::Bax") |
1335
|
|
|
|
|
|
|
|
1336
|
|
|
|
|
|
|
=back |
1337
|
|
|
|
|
|
|
|
1338
|
|
|
|
|
|
|
=over 4 |
1339
|
|
|
|
|
|
|
|
1340
|
|
|
|
|
|
|
=item build example 3 |
1341
|
|
|
|
|
|
|
|
1342
|
|
|
|
|
|
|
# given: synopsis; |
1343
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
package Foo::Bar::Bay; |
1345
|
|
|
|
|
|
|
|
1346
|
|
|
|
|
|
|
sub new { |
1347
|
|
|
|
|
|
|
bless $_[1], $_[0]; |
1348
|
|
|
|
|
|
|
} |
1349
|
|
|
|
|
|
|
|
1350
|
|
|
|
|
|
|
package main; |
1351
|
|
|
|
|
|
|
|
1352
|
|
|
|
|
|
|
my $build = $space->child('bay')->build([okay => 1]); |
1353
|
|
|
|
|
|
|
|
1354
|
|
|
|
|
|
|
# bless(["okay", 1], "Foo::Bar::Bay") |
1355
|
|
|
|
|
|
|
|
1356
|
|
|
|
|
|
|
=back |
1357
|
|
|
|
|
|
|
|
1358
|
|
|
|
|
|
|
=cut |
1359
|
|
|
|
|
|
|
|
1360
|
|
|
|
|
|
|
=head2 call |
1361
|
|
|
|
|
|
|
|
1362
|
|
|
|
|
|
|
call(Any @args) (Any) |
1363
|
|
|
|
|
|
|
|
1364
|
|
|
|
|
|
|
The call method attempts to call the given subroutine on the package namespace |
1365
|
|
|
|
|
|
|
and if successful returns the resulting value. |
1366
|
|
|
|
|
|
|
|
1367
|
|
|
|
|
|
|
I> |
1368
|
|
|
|
|
|
|
|
1369
|
|
|
|
|
|
|
=over 4 |
1370
|
|
|
|
|
|
|
|
1371
|
|
|
|
|
|
|
=item call example 1 |
1372
|
|
|
|
|
|
|
|
1373
|
|
|
|
|
|
|
package Foo; |
1374
|
|
|
|
|
|
|
|
1375
|
|
|
|
|
|
|
sub import; |
1376
|
|
|
|
|
|
|
|
1377
|
|
|
|
|
|
|
sub start { |
1378
|
|
|
|
|
|
|
'started' |
1379
|
|
|
|
|
|
|
} |
1380
|
|
|
|
|
|
|
|
1381
|
|
|
|
|
|
|
package main; |
1382
|
|
|
|
|
|
|
|
1383
|
|
|
|
|
|
|
use Venus::Space; |
1384
|
|
|
|
|
|
|
|
1385
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo'); |
1386
|
|
|
|
|
|
|
|
1387
|
|
|
|
|
|
|
my $result = $space->call('start'); |
1388
|
|
|
|
|
|
|
|
1389
|
|
|
|
|
|
|
# "started" |
1390
|
|
|
|
|
|
|
|
1391
|
|
|
|
|
|
|
=back |
1392
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
=over 4 |
1394
|
|
|
|
|
|
|
|
1395
|
|
|
|
|
|
|
=item call example 2 |
1396
|
|
|
|
|
|
|
|
1397
|
|
|
|
|
|
|
package Zoo; |
1398
|
|
|
|
|
|
|
|
1399
|
|
|
|
|
|
|
sub import; |
1400
|
|
|
|
|
|
|
|
1401
|
|
|
|
|
|
|
sub AUTOLOAD { |
1402
|
|
|
|
|
|
|
bless {}; |
1403
|
|
|
|
|
|
|
} |
1404
|
|
|
|
|
|
|
|
1405
|
|
|
|
|
|
|
sub DESTROY { |
1406
|
|
|
|
|
|
|
; # noop |
1407
|
|
|
|
|
|
|
} |
1408
|
|
|
|
|
|
|
|
1409
|
|
|
|
|
|
|
package main; |
1410
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
use Venus::Space; |
1412
|
|
|
|
|
|
|
|
1413
|
|
|
|
|
|
|
my $space = Venus::Space->new('zoo'); |
1414
|
|
|
|
|
|
|
|
1415
|
|
|
|
|
|
|
my $result = $space->call('start'); |
1416
|
|
|
|
|
|
|
|
1417
|
|
|
|
|
|
|
# bless({}, "Zoo") |
1418
|
|
|
|
|
|
|
|
1419
|
|
|
|
|
|
|
=back |
1420
|
|
|
|
|
|
|
|
1421
|
|
|
|
|
|
|
=over 4 |
1422
|
|
|
|
|
|
|
|
1423
|
|
|
|
|
|
|
=item call example 3 |
1424
|
|
|
|
|
|
|
|
1425
|
|
|
|
|
|
|
package main; |
1426
|
|
|
|
|
|
|
|
1427
|
|
|
|
|
|
|
use Venus::Space; |
1428
|
|
|
|
|
|
|
|
1429
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo'); |
1430
|
|
|
|
|
|
|
|
1431
|
|
|
|
|
|
|
my $result = $space->call('missing'); |
1432
|
|
|
|
|
|
|
|
1433
|
|
|
|
|
|
|
# Exception! (isa Venus::Space::Error) (see error_on_call_missing) |
1434
|
|
|
|
|
|
|
|
1435
|
|
|
|
|
|
|
=back |
1436
|
|
|
|
|
|
|
|
1437
|
|
|
|
|
|
|
=cut |
1438
|
|
|
|
|
|
|
|
1439
|
|
|
|
|
|
|
=head2 chain |
1440
|
|
|
|
|
|
|
|
1441
|
|
|
|
|
|
|
chain(Str | Tuple[Str, Any] @steps) (Any) |
1442
|
|
|
|
|
|
|
|
1443
|
|
|
|
|
|
|
The chain method chains one or more method calls and returns the result. |
1444
|
|
|
|
|
|
|
|
1445
|
|
|
|
|
|
|
I> |
1446
|
|
|
|
|
|
|
|
1447
|
|
|
|
|
|
|
=over 4 |
1448
|
|
|
|
|
|
|
|
1449
|
|
|
|
|
|
|
=item chain example 1 |
1450
|
|
|
|
|
|
|
|
1451
|
|
|
|
|
|
|
package Chu::Chu0; |
1452
|
|
|
|
|
|
|
|
1453
|
|
|
|
|
|
|
sub import; |
1454
|
|
|
|
|
|
|
|
1455
|
|
|
|
|
|
|
package main; |
1456
|
|
|
|
|
|
|
|
1457
|
|
|
|
|
|
|
use Venus::Space; |
1458
|
|
|
|
|
|
|
|
1459
|
|
|
|
|
|
|
my $space = Venus::Space->new('Chu::Chu0'); |
1460
|
|
|
|
|
|
|
|
1461
|
|
|
|
|
|
|
my $result = $space->chain('blessed'); |
1462
|
|
|
|
|
|
|
|
1463
|
|
|
|
|
|
|
# bless({}, "Chu::Chu0") |
1464
|
|
|
|
|
|
|
|
1465
|
|
|
|
|
|
|
=back |
1466
|
|
|
|
|
|
|
|
1467
|
|
|
|
|
|
|
=over 4 |
1468
|
|
|
|
|
|
|
|
1469
|
|
|
|
|
|
|
=item chain example 2 |
1470
|
|
|
|
|
|
|
|
1471
|
|
|
|
|
|
|
package Chu::Chu1; |
1472
|
|
|
|
|
|
|
|
1473
|
|
|
|
|
|
|
sub new { |
1474
|
|
|
|
|
|
|
bless pop; |
1475
|
|
|
|
|
|
|
} |
1476
|
|
|
|
|
|
|
|
1477
|
|
|
|
|
|
|
sub frame { |
1478
|
|
|
|
|
|
|
[@_] |
1479
|
|
|
|
|
|
|
} |
1480
|
|
|
|
|
|
|
|
1481
|
|
|
|
|
|
|
package main; |
1482
|
|
|
|
|
|
|
|
1483
|
|
|
|
|
|
|
use Venus::Space; |
1484
|
|
|
|
|
|
|
|
1485
|
|
|
|
|
|
|
my $space = Venus::Space->new('Chu::Chu1'); |
1486
|
|
|
|
|
|
|
|
1487
|
|
|
|
|
|
|
my $result = $space->chain(['blessed', {1..4}], 'frame'); |
1488
|
|
|
|
|
|
|
|
1489
|
|
|
|
|
|
|
# [bless({ 1 => 2, 3 => 4 }, "Chu::Chu1")] |
1490
|
|
|
|
|
|
|
|
1491
|
|
|
|
|
|
|
=back |
1492
|
|
|
|
|
|
|
|
1493
|
|
|
|
|
|
|
=over 4 |
1494
|
|
|
|
|
|
|
|
1495
|
|
|
|
|
|
|
=item chain example 3 |
1496
|
|
|
|
|
|
|
|
1497
|
|
|
|
|
|
|
package Chu::Chu2; |
1498
|
|
|
|
|
|
|
|
1499
|
|
|
|
|
|
|
sub new { |
1500
|
|
|
|
|
|
|
bless pop; |
1501
|
|
|
|
|
|
|
} |
1502
|
|
|
|
|
|
|
|
1503
|
|
|
|
|
|
|
sub frame { |
1504
|
|
|
|
|
|
|
[@_] |
1505
|
|
|
|
|
|
|
} |
1506
|
|
|
|
|
|
|
|
1507
|
|
|
|
|
|
|
package main; |
1508
|
|
|
|
|
|
|
|
1509
|
|
|
|
|
|
|
use Venus::Space; |
1510
|
|
|
|
|
|
|
|
1511
|
|
|
|
|
|
|
my $space = Venus::Space->new('Chu::Chu2'); |
1512
|
|
|
|
|
|
|
|
1513
|
|
|
|
|
|
|
my $chain = $space->chain('blessed', ['frame', {1..4}]); |
1514
|
|
|
|
|
|
|
|
1515
|
|
|
|
|
|
|
# [bless({}, "Chu::Chu2"), { 1 => 2, 3 => 4 }] |
1516
|
|
|
|
|
|
|
|
1517
|
|
|
|
|
|
|
=back |
1518
|
|
|
|
|
|
|
|
1519
|
|
|
|
|
|
|
=cut |
1520
|
|
|
|
|
|
|
|
1521
|
|
|
|
|
|
|
=head2 child |
1522
|
|
|
|
|
|
|
|
1523
|
|
|
|
|
|
|
child(Str @path) (Space) |
1524
|
|
|
|
|
|
|
|
1525
|
|
|
|
|
|
|
The child method returns a new L object for the child |
1526
|
|
|
|
|
|
|
package namespace. |
1527
|
|
|
|
|
|
|
|
1528
|
|
|
|
|
|
|
I> |
1529
|
|
|
|
|
|
|
|
1530
|
|
|
|
|
|
|
=over 4 |
1531
|
|
|
|
|
|
|
|
1532
|
|
|
|
|
|
|
=item child example 1 |
1533
|
|
|
|
|
|
|
|
1534
|
|
|
|
|
|
|
# given: synopsis; |
1535
|
|
|
|
|
|
|
|
1536
|
|
|
|
|
|
|
my $child = $space->child('baz'); |
1537
|
|
|
|
|
|
|
|
1538
|
|
|
|
|
|
|
# bless({ value => "Foo/Bar/Baz" }, "Venus::Space") |
1539
|
|
|
|
|
|
|
|
1540
|
|
|
|
|
|
|
=back |
1541
|
|
|
|
|
|
|
|
1542
|
|
|
|
|
|
|
=cut |
1543
|
|
|
|
|
|
|
|
1544
|
|
|
|
|
|
|
=head2 children |
1545
|
|
|
|
|
|
|
|
1546
|
|
|
|
|
|
|
children() (ArrayRef[Object]) |
1547
|
|
|
|
|
|
|
|
1548
|
|
|
|
|
|
|
The children method searches C<%INC> and C<@INC> and retuns a list of |
1549
|
|
|
|
|
|
|
L objects for each child namespace found (one level deep). |
1550
|
|
|
|
|
|
|
|
1551
|
|
|
|
|
|
|
I> |
1552
|
|
|
|
|
|
|
|
1553
|
|
|
|
|
|
|
=over 4 |
1554
|
|
|
|
|
|
|
|
1555
|
|
|
|
|
|
|
=item children example 1 |
1556
|
|
|
|
|
|
|
|
1557
|
|
|
|
|
|
|
package main; |
1558
|
|
|
|
|
|
|
|
1559
|
|
|
|
|
|
|
use Venus::Space; |
1560
|
|
|
|
|
|
|
|
1561
|
|
|
|
|
|
|
my $space = Venus::Space->new('c_p_a_n'); |
1562
|
|
|
|
|
|
|
|
1563
|
|
|
|
|
|
|
my $children = $space->children; |
1564
|
|
|
|
|
|
|
|
1565
|
|
|
|
|
|
|
# [ |
1566
|
|
|
|
|
|
|
# bless({ value => "CPAN/Author" }, "Venus::Space"), |
1567
|
|
|
|
|
|
|
# bless({ value => "CPAN/Bundle" }, "Venus::Space"), |
1568
|
|
|
|
|
|
|
# bless({ value => "CPAN/CacheMgr" }, "Venus::Space"), |
1569
|
|
|
|
|
|
|
# ... |
1570
|
|
|
|
|
|
|
# ] |
1571
|
|
|
|
|
|
|
|
1572
|
|
|
|
|
|
|
=back |
1573
|
|
|
|
|
|
|
|
1574
|
|
|
|
|
|
|
=cut |
1575
|
|
|
|
|
|
|
|
1576
|
|
|
|
|
|
|
=head2 cop |
1577
|
|
|
|
|
|
|
|
1578
|
|
|
|
|
|
|
cop(Str $method, Any @args) (CodeRef) |
1579
|
|
|
|
|
|
|
|
1580
|
|
|
|
|
|
|
The cop method attempts to curry the given subroutine on the package namespace |
1581
|
|
|
|
|
|
|
and if successful returns a closure. This method supports dispatching, i.e. |
1582
|
|
|
|
|
|
|
providing a method name and arguments whose return value will be acted on by |
1583
|
|
|
|
|
|
|
this method. |
1584
|
|
|
|
|
|
|
|
1585
|
|
|
|
|
|
|
I> |
1586
|
|
|
|
|
|
|
|
1587
|
|
|
|
|
|
|
=over 4 |
1588
|
|
|
|
|
|
|
|
1589
|
|
|
|
|
|
|
=item cop example 1 |
1590
|
|
|
|
|
|
|
|
1591
|
|
|
|
|
|
|
package Foo::Bar; |
1592
|
|
|
|
|
|
|
|
1593
|
|
|
|
|
|
|
sub import; |
1594
|
|
|
|
|
|
|
|
1595
|
|
|
|
|
|
|
sub handler { |
1596
|
|
|
|
|
|
|
[@_] |
1597
|
|
|
|
|
|
|
} |
1598
|
|
|
|
|
|
|
|
1599
|
|
|
|
|
|
|
package main; |
1600
|
|
|
|
|
|
|
|
1601
|
|
|
|
|
|
|
use Venus::Space; |
1602
|
|
|
|
|
|
|
|
1603
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/bar'); |
1604
|
|
|
|
|
|
|
|
1605
|
|
|
|
|
|
|
my $code = $space->cop('handler', $space->blessed); |
1606
|
|
|
|
|
|
|
|
1607
|
|
|
|
|
|
|
# sub { Foo::Bar::handler(..., @_) } |
1608
|
|
|
|
|
|
|
|
1609
|
|
|
|
|
|
|
=back |
1610
|
|
|
|
|
|
|
|
1611
|
|
|
|
|
|
|
=over 4 |
1612
|
|
|
|
|
|
|
|
1613
|
|
|
|
|
|
|
=item cop example 2 |
1614
|
|
|
|
|
|
|
|
1615
|
|
|
|
|
|
|
package main; |
1616
|
|
|
|
|
|
|
|
1617
|
|
|
|
|
|
|
use Venus::Space; |
1618
|
|
|
|
|
|
|
|
1619
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/bar'); |
1620
|
|
|
|
|
|
|
|
1621
|
|
|
|
|
|
|
my $code = $space->cop('missing', $space->blessed); |
1622
|
|
|
|
|
|
|
|
1623
|
|
|
|
|
|
|
# Exception! (isa Venus::Space::Error) (see error_on_cop_missing) |
1624
|
|
|
|
|
|
|
|
1625
|
|
|
|
|
|
|
=back |
1626
|
|
|
|
|
|
|
|
1627
|
|
|
|
|
|
|
=cut |
1628
|
|
|
|
|
|
|
|
1629
|
|
|
|
|
|
|
=head2 data |
1630
|
|
|
|
|
|
|
|
1631
|
|
|
|
|
|
|
data() (Str) |
1632
|
|
|
|
|
|
|
|
1633
|
|
|
|
|
|
|
The data method attempts to read and return any content stored in the C |
1634
|
|
|
|
|
|
|
section of the package namespace. |
1635
|
|
|
|
|
|
|
|
1636
|
|
|
|
|
|
|
I> |
1637
|
|
|
|
|
|
|
|
1638
|
|
|
|
|
|
|
=over 4 |
1639
|
|
|
|
|
|
|
|
1640
|
|
|
|
|
|
|
=item data example 1 |
1641
|
|
|
|
|
|
|
|
1642
|
|
|
|
|
|
|
# given: synopsis; |
1643
|
|
|
|
|
|
|
|
1644
|
|
|
|
|
|
|
my $data = $space->data; |
1645
|
|
|
|
|
|
|
|
1646
|
|
|
|
|
|
|
# "" |
1647
|
|
|
|
|
|
|
|
1648
|
|
|
|
|
|
|
=back |
1649
|
|
|
|
|
|
|
|
1650
|
|
|
|
|
|
|
=cut |
1651
|
|
|
|
|
|
|
|
1652
|
|
|
|
|
|
|
=head2 eval |
1653
|
|
|
|
|
|
|
|
1654
|
|
|
|
|
|
|
eval(Str @data) (Any) |
1655
|
|
|
|
|
|
|
|
1656
|
|
|
|
|
|
|
The eval method takes a list of strings and evaluates them under the namespace |
1657
|
|
|
|
|
|
|
represented by the instance. |
1658
|
|
|
|
|
|
|
|
1659
|
|
|
|
|
|
|
I> |
1660
|
|
|
|
|
|
|
|
1661
|
|
|
|
|
|
|
=over 4 |
1662
|
|
|
|
|
|
|
|
1663
|
|
|
|
|
|
|
=item eval example 1 |
1664
|
|
|
|
|
|
|
|
1665
|
|
|
|
|
|
|
package main; |
1666
|
|
|
|
|
|
|
|
1667
|
|
|
|
|
|
|
use Venus::Space; |
1668
|
|
|
|
|
|
|
|
1669
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo'); |
1670
|
|
|
|
|
|
|
|
1671
|
|
|
|
|
|
|
my $eval = $space->eval('our $VERSION = 0.01'); |
1672
|
|
|
|
|
|
|
|
1673
|
|
|
|
|
|
|
# 0.01 |
1674
|
|
|
|
|
|
|
|
1675
|
|
|
|
|
|
|
=back |
1676
|
|
|
|
|
|
|
|
1677
|
|
|
|
|
|
|
=over 4 |
1678
|
|
|
|
|
|
|
|
1679
|
|
|
|
|
|
|
=item eval example 2 |
1680
|
|
|
|
|
|
|
|
1681
|
|
|
|
|
|
|
package main; |
1682
|
|
|
|
|
|
|
|
1683
|
|
|
|
|
|
|
use Venus::Space; |
1684
|
|
|
|
|
|
|
|
1685
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo'); |
1686
|
|
|
|
|
|
|
|
1687
|
|
|
|
|
|
|
my $eval = $space->eval('die'); |
1688
|
|
|
|
|
|
|
|
1689
|
|
|
|
|
|
|
# Exception! (isa Venus::Space::Error) (see error_on_eval) |
1690
|
|
|
|
|
|
|
|
1691
|
|
|
|
|
|
|
=back |
1692
|
|
|
|
|
|
|
|
1693
|
|
|
|
|
|
|
=cut |
1694
|
|
|
|
|
|
|
|
1695
|
|
|
|
|
|
|
=head2 explain |
1696
|
|
|
|
|
|
|
|
1697
|
|
|
|
|
|
|
explain() (Str) |
1698
|
|
|
|
|
|
|
|
1699
|
|
|
|
|
|
|
The explain method returns the package name and is used in stringification |
1700
|
|
|
|
|
|
|
operations. |
1701
|
|
|
|
|
|
|
|
1702
|
|
|
|
|
|
|
I> |
1703
|
|
|
|
|
|
|
|
1704
|
|
|
|
|
|
|
=over 4 |
1705
|
|
|
|
|
|
|
|
1706
|
|
|
|
|
|
|
=item explain example 1 |
1707
|
|
|
|
|
|
|
|
1708
|
|
|
|
|
|
|
# given: synopsis; |
1709
|
|
|
|
|
|
|
|
1710
|
|
|
|
|
|
|
my $explain = $space->explain; |
1711
|
|
|
|
|
|
|
|
1712
|
|
|
|
|
|
|
# "Foo::Bar" |
1713
|
|
|
|
|
|
|
|
1714
|
|
|
|
|
|
|
=back |
1715
|
|
|
|
|
|
|
|
1716
|
|
|
|
|
|
|
=cut |
1717
|
|
|
|
|
|
|
|
1718
|
|
|
|
|
|
|
=head2 hash |
1719
|
|
|
|
|
|
|
|
1720
|
|
|
|
|
|
|
hash(Str $name, Any @data) (HashRef) |
1721
|
|
|
|
|
|
|
|
1722
|
|
|
|
|
|
|
The hash method gets or sets the value for the given package hash variable name. |
1723
|
|
|
|
|
|
|
|
1724
|
|
|
|
|
|
|
I> |
1725
|
|
|
|
|
|
|
|
1726
|
|
|
|
|
|
|
=over 4 |
1727
|
|
|
|
|
|
|
|
1728
|
|
|
|
|
|
|
=item hash example 1 |
1729
|
|
|
|
|
|
|
|
1730
|
|
|
|
|
|
|
# given: synopsis; |
1731
|
|
|
|
|
|
|
|
1732
|
|
|
|
|
|
|
package Foo::Bar; |
1733
|
|
|
|
|
|
|
|
1734
|
|
|
|
|
|
|
our %settings = ( |
1735
|
|
|
|
|
|
|
active => 1 |
1736
|
|
|
|
|
|
|
); |
1737
|
|
|
|
|
|
|
|
1738
|
|
|
|
|
|
|
package main; |
1739
|
|
|
|
|
|
|
|
1740
|
|
|
|
|
|
|
my $hash = $space->hash('settings'); |
1741
|
|
|
|
|
|
|
|
1742
|
|
|
|
|
|
|
# { active => 1 } |
1743
|
|
|
|
|
|
|
|
1744
|
|
|
|
|
|
|
=back |
1745
|
|
|
|
|
|
|
|
1746
|
|
|
|
|
|
|
=over 4 |
1747
|
|
|
|
|
|
|
|
1748
|
|
|
|
|
|
|
=item hash example 2 |
1749
|
|
|
|
|
|
|
|
1750
|
|
|
|
|
|
|
# given: synopsis; |
1751
|
|
|
|
|
|
|
|
1752
|
|
|
|
|
|
|
package Foo::Bar; |
1753
|
|
|
|
|
|
|
|
1754
|
|
|
|
|
|
|
our %settings = ( |
1755
|
|
|
|
|
|
|
active => 1 |
1756
|
|
|
|
|
|
|
); |
1757
|
|
|
|
|
|
|
|
1758
|
|
|
|
|
|
|
package main; |
1759
|
|
|
|
|
|
|
|
1760
|
|
|
|
|
|
|
my $hash = $space->hash('settings', inactive => 1); |
1761
|
|
|
|
|
|
|
|
1762
|
|
|
|
|
|
|
# { inactive => 1 } |
1763
|
|
|
|
|
|
|
|
1764
|
|
|
|
|
|
|
=back |
1765
|
|
|
|
|
|
|
|
1766
|
|
|
|
|
|
|
=cut |
1767
|
|
|
|
|
|
|
|
1768
|
|
|
|
|
|
|
=head2 hashes |
1769
|
|
|
|
|
|
|
|
1770
|
|
|
|
|
|
|
hashes() (ArrayRef) |
1771
|
|
|
|
|
|
|
|
1772
|
|
|
|
|
|
|
The hashes method searches the package namespace for hashes and returns their |
1773
|
|
|
|
|
|
|
names. |
1774
|
|
|
|
|
|
|
|
1775
|
|
|
|
|
|
|
I> |
1776
|
|
|
|
|
|
|
|
1777
|
|
|
|
|
|
|
=over 4 |
1778
|
|
|
|
|
|
|
|
1779
|
|
|
|
|
|
|
=item hashes example 1 |
1780
|
|
|
|
|
|
|
|
1781
|
|
|
|
|
|
|
# given: synopsis; |
1782
|
|
|
|
|
|
|
|
1783
|
|
|
|
|
|
|
package Foo::Bar; |
1784
|
|
|
|
|
|
|
|
1785
|
|
|
|
|
|
|
our %defaults = ( |
1786
|
|
|
|
|
|
|
active => 0 |
1787
|
|
|
|
|
|
|
); |
1788
|
|
|
|
|
|
|
|
1789
|
|
|
|
|
|
|
our %settings = ( |
1790
|
|
|
|
|
|
|
active => 1 |
1791
|
|
|
|
|
|
|
); |
1792
|
|
|
|
|
|
|
|
1793
|
|
|
|
|
|
|
package main; |
1794
|
|
|
|
|
|
|
|
1795
|
|
|
|
|
|
|
my $hashes = $space->hashes; |
1796
|
|
|
|
|
|
|
|
1797
|
|
|
|
|
|
|
# ["defaults", "settings"] |
1798
|
|
|
|
|
|
|
|
1799
|
|
|
|
|
|
|
=back |
1800
|
|
|
|
|
|
|
|
1801
|
|
|
|
|
|
|
=cut |
1802
|
|
|
|
|
|
|
|
1803
|
|
|
|
|
|
|
=head2 id |
1804
|
|
|
|
|
|
|
|
1805
|
|
|
|
|
|
|
id() (Str) |
1806
|
|
|
|
|
|
|
|
1807
|
|
|
|
|
|
|
The id method returns the fully-qualified package name as a label. |
1808
|
|
|
|
|
|
|
|
1809
|
|
|
|
|
|
|
I> |
1810
|
|
|
|
|
|
|
|
1811
|
|
|
|
|
|
|
=over 4 |
1812
|
|
|
|
|
|
|
|
1813
|
|
|
|
|
|
|
=item id example 1 |
1814
|
|
|
|
|
|
|
|
1815
|
|
|
|
|
|
|
# given: synopsis; |
1816
|
|
|
|
|
|
|
|
1817
|
|
|
|
|
|
|
my $id = $space->id; |
1818
|
|
|
|
|
|
|
|
1819
|
|
|
|
|
|
|
# "Foo_Bar" |
1820
|
|
|
|
|
|
|
|
1821
|
|
|
|
|
|
|
=back |
1822
|
|
|
|
|
|
|
|
1823
|
|
|
|
|
|
|
=cut |
1824
|
|
|
|
|
|
|
|
1825
|
|
|
|
|
|
|
=head2 included |
1826
|
|
|
|
|
|
|
|
1827
|
|
|
|
|
|
|
included() (Str | Undef) |
1828
|
|
|
|
|
|
|
|
1829
|
|
|
|
|
|
|
The included method returns the path of the namespace if it exists in C<%INC>. |
1830
|
|
|
|
|
|
|
|
1831
|
|
|
|
|
|
|
I> |
1832
|
|
|
|
|
|
|
|
1833
|
|
|
|
|
|
|
=over 4 |
1834
|
|
|
|
|
|
|
|
1835
|
|
|
|
|
|
|
=item included example 1 |
1836
|
|
|
|
|
|
|
|
1837
|
|
|
|
|
|
|
package main; |
1838
|
|
|
|
|
|
|
|
1839
|
|
|
|
|
|
|
use Venus::Space; |
1840
|
|
|
|
|
|
|
|
1841
|
|
|
|
|
|
|
my $space = Venus::Space->new('Venus/Space'); |
1842
|
|
|
|
|
|
|
|
1843
|
|
|
|
|
|
|
my $included = $space->included; |
1844
|
|
|
|
|
|
|
|
1845
|
|
|
|
|
|
|
# "/path/to/lib/Venus/Space.pm" |
1846
|
|
|
|
|
|
|
|
1847
|
|
|
|
|
|
|
=back |
1848
|
|
|
|
|
|
|
|
1849
|
|
|
|
|
|
|
=cut |
1850
|
|
|
|
|
|
|
|
1851
|
|
|
|
|
|
|
=head2 inherits |
1852
|
|
|
|
|
|
|
|
1853
|
|
|
|
|
|
|
inherits() (ArrayRef) |
1854
|
|
|
|
|
|
|
|
1855
|
|
|
|
|
|
|
The inherits method returns the list of superclasses the target package is |
1856
|
|
|
|
|
|
|
derived from. |
1857
|
|
|
|
|
|
|
|
1858
|
|
|
|
|
|
|
I> |
1859
|
|
|
|
|
|
|
|
1860
|
|
|
|
|
|
|
=over 4 |
1861
|
|
|
|
|
|
|
|
1862
|
|
|
|
|
|
|
=item inherits example 1 |
1863
|
|
|
|
|
|
|
|
1864
|
|
|
|
|
|
|
package Bar; |
1865
|
|
|
|
|
|
|
|
1866
|
|
|
|
|
|
|
package main; |
1867
|
|
|
|
|
|
|
|
1868
|
|
|
|
|
|
|
use Venus::Space; |
1869
|
|
|
|
|
|
|
|
1870
|
|
|
|
|
|
|
my $space = Venus::Space->new('bar'); |
1871
|
|
|
|
|
|
|
|
1872
|
|
|
|
|
|
|
my $inherits = $space->inherits; |
1873
|
|
|
|
|
|
|
|
1874
|
|
|
|
|
|
|
# [] |
1875
|
|
|
|
|
|
|
|
1876
|
|
|
|
|
|
|
=back |
1877
|
|
|
|
|
|
|
|
1878
|
|
|
|
|
|
|
=over 4 |
1879
|
|
|
|
|
|
|
|
1880
|
|
|
|
|
|
|
=item inherits example 2 |
1881
|
|
|
|
|
|
|
|
1882
|
|
|
|
|
|
|
package Foo; |
1883
|
|
|
|
|
|
|
|
1884
|
|
|
|
|
|
|
sub import; |
1885
|
|
|
|
|
|
|
|
1886
|
|
|
|
|
|
|
package Bar; |
1887
|
|
|
|
|
|
|
|
1888
|
|
|
|
|
|
|
use base 'Foo'; |
1889
|
|
|
|
|
|
|
|
1890
|
|
|
|
|
|
|
package main; |
1891
|
|
|
|
|
|
|
|
1892
|
|
|
|
|
|
|
use Venus::Space; |
1893
|
|
|
|
|
|
|
|
1894
|
|
|
|
|
|
|
my $space = Venus::Space->new('bar'); |
1895
|
|
|
|
|
|
|
|
1896
|
|
|
|
|
|
|
my $inherits = $space->inherits; |
1897
|
|
|
|
|
|
|
|
1898
|
|
|
|
|
|
|
# ["Foo"] |
1899
|
|
|
|
|
|
|
|
1900
|
|
|
|
|
|
|
=back |
1901
|
|
|
|
|
|
|
|
1902
|
|
|
|
|
|
|
=cut |
1903
|
|
|
|
|
|
|
|
1904
|
|
|
|
|
|
|
=head2 init |
1905
|
|
|
|
|
|
|
|
1906
|
|
|
|
|
|
|
init() (Str) |
1907
|
|
|
|
|
|
|
|
1908
|
|
|
|
|
|
|
The init method ensures that the package namespace is loaded and, whether |
1909
|
|
|
|
|
|
|
created in-memory or on-disk, is flagged as being loaded and loadable. |
1910
|
|
|
|
|
|
|
|
1911
|
|
|
|
|
|
|
I> |
1912
|
|
|
|
|
|
|
|
1913
|
|
|
|
|
|
|
=over 4 |
1914
|
|
|
|
|
|
|
|
1915
|
|
|
|
|
|
|
=item init example 1 |
1916
|
|
|
|
|
|
|
|
1917
|
|
|
|
|
|
|
package main; |
1918
|
|
|
|
|
|
|
|
1919
|
|
|
|
|
|
|
use Venus::Space; |
1920
|
|
|
|
|
|
|
|
1921
|
|
|
|
|
|
|
my $space = Venus::Space->new('kit'); |
1922
|
|
|
|
|
|
|
|
1923
|
|
|
|
|
|
|
my $init = $space->init; |
1924
|
|
|
|
|
|
|
|
1925
|
|
|
|
|
|
|
# "Kit" |
1926
|
|
|
|
|
|
|
|
1927
|
|
|
|
|
|
|
=back |
1928
|
|
|
|
|
|
|
|
1929
|
|
|
|
|
|
|
=cut |
1930
|
|
|
|
|
|
|
|
1931
|
|
|
|
|
|
|
=head2 inject |
1932
|
|
|
|
|
|
|
|
1933
|
|
|
|
|
|
|
inject(Str $name, Maybe[CodeRef] $coderef) (Any) |
1934
|
|
|
|
|
|
|
|
1935
|
|
|
|
|
|
|
The inject method monkey-patches the package namespace, installing a named |
1936
|
|
|
|
|
|
|
subroutine into the package which can then be called normally, returning the |
1937
|
|
|
|
|
|
|
fully-qualified subroutine name. |
1938
|
|
|
|
|
|
|
|
1939
|
|
|
|
|
|
|
I> |
1940
|
|
|
|
|
|
|
|
1941
|
|
|
|
|
|
|
=over 4 |
1942
|
|
|
|
|
|
|
|
1943
|
|
|
|
|
|
|
=item inject example 1 |
1944
|
|
|
|
|
|
|
|
1945
|
|
|
|
|
|
|
package main; |
1946
|
|
|
|
|
|
|
|
1947
|
|
|
|
|
|
|
use Venus::Space; |
1948
|
|
|
|
|
|
|
|
1949
|
|
|
|
|
|
|
my $space = Venus::Space->new('kit'); |
1950
|
|
|
|
|
|
|
|
1951
|
|
|
|
|
|
|
my $inject = $space->inject('build', sub { 'finished' }); |
1952
|
|
|
|
|
|
|
|
1953
|
|
|
|
|
|
|
# *Kit::build |
1954
|
|
|
|
|
|
|
|
1955
|
|
|
|
|
|
|
=back |
1956
|
|
|
|
|
|
|
|
1957
|
|
|
|
|
|
|
=cut |
1958
|
|
|
|
|
|
|
|
1959
|
|
|
|
|
|
|
=head2 integrates |
1960
|
|
|
|
|
|
|
|
1961
|
|
|
|
|
|
|
integrates() (ArrayRef) |
1962
|
|
|
|
|
|
|
|
1963
|
|
|
|
|
|
|
The integrates method returns the list of roles integrated into the target |
1964
|
|
|
|
|
|
|
package. |
1965
|
|
|
|
|
|
|
|
1966
|
|
|
|
|
|
|
I> |
1967
|
|
|
|
|
|
|
|
1968
|
|
|
|
|
|
|
=over 4 |
1969
|
|
|
|
|
|
|
|
1970
|
|
|
|
|
|
|
=item integrates example 1 |
1971
|
|
|
|
|
|
|
|
1972
|
|
|
|
|
|
|
# given: synopsis |
1973
|
|
|
|
|
|
|
|
1974
|
|
|
|
|
|
|
package main; |
1975
|
|
|
|
|
|
|
|
1976
|
|
|
|
|
|
|
my $integrates = $space->integrates; |
1977
|
|
|
|
|
|
|
|
1978
|
|
|
|
|
|
|
# [] |
1979
|
|
|
|
|
|
|
|
1980
|
|
|
|
|
|
|
=back |
1981
|
|
|
|
|
|
|
|
1982
|
|
|
|
|
|
|
=over 4 |
1983
|
|
|
|
|
|
|
|
1984
|
|
|
|
|
|
|
=item integrates example 2 |
1985
|
|
|
|
|
|
|
|
1986
|
|
|
|
|
|
|
package main; |
1987
|
|
|
|
|
|
|
|
1988
|
|
|
|
|
|
|
use Venus::Space; |
1989
|
|
|
|
|
|
|
|
1990
|
|
|
|
|
|
|
my $space = Venus::Space->new('Venus::Test'); |
1991
|
|
|
|
|
|
|
|
1992
|
|
|
|
|
|
|
my $integrates = $space->integrates; |
1993
|
|
|
|
|
|
|
|
1994
|
|
|
|
|
|
|
# [...] |
1995
|
|
|
|
|
|
|
|
1996
|
|
|
|
|
|
|
=back |
1997
|
|
|
|
|
|
|
|
1998
|
|
|
|
|
|
|
=cut |
1999
|
|
|
|
|
|
|
|
2000
|
|
|
|
|
|
|
=head2 lfile |
2001
|
|
|
|
|
|
|
|
2002
|
|
|
|
|
|
|
lfile() (Str) |
2003
|
|
|
|
|
|
|
|
2004
|
|
|
|
|
|
|
The lfile method returns a C<.pm> file path for the underlying package. |
2005
|
|
|
|
|
|
|
|
2006
|
|
|
|
|
|
|
I> |
2007
|
|
|
|
|
|
|
|
2008
|
|
|
|
|
|
|
=over 4 |
2009
|
|
|
|
|
|
|
|
2010
|
|
|
|
|
|
|
=item lfile example 1 |
2011
|
|
|
|
|
|
|
|
2012
|
|
|
|
|
|
|
# given: synopsis |
2013
|
|
|
|
|
|
|
|
2014
|
|
|
|
|
|
|
package main; |
2015
|
|
|
|
|
|
|
|
2016
|
|
|
|
|
|
|
my $lfile = $space->lfile; |
2017
|
|
|
|
|
|
|
|
2018
|
|
|
|
|
|
|
# "Foo/Bar.pm" |
2019
|
|
|
|
|
|
|
|
2020
|
|
|
|
|
|
|
=back |
2021
|
|
|
|
|
|
|
|
2022
|
|
|
|
|
|
|
=cut |
2023
|
|
|
|
|
|
|
|
2024
|
|
|
|
|
|
|
=head2 load |
2025
|
|
|
|
|
|
|
|
2026
|
|
|
|
|
|
|
load() (Str) |
2027
|
|
|
|
|
|
|
|
2028
|
|
|
|
|
|
|
The load method checks whether the package namespace is already loaded and if |
2029
|
|
|
|
|
|
|
not attempts to load the package. If the package is not loaded and is not |
2030
|
|
|
|
|
|
|
loadable, this method will throw an exception using confess. If the package is |
2031
|
|
|
|
|
|
|
loadable, this method returns truthy with the package name. As a workaround for |
2032
|
|
|
|
|
|
|
packages that only exist in-memory, if the package contains a C, C, |
2033
|
|
|
|
|
|
|
C, or C routine it will be recognized as having been loaded. |
2034
|
|
|
|
|
|
|
|
2035
|
|
|
|
|
|
|
I> |
2036
|
|
|
|
|
|
|
|
2037
|
|
|
|
|
|
|
=over 4 |
2038
|
|
|
|
|
|
|
|
2039
|
|
|
|
|
|
|
=item load example 1 |
2040
|
|
|
|
|
|
|
|
2041
|
|
|
|
|
|
|
package main; |
2042
|
|
|
|
|
|
|
|
2043
|
|
|
|
|
|
|
use Venus::Space; |
2044
|
|
|
|
|
|
|
|
2045
|
|
|
|
|
|
|
my $space = Venus::Space->new('c_p_a_n'); |
2046
|
|
|
|
|
|
|
|
2047
|
|
|
|
|
|
|
my $load = $space->load; |
2048
|
|
|
|
|
|
|
|
2049
|
|
|
|
|
|
|
# "CPAN" |
2050
|
|
|
|
|
|
|
|
2051
|
|
|
|
|
|
|
=back |
2052
|
|
|
|
|
|
|
|
2053
|
|
|
|
|
|
|
=over 4 |
2054
|
|
|
|
|
|
|
|
2055
|
|
|
|
|
|
|
=item load example 2 |
2056
|
|
|
|
|
|
|
|
2057
|
|
|
|
|
|
|
package main; |
2058
|
|
|
|
|
|
|
|
2059
|
|
|
|
|
|
|
use Venus::Space; |
2060
|
|
|
|
|
|
|
|
2061
|
|
|
|
|
|
|
my $space = Venus::Space->new('no/thing'); |
2062
|
|
|
|
|
|
|
|
2063
|
|
|
|
|
|
|
my $load = $space->load; |
2064
|
|
|
|
|
|
|
|
2065
|
|
|
|
|
|
|
# Exception! (isa Venus::Space::Error) (see error_on_load) |
2066
|
|
|
|
|
|
|
|
2067
|
|
|
|
|
|
|
=back |
2068
|
|
|
|
|
|
|
|
2069
|
|
|
|
|
|
|
=cut |
2070
|
|
|
|
|
|
|
|
2071
|
|
|
|
|
|
|
=head2 loaded |
2072
|
|
|
|
|
|
|
|
2073
|
|
|
|
|
|
|
loaded() (Bool) |
2074
|
|
|
|
|
|
|
|
2075
|
|
|
|
|
|
|
The loaded method checks whether the package namespace is already loaded and |
2076
|
|
|
|
|
|
|
returns truthy or falsy. |
2077
|
|
|
|
|
|
|
|
2078
|
|
|
|
|
|
|
I> |
2079
|
|
|
|
|
|
|
|
2080
|
|
|
|
|
|
|
=over 4 |
2081
|
|
|
|
|
|
|
|
2082
|
|
|
|
|
|
|
=item loaded example 1 |
2083
|
|
|
|
|
|
|
|
2084
|
|
|
|
|
|
|
package main; |
2085
|
|
|
|
|
|
|
|
2086
|
|
|
|
|
|
|
use Venus::Space; |
2087
|
|
|
|
|
|
|
|
2088
|
|
|
|
|
|
|
my $space = Venus::Space->new('Kit'); |
2089
|
|
|
|
|
|
|
|
2090
|
|
|
|
|
|
|
$space->init; |
2091
|
|
|
|
|
|
|
|
2092
|
|
|
|
|
|
|
$space->unload; |
2093
|
|
|
|
|
|
|
|
2094
|
|
|
|
|
|
|
my $loaded = $space->loaded; |
2095
|
|
|
|
|
|
|
|
2096
|
|
|
|
|
|
|
# 0 |
2097
|
|
|
|
|
|
|
|
2098
|
|
|
|
|
|
|
=back |
2099
|
|
|
|
|
|
|
|
2100
|
|
|
|
|
|
|
=over 4 |
2101
|
|
|
|
|
|
|
|
2102
|
|
|
|
|
|
|
=item loaded example 2 |
2103
|
|
|
|
|
|
|
|
2104
|
|
|
|
|
|
|
package main; |
2105
|
|
|
|
|
|
|
|
2106
|
|
|
|
|
|
|
use Venus::Space; |
2107
|
|
|
|
|
|
|
|
2108
|
|
|
|
|
|
|
my $space = Venus::Space->new('Kit'); |
2109
|
|
|
|
|
|
|
|
2110
|
|
|
|
|
|
|
$space->init; |
2111
|
|
|
|
|
|
|
|
2112
|
|
|
|
|
|
|
my $loaded = $space->loaded; |
2113
|
|
|
|
|
|
|
|
2114
|
|
|
|
|
|
|
# 1 |
2115
|
|
|
|
|
|
|
|
2116
|
|
|
|
|
|
|
=back |
2117
|
|
|
|
|
|
|
|
2118
|
|
|
|
|
|
|
=cut |
2119
|
|
|
|
|
|
|
|
2120
|
|
|
|
|
|
|
=head2 locate |
2121
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
locate() (Str) |
2123
|
|
|
|
|
|
|
|
2124
|
|
|
|
|
|
|
The locate method checks whether the package namespace is available in |
2125
|
|
|
|
|
|
|
C<@INC>, i.e. on disk. This method returns the file if found or an empty |
2126
|
|
|
|
|
|
|
string. |
2127
|
|
|
|
|
|
|
|
2128
|
|
|
|
|
|
|
I> |
2129
|
|
|
|
|
|
|
|
2130
|
|
|
|
|
|
|
=over 4 |
2131
|
|
|
|
|
|
|
|
2132
|
|
|
|
|
|
|
=item locate example 1 |
2133
|
|
|
|
|
|
|
|
2134
|
|
|
|
|
|
|
package main; |
2135
|
|
|
|
|
|
|
|
2136
|
|
|
|
|
|
|
use Venus::Space; |
2137
|
|
|
|
|
|
|
|
2138
|
|
|
|
|
|
|
my $space = Venus::Space->new('xyz'); |
2139
|
|
|
|
|
|
|
|
2140
|
|
|
|
|
|
|
my $locate = $space->locate; |
2141
|
|
|
|
|
|
|
|
2142
|
|
|
|
|
|
|
# "" |
2143
|
|
|
|
|
|
|
|
2144
|
|
|
|
|
|
|
=back |
2145
|
|
|
|
|
|
|
|
2146
|
|
|
|
|
|
|
=over 4 |
2147
|
|
|
|
|
|
|
|
2148
|
|
|
|
|
|
|
=item locate example 2 |
2149
|
|
|
|
|
|
|
|
2150
|
|
|
|
|
|
|
package main; |
2151
|
|
|
|
|
|
|
|
2152
|
|
|
|
|
|
|
use Venus::Space; |
2153
|
|
|
|
|
|
|
|
2154
|
|
|
|
|
|
|
my $space = Venus::Space->new('data/dumper'); |
2155
|
|
|
|
|
|
|
|
2156
|
|
|
|
|
|
|
$space->load; |
2157
|
|
|
|
|
|
|
|
2158
|
|
|
|
|
|
|
my $locate = $space->locate; |
2159
|
|
|
|
|
|
|
|
2160
|
|
|
|
|
|
|
# "/path/to/lib/Data/Dumper.pm" |
2161
|
|
|
|
|
|
|
|
2162
|
|
|
|
|
|
|
=back |
2163
|
|
|
|
|
|
|
|
2164
|
|
|
|
|
|
|
=cut |
2165
|
|
|
|
|
|
|
|
2166
|
|
|
|
|
|
|
=head2 meta |
2167
|
|
|
|
|
|
|
|
2168
|
|
|
|
|
|
|
meta() (Meta) |
2169
|
|
|
|
|
|
|
|
2170
|
|
|
|
|
|
|
The meta method returns a L object representing the underlying |
2171
|
|
|
|
|
|
|
package namespace. To access the meta object for the instance itself, use the |
2172
|
|
|
|
|
|
|
superclass' L method. |
2173
|
|
|
|
|
|
|
|
2174
|
|
|
|
|
|
|
I> |
2175
|
|
|
|
|
|
|
|
2176
|
|
|
|
|
|
|
=over 4 |
2177
|
|
|
|
|
|
|
|
2178
|
|
|
|
|
|
|
=item meta example 1 |
2179
|
|
|
|
|
|
|
|
2180
|
|
|
|
|
|
|
# given: synopsis |
2181
|
|
|
|
|
|
|
|
2182
|
|
|
|
|
|
|
package main; |
2183
|
|
|
|
|
|
|
|
2184
|
|
|
|
|
|
|
my $meta = $space->meta; |
2185
|
|
|
|
|
|
|
|
2186
|
|
|
|
|
|
|
# bless({'name' => 'Foo::Bar'}, 'Venus::Meta') |
2187
|
|
|
|
|
|
|
|
2188
|
|
|
|
|
|
|
=back |
2189
|
|
|
|
|
|
|
|
2190
|
|
|
|
|
|
|
=over 4 |
2191
|
|
|
|
|
|
|
|
2192
|
|
|
|
|
|
|
=item meta example 2 |
2193
|
|
|
|
|
|
|
|
2194
|
|
|
|
|
|
|
# given: synopsis |
2195
|
|
|
|
|
|
|
|
2196
|
|
|
|
|
|
|
package main; |
2197
|
|
|
|
|
|
|
|
2198
|
|
|
|
|
|
|
my $meta = $space->META; |
2199
|
|
|
|
|
|
|
|
2200
|
|
|
|
|
|
|
# bless({'name' => 'Venus::Space'}, 'Venus::Meta') |
2201
|
|
|
|
|
|
|
|
2202
|
|
|
|
|
|
|
=back |
2203
|
|
|
|
|
|
|
|
2204
|
|
|
|
|
|
|
=cut |
2205
|
|
|
|
|
|
|
|
2206
|
|
|
|
|
|
|
=head2 mock |
2207
|
|
|
|
|
|
|
|
2208
|
|
|
|
|
|
|
mock() (Space) |
2209
|
|
|
|
|
|
|
|
2210
|
|
|
|
|
|
|
The mock method returns a L object representing an anonymous |
2211
|
|
|
|
|
|
|
package that derives from the invoking package. |
2212
|
|
|
|
|
|
|
|
2213
|
|
|
|
|
|
|
I> |
2214
|
|
|
|
|
|
|
|
2215
|
|
|
|
|
|
|
=over 4 |
2216
|
|
|
|
|
|
|
|
2217
|
|
|
|
|
|
|
=item mock example 1 |
2218
|
|
|
|
|
|
|
|
2219
|
|
|
|
|
|
|
# given: synopsis |
2220
|
|
|
|
|
|
|
|
2221
|
|
|
|
|
|
|
package main; |
2222
|
|
|
|
|
|
|
|
2223
|
|
|
|
|
|
|
my $mock = $space->mock; |
2224
|
|
|
|
|
|
|
|
2225
|
|
|
|
|
|
|
# bless({'name' => 'Venus::Space::Mock::0001::Foo::Bar'}, 'Venus::Space') |
2226
|
|
|
|
|
|
|
|
2227
|
|
|
|
|
|
|
# $mock->isa('Foo::Bar') # true |
2228
|
|
|
|
|
|
|
|
2229
|
|
|
|
|
|
|
=back |
2230
|
|
|
|
|
|
|
|
2231
|
|
|
|
|
|
|
=cut |
2232
|
|
|
|
|
|
|
|
2233
|
|
|
|
|
|
|
=head2 name |
2234
|
|
|
|
|
|
|
|
2235
|
|
|
|
|
|
|
name() (Str) |
2236
|
|
|
|
|
|
|
|
2237
|
|
|
|
|
|
|
The name method returns the fully-qualified package name. |
2238
|
|
|
|
|
|
|
|
2239
|
|
|
|
|
|
|
I> |
2240
|
|
|
|
|
|
|
|
2241
|
|
|
|
|
|
|
=over 4 |
2242
|
|
|
|
|
|
|
|
2243
|
|
|
|
|
|
|
=item name example 1 |
2244
|
|
|
|
|
|
|
|
2245
|
|
|
|
|
|
|
# given: synopsis; |
2246
|
|
|
|
|
|
|
|
2247
|
|
|
|
|
|
|
my $name = $space->name; |
2248
|
|
|
|
|
|
|
|
2249
|
|
|
|
|
|
|
# "Foo::Bar" |
2250
|
|
|
|
|
|
|
|
2251
|
|
|
|
|
|
|
=back |
2252
|
|
|
|
|
|
|
|
2253
|
|
|
|
|
|
|
=cut |
2254
|
|
|
|
|
|
|
|
2255
|
|
|
|
|
|
|
=head2 parent |
2256
|
|
|
|
|
|
|
|
2257
|
|
|
|
|
|
|
parent() (Space) |
2258
|
|
|
|
|
|
|
|
2259
|
|
|
|
|
|
|
The parent method returns a new L object for the parent package |
2260
|
|
|
|
|
|
|
namespace. |
2261
|
|
|
|
|
|
|
|
2262
|
|
|
|
|
|
|
I> |
2263
|
|
|
|
|
|
|
|
2264
|
|
|
|
|
|
|
=over 4 |
2265
|
|
|
|
|
|
|
|
2266
|
|
|
|
|
|
|
=item parent example 1 |
2267
|
|
|
|
|
|
|
|
2268
|
|
|
|
|
|
|
# given: synopsis; |
2269
|
|
|
|
|
|
|
|
2270
|
|
|
|
|
|
|
my $parent = $space->parent; |
2271
|
|
|
|
|
|
|
|
2272
|
|
|
|
|
|
|
# bless({ value => "Foo" }, "Venus::Space") |
2273
|
|
|
|
|
|
|
|
2274
|
|
|
|
|
|
|
=back |
2275
|
|
|
|
|
|
|
|
2276
|
|
|
|
|
|
|
=cut |
2277
|
|
|
|
|
|
|
|
2278
|
|
|
|
|
|
|
=head2 parse |
2279
|
|
|
|
|
|
|
|
2280
|
|
|
|
|
|
|
parse() (ArrayRef) |
2281
|
|
|
|
|
|
|
|
2282
|
|
|
|
|
|
|
The parse method parses the string argument and returns an arrayref of package |
2283
|
|
|
|
|
|
|
namespace segments (parts). |
2284
|
|
|
|
|
|
|
|
2285
|
|
|
|
|
|
|
I> |
2286
|
|
|
|
|
|
|
|
2287
|
|
|
|
|
|
|
=over 4 |
2288
|
|
|
|
|
|
|
|
2289
|
|
|
|
|
|
|
=item parse example 1 |
2290
|
|
|
|
|
|
|
|
2291
|
|
|
|
|
|
|
# given: synopsis; |
2292
|
|
|
|
|
|
|
|
2293
|
|
|
|
|
|
|
my $parse = $space->parse; |
2294
|
|
|
|
|
|
|
|
2295
|
|
|
|
|
|
|
# ["Foo", "Bar"] |
2296
|
|
|
|
|
|
|
|
2297
|
|
|
|
|
|
|
=back |
2298
|
|
|
|
|
|
|
|
2299
|
|
|
|
|
|
|
=over 4 |
2300
|
|
|
|
|
|
|
|
2301
|
|
|
|
|
|
|
=item parse example 2 |
2302
|
|
|
|
|
|
|
|
2303
|
|
|
|
|
|
|
package main; |
2304
|
|
|
|
|
|
|
|
2305
|
|
|
|
|
|
|
use Venus::Space; |
2306
|
|
|
|
|
|
|
|
2307
|
|
|
|
|
|
|
my $space = Venus::Space->new('Foo/Bar'); |
2308
|
|
|
|
|
|
|
|
2309
|
|
|
|
|
|
|
my $parse = $space->parse; |
2310
|
|
|
|
|
|
|
|
2311
|
|
|
|
|
|
|
# ["Foo", "Bar"] |
2312
|
|
|
|
|
|
|
|
2313
|
|
|
|
|
|
|
=back |
2314
|
|
|
|
|
|
|
|
2315
|
|
|
|
|
|
|
=over 4 |
2316
|
|
|
|
|
|
|
|
2317
|
|
|
|
|
|
|
=item parse example 3 |
2318
|
|
|
|
|
|
|
|
2319
|
|
|
|
|
|
|
package main; |
2320
|
|
|
|
|
|
|
|
2321
|
|
|
|
|
|
|
use Venus::Space; |
2322
|
|
|
|
|
|
|
|
2323
|
|
|
|
|
|
|
my $space = Venus::Space->new('Foo\Bar'); |
2324
|
|
|
|
|
|
|
|
2325
|
|
|
|
|
|
|
my $parse = $space->parse; |
2326
|
|
|
|
|
|
|
|
2327
|
|
|
|
|
|
|
# ["Foo", "Bar"] |
2328
|
|
|
|
|
|
|
|
2329
|
|
|
|
|
|
|
=back |
2330
|
|
|
|
|
|
|
|
2331
|
|
|
|
|
|
|
=over 4 |
2332
|
|
|
|
|
|
|
|
2333
|
|
|
|
|
|
|
=item parse example 4 |
2334
|
|
|
|
|
|
|
|
2335
|
|
|
|
|
|
|
package main; |
2336
|
|
|
|
|
|
|
|
2337
|
|
|
|
|
|
|
use Venus::Space; |
2338
|
|
|
|
|
|
|
|
2339
|
|
|
|
|
|
|
my $space = Venus::Space->new('Foo-Bar'); |
2340
|
|
|
|
|
|
|
|
2341
|
|
|
|
|
|
|
my $parse = $space->parse; |
2342
|
|
|
|
|
|
|
|
2343
|
|
|
|
|
|
|
# ["FooBar"] |
2344
|
|
|
|
|
|
|
|
2345
|
|
|
|
|
|
|
=back |
2346
|
|
|
|
|
|
|
|
2347
|
|
|
|
|
|
|
=over 4 |
2348
|
|
|
|
|
|
|
|
2349
|
|
|
|
|
|
|
=item parse example 5 |
2350
|
|
|
|
|
|
|
|
2351
|
|
|
|
|
|
|
package main; |
2352
|
|
|
|
|
|
|
|
2353
|
|
|
|
|
|
|
use Venus::Space; |
2354
|
|
|
|
|
|
|
|
2355
|
|
|
|
|
|
|
my $space = Venus::Space->new('Foo_Bar'); |
2356
|
|
|
|
|
|
|
|
2357
|
|
|
|
|
|
|
my $parse = $space->parse; |
2358
|
|
|
|
|
|
|
|
2359
|
|
|
|
|
|
|
# ["FooBar"] |
2360
|
|
|
|
|
|
|
|
2361
|
|
|
|
|
|
|
=back |
2362
|
|
|
|
|
|
|
|
2363
|
|
|
|
|
|
|
=cut |
2364
|
|
|
|
|
|
|
|
2365
|
|
|
|
|
|
|
=head2 parts |
2366
|
|
|
|
|
|
|
|
2367
|
|
|
|
|
|
|
parts() (ArrayRef) |
2368
|
|
|
|
|
|
|
|
2369
|
|
|
|
|
|
|
The parts method returns an arrayref of package namespace segments (parts). |
2370
|
|
|
|
|
|
|
|
2371
|
|
|
|
|
|
|
I> |
2372
|
|
|
|
|
|
|
|
2373
|
|
|
|
|
|
|
=over 4 |
2374
|
|
|
|
|
|
|
|
2375
|
|
|
|
|
|
|
=item parts example 1 |
2376
|
|
|
|
|
|
|
|
2377
|
|
|
|
|
|
|
package main; |
2378
|
|
|
|
|
|
|
|
2379
|
|
|
|
|
|
|
use Venus::Space; |
2380
|
|
|
|
|
|
|
|
2381
|
|
|
|
|
|
|
my $space = Venus::Space->new('Foo'); |
2382
|
|
|
|
|
|
|
|
2383
|
|
|
|
|
|
|
my $parts = $space->parts; |
2384
|
|
|
|
|
|
|
|
2385
|
|
|
|
|
|
|
# ["Foo"] |
2386
|
|
|
|
|
|
|
|
2387
|
|
|
|
|
|
|
=back |
2388
|
|
|
|
|
|
|
|
2389
|
|
|
|
|
|
|
=over 4 |
2390
|
|
|
|
|
|
|
|
2391
|
|
|
|
|
|
|
=item parts example 2 |
2392
|
|
|
|
|
|
|
|
2393
|
|
|
|
|
|
|
package main; |
2394
|
|
|
|
|
|
|
|
2395
|
|
|
|
|
|
|
use Venus::Space; |
2396
|
|
|
|
|
|
|
|
2397
|
|
|
|
|
|
|
my $space = Venus::Space->new('Foo/Bar'); |
2398
|
|
|
|
|
|
|
|
2399
|
|
|
|
|
|
|
my $parts = $space->parts; |
2400
|
|
|
|
|
|
|
|
2401
|
|
|
|
|
|
|
# ["Foo", "Bar"] |
2402
|
|
|
|
|
|
|
|
2403
|
|
|
|
|
|
|
=back |
2404
|
|
|
|
|
|
|
|
2405
|
|
|
|
|
|
|
=over 4 |
2406
|
|
|
|
|
|
|
|
2407
|
|
|
|
|
|
|
=item parts example 3 |
2408
|
|
|
|
|
|
|
|
2409
|
|
|
|
|
|
|
package main; |
2410
|
|
|
|
|
|
|
|
2411
|
|
|
|
|
|
|
use Venus::Space; |
2412
|
|
|
|
|
|
|
|
2413
|
|
|
|
|
|
|
my $space = Venus::Space->new('Foo_Bar'); |
2414
|
|
|
|
|
|
|
|
2415
|
|
|
|
|
|
|
my $parts = $space->parts; |
2416
|
|
|
|
|
|
|
|
2417
|
|
|
|
|
|
|
# ["FooBar"] |
2418
|
|
|
|
|
|
|
|
2419
|
|
|
|
|
|
|
=back |
2420
|
|
|
|
|
|
|
|
2421
|
|
|
|
|
|
|
=cut |
2422
|
|
|
|
|
|
|
|
2423
|
|
|
|
|
|
|
=head2 pfile |
2424
|
|
|
|
|
|
|
|
2425
|
|
|
|
|
|
|
pfile() (Str) |
2426
|
|
|
|
|
|
|
|
2427
|
|
|
|
|
|
|
The pfile method returns a C<.pod> file path for the underlying package. |
2428
|
|
|
|
|
|
|
|
2429
|
|
|
|
|
|
|
I> |
2430
|
|
|
|
|
|
|
|
2431
|
|
|
|
|
|
|
=over 4 |
2432
|
|
|
|
|
|
|
|
2433
|
|
|
|
|
|
|
=item pfile example 1 |
2434
|
|
|
|
|
|
|
|
2435
|
|
|
|
|
|
|
# given: synopsis |
2436
|
|
|
|
|
|
|
|
2437
|
|
|
|
|
|
|
package main; |
2438
|
|
|
|
|
|
|
|
2439
|
|
|
|
|
|
|
my $pfile = $space->pfile; |
2440
|
|
|
|
|
|
|
|
2441
|
|
|
|
|
|
|
# "Foo/Bar.pod" |
2442
|
|
|
|
|
|
|
|
2443
|
|
|
|
|
|
|
=back |
2444
|
|
|
|
|
|
|
|
2445
|
|
|
|
|
|
|
=cut |
2446
|
|
|
|
|
|
|
|
2447
|
|
|
|
|
|
|
=head2 prepend |
2448
|
|
|
|
|
|
|
|
2449
|
|
|
|
|
|
|
prepend(Str @path) (Space) |
2450
|
|
|
|
|
|
|
|
2451
|
|
|
|
|
|
|
The prepend method modifies the object by prepending to the package namespace |
2452
|
|
|
|
|
|
|
parts. |
2453
|
|
|
|
|
|
|
|
2454
|
|
|
|
|
|
|
I> |
2455
|
|
|
|
|
|
|
|
2456
|
|
|
|
|
|
|
=over 4 |
2457
|
|
|
|
|
|
|
|
2458
|
|
|
|
|
|
|
=item prepend example 1 |
2459
|
|
|
|
|
|
|
|
2460
|
|
|
|
|
|
|
# given: synopsis; |
2461
|
|
|
|
|
|
|
|
2462
|
|
|
|
|
|
|
my $prepend = $space->prepend('etc'); |
2463
|
|
|
|
|
|
|
|
2464
|
|
|
|
|
|
|
# bless({ value => "Etc/Foo/Bar" }, "Venus::Space") |
2465
|
|
|
|
|
|
|
|
2466
|
|
|
|
|
|
|
=back |
2467
|
|
|
|
|
|
|
|
2468
|
|
|
|
|
|
|
=over 4 |
2469
|
|
|
|
|
|
|
|
2470
|
|
|
|
|
|
|
=item prepend example 2 |
2471
|
|
|
|
|
|
|
|
2472
|
|
|
|
|
|
|
# given: synopsis; |
2473
|
|
|
|
|
|
|
|
2474
|
|
|
|
|
|
|
my $prepend = $space->prepend('etc', 'tmp'); |
2475
|
|
|
|
|
|
|
|
2476
|
|
|
|
|
|
|
# bless({ value => "Etc/Tmp/Foo/Bar" }, "Venus::Space") |
2477
|
|
|
|
|
|
|
|
2478
|
|
|
|
|
|
|
=back |
2479
|
|
|
|
|
|
|
|
2480
|
|
|
|
|
|
|
=cut |
2481
|
|
|
|
|
|
|
|
2482
|
|
|
|
|
|
|
=head2 purge |
2483
|
|
|
|
|
|
|
|
2484
|
|
|
|
|
|
|
purge() (Self) |
2485
|
|
|
|
|
|
|
|
2486
|
|
|
|
|
|
|
The purge method purges a package space by expunging its symbol table and |
2487
|
|
|
|
|
|
|
removing it from C<%INC>. |
2488
|
|
|
|
|
|
|
|
2489
|
|
|
|
|
|
|
I> |
2490
|
|
|
|
|
|
|
|
2491
|
|
|
|
|
|
|
=over 4 |
2492
|
|
|
|
|
|
|
|
2493
|
|
|
|
|
|
|
=item purge example 1 |
2494
|
|
|
|
|
|
|
|
2495
|
|
|
|
|
|
|
package main; |
2496
|
|
|
|
|
|
|
|
2497
|
|
|
|
|
|
|
use Venus::Space; |
2498
|
|
|
|
|
|
|
|
2499
|
|
|
|
|
|
|
# Bar::Gen is generated with $VERSION as 0.01 |
2500
|
|
|
|
|
|
|
|
2501
|
|
|
|
|
|
|
my $space = Venus::Space->new('Bar/Gen'); |
2502
|
|
|
|
|
|
|
|
2503
|
|
|
|
|
|
|
$space->load; |
2504
|
|
|
|
|
|
|
|
2505
|
|
|
|
|
|
|
my $purge = $space->purge; |
2506
|
|
|
|
|
|
|
|
2507
|
|
|
|
|
|
|
# bless({ value => "Bar::Gen" }, "Venus::Space") |
2508
|
|
|
|
|
|
|
|
2509
|
|
|
|
|
|
|
# Bar::Gen->VERSION was 0.01, now undef |
2510
|
|
|
|
|
|
|
|
2511
|
|
|
|
|
|
|
# Symbol table is gone, $space->visible is 0 |
2512
|
|
|
|
|
|
|
|
2513
|
|
|
|
|
|
|
=back |
2514
|
|
|
|
|
|
|
|
2515
|
|
|
|
|
|
|
=cut |
2516
|
|
|
|
|
|
|
|
2517
|
|
|
|
|
|
|
=head2 rebase |
2518
|
|
|
|
|
|
|
|
2519
|
|
|
|
|
|
|
rebase(Str @path) (Space) |
2520
|
|
|
|
|
|
|
|
2521
|
|
|
|
|
|
|
The rebase method returns an object by prepending the package namespace |
2522
|
|
|
|
|
|
|
specified to the base of the current object's namespace. |
2523
|
|
|
|
|
|
|
|
2524
|
|
|
|
|
|
|
I> |
2525
|
|
|
|
|
|
|
|
2526
|
|
|
|
|
|
|
=over 4 |
2527
|
|
|
|
|
|
|
|
2528
|
|
|
|
|
|
|
=item rebase example 1 |
2529
|
|
|
|
|
|
|
|
2530
|
|
|
|
|
|
|
# given: synopsis; |
2531
|
|
|
|
|
|
|
|
2532
|
|
|
|
|
|
|
my $rebase = $space->rebase('zoo'); |
2533
|
|
|
|
|
|
|
|
2534
|
|
|
|
|
|
|
# bless({ value => "Zoo/Bar" }, "Venus::Space") |
2535
|
|
|
|
|
|
|
|
2536
|
|
|
|
|
|
|
=back |
2537
|
|
|
|
|
|
|
|
2538
|
|
|
|
|
|
|
=cut |
2539
|
|
|
|
|
|
|
|
2540
|
|
|
|
|
|
|
=head2 reload |
2541
|
|
|
|
|
|
|
|
2542
|
|
|
|
|
|
|
reload() (Str) |
2543
|
|
|
|
|
|
|
|
2544
|
|
|
|
|
|
|
The reload method attempts to delete and reload the package namespace using the |
2545
|
|
|
|
|
|
|
L method. B Reloading is additive and will overwrite existing |
2546
|
|
|
|
|
|
|
symbols but does not remove symbols. |
2547
|
|
|
|
|
|
|
|
2548
|
|
|
|
|
|
|
I> |
2549
|
|
|
|
|
|
|
|
2550
|
|
|
|
|
|
|
=over 4 |
2551
|
|
|
|
|
|
|
|
2552
|
|
|
|
|
|
|
=item reload example 1 |
2553
|
|
|
|
|
|
|
|
2554
|
|
|
|
|
|
|
package main; |
2555
|
|
|
|
|
|
|
|
2556
|
|
|
|
|
|
|
use Venus::Space; |
2557
|
|
|
|
|
|
|
|
2558
|
|
|
|
|
|
|
# Foo::Gen is generated with $VERSION as 0.01 |
2559
|
|
|
|
|
|
|
|
2560
|
|
|
|
|
|
|
my $space = Venus::Space->new('Foo/Gen'); |
2561
|
|
|
|
|
|
|
|
2562
|
|
|
|
|
|
|
my $reload = $space->reload; |
2563
|
|
|
|
|
|
|
|
2564
|
|
|
|
|
|
|
# Foo::Gen |
2565
|
|
|
|
|
|
|
# Foo::Gen->VERSION is 0.01 |
2566
|
|
|
|
|
|
|
|
2567
|
|
|
|
|
|
|
=back |
2568
|
|
|
|
|
|
|
|
2569
|
|
|
|
|
|
|
=over 4 |
2570
|
|
|
|
|
|
|
|
2571
|
|
|
|
|
|
|
=item reload example 2 |
2572
|
|
|
|
|
|
|
|
2573
|
|
|
|
|
|
|
package main; |
2574
|
|
|
|
|
|
|
|
2575
|
|
|
|
|
|
|
use Venus::Space; |
2576
|
|
|
|
|
|
|
|
2577
|
|
|
|
|
|
|
# Foo::Gen is generated with $VERSION as 0.02 |
2578
|
|
|
|
|
|
|
|
2579
|
|
|
|
|
|
|
my $space = Venus::Space->new('Foo/Gen'); |
2580
|
|
|
|
|
|
|
|
2581
|
|
|
|
|
|
|
my $reload = $space->reload; |
2582
|
|
|
|
|
|
|
|
2583
|
|
|
|
|
|
|
# Foo::Gen |
2584
|
|
|
|
|
|
|
# Foo::Gen->VERSION is 0.02 |
2585
|
|
|
|
|
|
|
|
2586
|
|
|
|
|
|
|
=back |
2587
|
|
|
|
|
|
|
|
2588
|
|
|
|
|
|
|
=cut |
2589
|
|
|
|
|
|
|
|
2590
|
|
|
|
|
|
|
=head2 require |
2591
|
|
|
|
|
|
|
|
2592
|
|
|
|
|
|
|
require(Str $target) (Any) |
2593
|
|
|
|
|
|
|
|
2594
|
|
|
|
|
|
|
The require method executes a C statement within the package namespace |
2595
|
|
|
|
|
|
|
specified. |
2596
|
|
|
|
|
|
|
|
2597
|
|
|
|
|
|
|
I> |
2598
|
|
|
|
|
|
|
|
2599
|
|
|
|
|
|
|
=over 4 |
2600
|
|
|
|
|
|
|
|
2601
|
|
|
|
|
|
|
=item require example 1 |
2602
|
|
|
|
|
|
|
|
2603
|
|
|
|
|
|
|
# given: synopsis; |
2604
|
|
|
|
|
|
|
|
2605
|
|
|
|
|
|
|
my $require = $space->require('Venus'); |
2606
|
|
|
|
|
|
|
|
2607
|
|
|
|
|
|
|
# 1 |
2608
|
|
|
|
|
|
|
|
2609
|
|
|
|
|
|
|
=back |
2610
|
|
|
|
|
|
|
|
2611
|
|
|
|
|
|
|
=cut |
2612
|
|
|
|
|
|
|
|
2613
|
|
|
|
|
|
|
=head2 root |
2614
|
|
|
|
|
|
|
|
2615
|
|
|
|
|
|
|
root() (Str) |
2616
|
|
|
|
|
|
|
|
2617
|
|
|
|
|
|
|
The root method returns the root package namespace segments (parts). Sometimes |
2618
|
|
|
|
|
|
|
separating the C from the C helps identify how subsequent child |
2619
|
|
|
|
|
|
|
objects were derived. |
2620
|
|
|
|
|
|
|
|
2621
|
|
|
|
|
|
|
I> |
2622
|
|
|
|
|
|
|
|
2623
|
|
|
|
|
|
|
=over 4 |
2624
|
|
|
|
|
|
|
|
2625
|
|
|
|
|
|
|
=item root example 1 |
2626
|
|
|
|
|
|
|
|
2627
|
|
|
|
|
|
|
# given: synopsis; |
2628
|
|
|
|
|
|
|
|
2629
|
|
|
|
|
|
|
my $root = $space->root; |
2630
|
|
|
|
|
|
|
|
2631
|
|
|
|
|
|
|
# "Foo" |
2632
|
|
|
|
|
|
|
|
2633
|
|
|
|
|
|
|
=back |
2634
|
|
|
|
|
|
|
|
2635
|
|
|
|
|
|
|
=cut |
2636
|
|
|
|
|
|
|
|
2637
|
|
|
|
|
|
|
=head2 routine |
2638
|
|
|
|
|
|
|
|
2639
|
|
|
|
|
|
|
routine(Str $name, CodeRef $code) (CodeRef) |
2640
|
|
|
|
|
|
|
|
2641
|
|
|
|
|
|
|
The routine method gets or sets the subroutine reference for the given subroutine |
2642
|
|
|
|
|
|
|
name. |
2643
|
|
|
|
|
|
|
|
2644
|
|
|
|
|
|
|
I> |
2645
|
|
|
|
|
|
|
|
2646
|
|
|
|
|
|
|
=over 4 |
2647
|
|
|
|
|
|
|
|
2648
|
|
|
|
|
|
|
=item routine example 1 |
2649
|
|
|
|
|
|
|
|
2650
|
|
|
|
|
|
|
package Foo; |
2651
|
|
|
|
|
|
|
|
2652
|
|
|
|
|
|
|
sub cont { |
2653
|
|
|
|
|
|
|
[@_] |
2654
|
|
|
|
|
|
|
} |
2655
|
|
|
|
|
|
|
|
2656
|
|
|
|
|
|
|
sub abort { |
2657
|
|
|
|
|
|
|
[@_] |
2658
|
|
|
|
|
|
|
} |
2659
|
|
|
|
|
|
|
|
2660
|
|
|
|
|
|
|
package main; |
2661
|
|
|
|
|
|
|
|
2662
|
|
|
|
|
|
|
use Venus::Space; |
2663
|
|
|
|
|
|
|
|
2664
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo'); |
2665
|
|
|
|
|
|
|
|
2666
|
|
|
|
|
|
|
my $routine = $space->routine('cont'); |
2667
|
|
|
|
|
|
|
|
2668
|
|
|
|
|
|
|
# sub { ... } |
2669
|
|
|
|
|
|
|
|
2670
|
|
|
|
|
|
|
=back |
2671
|
|
|
|
|
|
|
|
2672
|
|
|
|
|
|
|
=over 4 |
2673
|
|
|
|
|
|
|
|
2674
|
|
|
|
|
|
|
=item routine example 2 |
2675
|
|
|
|
|
|
|
|
2676
|
|
|
|
|
|
|
package Foo; |
2677
|
|
|
|
|
|
|
|
2678
|
|
|
|
|
|
|
sub cont { |
2679
|
|
|
|
|
|
|
[@_] |
2680
|
|
|
|
|
|
|
} |
2681
|
|
|
|
|
|
|
|
2682
|
|
|
|
|
|
|
sub abort { |
2683
|
|
|
|
|
|
|
[@_] |
2684
|
|
|
|
|
|
|
} |
2685
|
|
|
|
|
|
|
|
2686
|
|
|
|
|
|
|
package main; |
2687
|
|
|
|
|
|
|
|
2688
|
|
|
|
|
|
|
use Venus::Space; |
2689
|
|
|
|
|
|
|
|
2690
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo'); |
2691
|
|
|
|
|
|
|
|
2692
|
|
|
|
|
|
|
my $routine = $space->routine('report', sub{[@_]}); |
2693
|
|
|
|
|
|
|
|
2694
|
|
|
|
|
|
|
# sub { ... } |
2695
|
|
|
|
|
|
|
|
2696
|
|
|
|
|
|
|
=back |
2697
|
|
|
|
|
|
|
|
2698
|
|
|
|
|
|
|
=cut |
2699
|
|
|
|
|
|
|
|
2700
|
|
|
|
|
|
|
=head2 routines |
2701
|
|
|
|
|
|
|
|
2702
|
|
|
|
|
|
|
routines() (ArrayRef) |
2703
|
|
|
|
|
|
|
|
2704
|
|
|
|
|
|
|
The routines method searches the package namespace for routines and returns |
2705
|
|
|
|
|
|
|
their names. |
2706
|
|
|
|
|
|
|
|
2707
|
|
|
|
|
|
|
I> |
2708
|
|
|
|
|
|
|
|
2709
|
|
|
|
|
|
|
=over 4 |
2710
|
|
|
|
|
|
|
|
2711
|
|
|
|
|
|
|
=item routines example 1 |
2712
|
|
|
|
|
|
|
|
2713
|
|
|
|
|
|
|
package Foo::Subs; |
2714
|
|
|
|
|
|
|
|
2715
|
|
|
|
|
|
|
sub start { |
2716
|
|
|
|
|
|
|
1 |
2717
|
|
|
|
|
|
|
} |
2718
|
|
|
|
|
|
|
|
2719
|
|
|
|
|
|
|
sub abort { |
2720
|
|
|
|
|
|
|
1 |
2721
|
|
|
|
|
|
|
} |
2722
|
|
|
|
|
|
|
|
2723
|
|
|
|
|
|
|
package main; |
2724
|
|
|
|
|
|
|
|
2725
|
|
|
|
|
|
|
use Venus::Space; |
2726
|
|
|
|
|
|
|
|
2727
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/subs'); |
2728
|
|
|
|
|
|
|
|
2729
|
|
|
|
|
|
|
my $routines = $space->routines; |
2730
|
|
|
|
|
|
|
|
2731
|
|
|
|
|
|
|
# ["abort", "start"] |
2732
|
|
|
|
|
|
|
|
2733
|
|
|
|
|
|
|
=back |
2734
|
|
|
|
|
|
|
|
2735
|
|
|
|
|
|
|
=cut |
2736
|
|
|
|
|
|
|
|
2737
|
|
|
|
|
|
|
=head2 scalar |
2738
|
|
|
|
|
|
|
|
2739
|
|
|
|
|
|
|
scalar(Str $name, Any @data) (Any) |
2740
|
|
|
|
|
|
|
|
2741
|
|
|
|
|
|
|
The scalar method gets or sets the value for the given package scalar variable name. |
2742
|
|
|
|
|
|
|
|
2743
|
|
|
|
|
|
|
I> |
2744
|
|
|
|
|
|
|
|
2745
|
|
|
|
|
|
|
=over 4 |
2746
|
|
|
|
|
|
|
|
2747
|
|
|
|
|
|
|
=item scalar example 1 |
2748
|
|
|
|
|
|
|
|
2749
|
|
|
|
|
|
|
# given: synopsis; |
2750
|
|
|
|
|
|
|
|
2751
|
|
|
|
|
|
|
package Foo::Bar; |
2752
|
|
|
|
|
|
|
|
2753
|
|
|
|
|
|
|
our $root = '/path/to/file'; |
2754
|
|
|
|
|
|
|
|
2755
|
|
|
|
|
|
|
package main; |
2756
|
|
|
|
|
|
|
|
2757
|
|
|
|
|
|
|
my $scalar = $space->scalar('root'); |
2758
|
|
|
|
|
|
|
|
2759
|
|
|
|
|
|
|
# "/path/to/file" |
2760
|
|
|
|
|
|
|
|
2761
|
|
|
|
|
|
|
=back |
2762
|
|
|
|
|
|
|
|
2763
|
|
|
|
|
|
|
=over 4 |
2764
|
|
|
|
|
|
|
|
2765
|
|
|
|
|
|
|
=item scalar example 2 |
2766
|
|
|
|
|
|
|
|
2767
|
|
|
|
|
|
|
# given: synopsis; |
2768
|
|
|
|
|
|
|
|
2769
|
|
|
|
|
|
|
package Foo::Bar; |
2770
|
|
|
|
|
|
|
|
2771
|
|
|
|
|
|
|
our $root = '/path/to/file'; |
2772
|
|
|
|
|
|
|
|
2773
|
|
|
|
|
|
|
package main; |
2774
|
|
|
|
|
|
|
|
2775
|
|
|
|
|
|
|
my $scalar = $space->scalar('root', '/tmp/path/to/file'); |
2776
|
|
|
|
|
|
|
|
2777
|
|
|
|
|
|
|
# "/tmp/path/to/file" |
2778
|
|
|
|
|
|
|
|
2779
|
|
|
|
|
|
|
=back |
2780
|
|
|
|
|
|
|
|
2781
|
|
|
|
|
|
|
=cut |
2782
|
|
|
|
|
|
|
|
2783
|
|
|
|
|
|
|
=head2 scalars |
2784
|
|
|
|
|
|
|
|
2785
|
|
|
|
|
|
|
scalars() (ArrayRef) |
2786
|
|
|
|
|
|
|
|
2787
|
|
|
|
|
|
|
The scalars method searches the package namespace for scalars and returns their |
2788
|
|
|
|
|
|
|
names. |
2789
|
|
|
|
|
|
|
|
2790
|
|
|
|
|
|
|
I> |
2791
|
|
|
|
|
|
|
|
2792
|
|
|
|
|
|
|
=over 4 |
2793
|
|
|
|
|
|
|
|
2794
|
|
|
|
|
|
|
=item scalars example 1 |
2795
|
|
|
|
|
|
|
|
2796
|
|
|
|
|
|
|
# given: synopsis; |
2797
|
|
|
|
|
|
|
|
2798
|
|
|
|
|
|
|
package Foo::Bar; |
2799
|
|
|
|
|
|
|
|
2800
|
|
|
|
|
|
|
our $root = 'root'; |
2801
|
|
|
|
|
|
|
our $base = 'path/to'; |
2802
|
|
|
|
|
|
|
our $file = 'file'; |
2803
|
|
|
|
|
|
|
|
2804
|
|
|
|
|
|
|
package main; |
2805
|
|
|
|
|
|
|
|
2806
|
|
|
|
|
|
|
my $scalars = $space->scalars; |
2807
|
|
|
|
|
|
|
|
2808
|
|
|
|
|
|
|
# ["base", "file", "root"] |
2809
|
|
|
|
|
|
|
|
2810
|
|
|
|
|
|
|
=back |
2811
|
|
|
|
|
|
|
|
2812
|
|
|
|
|
|
|
=cut |
2813
|
|
|
|
|
|
|
|
2814
|
|
|
|
|
|
|
=head2 sibling |
2815
|
|
|
|
|
|
|
|
2816
|
|
|
|
|
|
|
sibling(Str $path) (Space) |
2817
|
|
|
|
|
|
|
|
2818
|
|
|
|
|
|
|
The sibling method returns a new L object for the sibling package |
2819
|
|
|
|
|
|
|
namespace. |
2820
|
|
|
|
|
|
|
|
2821
|
|
|
|
|
|
|
I> |
2822
|
|
|
|
|
|
|
|
2823
|
|
|
|
|
|
|
=over 4 |
2824
|
|
|
|
|
|
|
|
2825
|
|
|
|
|
|
|
=item sibling example 1 |
2826
|
|
|
|
|
|
|
|
2827
|
|
|
|
|
|
|
# given: synopsis; |
2828
|
|
|
|
|
|
|
|
2829
|
|
|
|
|
|
|
my $sibling = $space->sibling('baz'); |
2830
|
|
|
|
|
|
|
|
2831
|
|
|
|
|
|
|
# bless({ value => "Foo/Baz" }, "Venus::Space") |
2832
|
|
|
|
|
|
|
|
2833
|
|
|
|
|
|
|
=back |
2834
|
|
|
|
|
|
|
|
2835
|
|
|
|
|
|
|
=cut |
2836
|
|
|
|
|
|
|
|
2837
|
|
|
|
|
|
|
=head2 siblings |
2838
|
|
|
|
|
|
|
|
2839
|
|
|
|
|
|
|
siblings() (ArrayRef[Object]) |
2840
|
|
|
|
|
|
|
|
2841
|
|
|
|
|
|
|
The siblings method searches C<%INC> and C<@INC> and retuns a list of |
2842
|
|
|
|
|
|
|
L objects for each sibling namespace found (one level deep). |
2843
|
|
|
|
|
|
|
|
2844
|
|
|
|
|
|
|
I> |
2845
|
|
|
|
|
|
|
|
2846
|
|
|
|
|
|
|
=over 4 |
2847
|
|
|
|
|
|
|
|
2848
|
|
|
|
|
|
|
=item siblings example 1 |
2849
|
|
|
|
|
|
|
|
2850
|
|
|
|
|
|
|
package main; |
2851
|
|
|
|
|
|
|
|
2852
|
|
|
|
|
|
|
use Venus::Space; |
2853
|
|
|
|
|
|
|
|
2854
|
|
|
|
|
|
|
my $space = Venus::Space->new('encode/m_i_m_e'); |
2855
|
|
|
|
|
|
|
|
2856
|
|
|
|
|
|
|
my $siblings = $space->siblings; |
2857
|
|
|
|
|
|
|
|
2858
|
|
|
|
|
|
|
# [ |
2859
|
|
|
|
|
|
|
# bless({ value => "Encode/MIME/Header" }, "Venus::Space"), |
2860
|
|
|
|
|
|
|
# bless({ value => "Encode/MIME/Name" }, "Venus::Space"), |
2861
|
|
|
|
|
|
|
# ... |
2862
|
|
|
|
|
|
|
# ] |
2863
|
|
|
|
|
|
|
|
2864
|
|
|
|
|
|
|
=back |
2865
|
|
|
|
|
|
|
|
2866
|
|
|
|
|
|
|
=cut |
2867
|
|
|
|
|
|
|
|
2868
|
|
|
|
|
|
|
=head2 splice |
2869
|
|
|
|
|
|
|
|
2870
|
|
|
|
|
|
|
splice(Int $offset, Int $length, Any @list) (Space) |
2871
|
|
|
|
|
|
|
|
2872
|
|
|
|
|
|
|
The splice method perform a Perl L operation on the package |
2873
|
|
|
|
|
|
|
namespace. |
2874
|
|
|
|
|
|
|
|
2875
|
|
|
|
|
|
|
I> |
2876
|
|
|
|
|
|
|
|
2877
|
|
|
|
|
|
|
=over 4 |
2878
|
|
|
|
|
|
|
|
2879
|
|
|
|
|
|
|
=item splice example 1 |
2880
|
|
|
|
|
|
|
|
2881
|
|
|
|
|
|
|
package main; |
2882
|
|
|
|
|
|
|
|
2883
|
|
|
|
|
|
|
use Venus::Space; |
2884
|
|
|
|
|
|
|
|
2885
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/baz'); |
2886
|
|
|
|
|
|
|
|
2887
|
|
|
|
|
|
|
my $splice = $space->splice(1, 0, 'bar'); |
2888
|
|
|
|
|
|
|
|
2889
|
|
|
|
|
|
|
# bless({ value => "Foo/Bar/Baz" }, "Venus::Space") |
2890
|
|
|
|
|
|
|
|
2891
|
|
|
|
|
|
|
=back |
2892
|
|
|
|
|
|
|
|
2893
|
|
|
|
|
|
|
=over 4 |
2894
|
|
|
|
|
|
|
|
2895
|
|
|
|
|
|
|
=item splice example 2 |
2896
|
|
|
|
|
|
|
|
2897
|
|
|
|
|
|
|
package main; |
2898
|
|
|
|
|
|
|
|
2899
|
|
|
|
|
|
|
use Venus::Space; |
2900
|
|
|
|
|
|
|
|
2901
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/baz'); |
2902
|
|
|
|
|
|
|
|
2903
|
|
|
|
|
|
|
my $splice = $space->splice(1, 1); |
2904
|
|
|
|
|
|
|
|
2905
|
|
|
|
|
|
|
# bless({ value => "Foo" }, "Venus::Space") |
2906
|
|
|
|
|
|
|
|
2907
|
|
|
|
|
|
|
=back |
2908
|
|
|
|
|
|
|
|
2909
|
|
|
|
|
|
|
=over 4 |
2910
|
|
|
|
|
|
|
|
2911
|
|
|
|
|
|
|
=item splice example 3 |
2912
|
|
|
|
|
|
|
|
2913
|
|
|
|
|
|
|
package main; |
2914
|
|
|
|
|
|
|
|
2915
|
|
|
|
|
|
|
use Venus::Space; |
2916
|
|
|
|
|
|
|
|
2917
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/baz'); |
2918
|
|
|
|
|
|
|
|
2919
|
|
|
|
|
|
|
my $splice = $space->splice(-2, 1); |
2920
|
|
|
|
|
|
|
|
2921
|
|
|
|
|
|
|
# bless({ value => "Baz" }, "Venus::Space") |
2922
|
|
|
|
|
|
|
|
2923
|
|
|
|
|
|
|
=back |
2924
|
|
|
|
|
|
|
|
2925
|
|
|
|
|
|
|
=over 4 |
2926
|
|
|
|
|
|
|
|
2927
|
|
|
|
|
|
|
=item splice example 4 |
2928
|
|
|
|
|
|
|
|
2929
|
|
|
|
|
|
|
package main; |
2930
|
|
|
|
|
|
|
|
2931
|
|
|
|
|
|
|
use Venus::Space; |
2932
|
|
|
|
|
|
|
|
2933
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/baz'); |
2934
|
|
|
|
|
|
|
|
2935
|
|
|
|
|
|
|
my $splice = $space->splice(1); |
2936
|
|
|
|
|
|
|
|
2937
|
|
|
|
|
|
|
# bless({ value => "Foo" }, "Venus::Space") |
2938
|
|
|
|
|
|
|
|
2939
|
|
|
|
|
|
|
=back |
2940
|
|
|
|
|
|
|
|
2941
|
|
|
|
|
|
|
=cut |
2942
|
|
|
|
|
|
|
|
2943
|
|
|
|
|
|
|
=head2 swap |
2944
|
|
|
|
|
|
|
|
2945
|
|
|
|
|
|
|
swap(Str $name, CodeRef $code) (CodeRef) |
2946
|
|
|
|
|
|
|
|
2947
|
|
|
|
|
|
|
The swap method overwrites the named subroutine in the underlying package with |
2948
|
|
|
|
|
|
|
the code reference provided and returns the original subroutine as a code |
2949
|
|
|
|
|
|
|
reference. The code provided will be passed a reference to the original |
2950
|
|
|
|
|
|
|
subroutine as its first argument. |
2951
|
|
|
|
|
|
|
|
2952
|
|
|
|
|
|
|
I> |
2953
|
|
|
|
|
|
|
|
2954
|
|
|
|
|
|
|
=over 4 |
2955
|
|
|
|
|
|
|
|
2956
|
|
|
|
|
|
|
=item swap example 1 |
2957
|
|
|
|
|
|
|
|
2958
|
|
|
|
|
|
|
package Foo::Swap; |
2959
|
|
|
|
|
|
|
|
2960
|
|
|
|
|
|
|
use Venus::Class; |
2961
|
|
|
|
|
|
|
|
2962
|
|
|
|
|
|
|
package main; |
2963
|
|
|
|
|
|
|
|
2964
|
|
|
|
|
|
|
use Venus::Space; |
2965
|
|
|
|
|
|
|
|
2966
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/swap'); |
2967
|
|
|
|
|
|
|
|
2968
|
|
|
|
|
|
|
my $subroutine = $space->swap('new', sub { |
2969
|
|
|
|
|
|
|
my ($next, @args) = @_; |
2970
|
|
|
|
|
|
|
my $self = $next->(@args); |
2971
|
|
|
|
|
|
|
$self->{swapped} = 1; |
2972
|
|
|
|
|
|
|
return $self; |
2973
|
|
|
|
|
|
|
}); |
2974
|
|
|
|
|
|
|
|
2975
|
|
|
|
|
|
|
# sub { ... } |
2976
|
|
|
|
|
|
|
|
2977
|
|
|
|
|
|
|
=back |
2978
|
|
|
|
|
|
|
|
2979
|
|
|
|
|
|
|
=over 4 |
2980
|
|
|
|
|
|
|
|
2981
|
|
|
|
|
|
|
=item swap example 2 |
2982
|
|
|
|
|
|
|
|
2983
|
|
|
|
|
|
|
package Foo::Swap; |
2984
|
|
|
|
|
|
|
|
2985
|
|
|
|
|
|
|
use Venus::Class; |
2986
|
|
|
|
|
|
|
|
2987
|
|
|
|
|
|
|
package main; |
2988
|
|
|
|
|
|
|
|
2989
|
|
|
|
|
|
|
use Venus::Space; |
2990
|
|
|
|
|
|
|
|
2991
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/swap'); |
2992
|
|
|
|
|
|
|
|
2993
|
|
|
|
|
|
|
my $subroutine = $space->swap('something', sub { |
2994
|
|
|
|
|
|
|
my ($next, @args) = @_; |
2995
|
|
|
|
|
|
|
my $self = $next->(@args); |
2996
|
|
|
|
|
|
|
$self->{swapped} = 1; |
2997
|
|
|
|
|
|
|
return $self; |
2998
|
|
|
|
|
|
|
}); |
2999
|
|
|
|
|
|
|
|
3000
|
|
|
|
|
|
|
# Exception! (isa Venus::Space::Error) (see error_on_swap) |
3001
|
|
|
|
|
|
|
|
3002
|
|
|
|
|
|
|
=back |
3003
|
|
|
|
|
|
|
|
3004
|
|
|
|
|
|
|
=cut |
3005
|
|
|
|
|
|
|
|
3006
|
|
|
|
|
|
|
=head2 tfile |
3007
|
|
|
|
|
|
|
|
3008
|
|
|
|
|
|
|
tfile() (Str) |
3009
|
|
|
|
|
|
|
|
3010
|
|
|
|
|
|
|
The tfile method returns a C<.t> file path for the underlying package. |
3011
|
|
|
|
|
|
|
|
3012
|
|
|
|
|
|
|
I> |
3013
|
|
|
|
|
|
|
|
3014
|
|
|
|
|
|
|
=over 4 |
3015
|
|
|
|
|
|
|
|
3016
|
|
|
|
|
|
|
=item tfile example 1 |
3017
|
|
|
|
|
|
|
|
3018
|
|
|
|
|
|
|
# given: synopsis |
3019
|
|
|
|
|
|
|
|
3020
|
|
|
|
|
|
|
package main; |
3021
|
|
|
|
|
|
|
|
3022
|
|
|
|
|
|
|
my $tfile = $space->tfile; |
3023
|
|
|
|
|
|
|
|
3024
|
|
|
|
|
|
|
# "Foo_Bar.t" |
3025
|
|
|
|
|
|
|
|
3026
|
|
|
|
|
|
|
=back |
3027
|
|
|
|
|
|
|
|
3028
|
|
|
|
|
|
|
=cut |
3029
|
|
|
|
|
|
|
|
3030
|
|
|
|
|
|
|
=head2 tryload |
3031
|
|
|
|
|
|
|
|
3032
|
|
|
|
|
|
|
tryload() (Bool) |
3033
|
|
|
|
|
|
|
|
3034
|
|
|
|
|
|
|
The tryload method attempt to C the represented package using the |
3035
|
|
|
|
|
|
|
L method and returns truthy/falsy based on whether the package was |
3036
|
|
|
|
|
|
|
loaded. |
3037
|
|
|
|
|
|
|
|
3038
|
|
|
|
|
|
|
I> |
3039
|
|
|
|
|
|
|
|
3040
|
|
|
|
|
|
|
=over 4 |
3041
|
|
|
|
|
|
|
|
3042
|
|
|
|
|
|
|
=item tryload example 1 |
3043
|
|
|
|
|
|
|
|
3044
|
|
|
|
|
|
|
package main; |
3045
|
|
|
|
|
|
|
|
3046
|
|
|
|
|
|
|
use Venus::Space; |
3047
|
|
|
|
|
|
|
|
3048
|
|
|
|
|
|
|
my $space = Venus::Space->new('c_p_a_n'); |
3049
|
|
|
|
|
|
|
|
3050
|
|
|
|
|
|
|
my $tryload = $space->tryload; |
3051
|
|
|
|
|
|
|
|
3052
|
|
|
|
|
|
|
# 1 |
3053
|
|
|
|
|
|
|
|
3054
|
|
|
|
|
|
|
=back |
3055
|
|
|
|
|
|
|
|
3056
|
|
|
|
|
|
|
=over 4 |
3057
|
|
|
|
|
|
|
|
3058
|
|
|
|
|
|
|
=item tryload example 2 |
3059
|
|
|
|
|
|
|
|
3060
|
|
|
|
|
|
|
package main; |
3061
|
|
|
|
|
|
|
|
3062
|
|
|
|
|
|
|
use Venus::Space; |
3063
|
|
|
|
|
|
|
|
3064
|
|
|
|
|
|
|
my $space = Venus::Space->new('n_a_p_c'); |
3065
|
|
|
|
|
|
|
|
3066
|
|
|
|
|
|
|
my $tryload = $space->tryload; |
3067
|
|
|
|
|
|
|
|
3068
|
|
|
|
|
|
|
# 0 |
3069
|
|
|
|
|
|
|
|
3070
|
|
|
|
|
|
|
=back |
3071
|
|
|
|
|
|
|
|
3072
|
|
|
|
|
|
|
=cut |
3073
|
|
|
|
|
|
|
|
3074
|
|
|
|
|
|
|
=head2 unload |
3075
|
|
|
|
|
|
|
|
3076
|
|
|
|
|
|
|
unload() (Self) |
3077
|
|
|
|
|
|
|
|
3078
|
|
|
|
|
|
|
The unload method unloads a package space by nullifying its symbol table and |
3079
|
|
|
|
|
|
|
removing it from C<%INC>. |
3080
|
|
|
|
|
|
|
|
3081
|
|
|
|
|
|
|
I> |
3082
|
|
|
|
|
|
|
|
3083
|
|
|
|
|
|
|
=over 4 |
3084
|
|
|
|
|
|
|
|
3085
|
|
|
|
|
|
|
=item unload example 1 |
3086
|
|
|
|
|
|
|
|
3087
|
|
|
|
|
|
|
package main; |
3088
|
|
|
|
|
|
|
|
3089
|
|
|
|
|
|
|
use Venus::Space; |
3090
|
|
|
|
|
|
|
|
3091
|
|
|
|
|
|
|
# Bar::Gen is generated with $VERSION as 0.01 |
3092
|
|
|
|
|
|
|
|
3093
|
|
|
|
|
|
|
my $space = Venus::Space->new('Bar/Gen'); |
3094
|
|
|
|
|
|
|
|
3095
|
|
|
|
|
|
|
$space->load; |
3096
|
|
|
|
|
|
|
|
3097
|
|
|
|
|
|
|
my $unload = $space->unload; |
3098
|
|
|
|
|
|
|
|
3099
|
|
|
|
|
|
|
# bless({ value => "Bar::Gen" }, "Venus::Space") |
3100
|
|
|
|
|
|
|
|
3101
|
|
|
|
|
|
|
# Bar::Gen->VERSION was 0.01, now undef |
3102
|
|
|
|
|
|
|
|
3103
|
|
|
|
|
|
|
# Symbol table remains, $space->visible is 1 |
3104
|
|
|
|
|
|
|
|
3105
|
|
|
|
|
|
|
=back |
3106
|
|
|
|
|
|
|
|
3107
|
|
|
|
|
|
|
=cut |
3108
|
|
|
|
|
|
|
|
3109
|
|
|
|
|
|
|
=head2 use |
3110
|
|
|
|
|
|
|
|
3111
|
|
|
|
|
|
|
use(Str | Tuple[Str, Str] $target, Any @params) (Space) |
3112
|
|
|
|
|
|
|
|
3113
|
|
|
|
|
|
|
The use method executes a C |
3114
|
|
|
|
|
|
|
specified. |
3115
|
|
|
|
|
|
|
|
3116
|
|
|
|
|
|
|
I> |
3117
|
|
|
|
|
|
|
|
3118
|
|
|
|
|
|
|
=over 4 |
3119
|
|
|
|
|
|
|
|
3120
|
|
|
|
|
|
|
=item use example 1 |
3121
|
|
|
|
|
|
|
|
3122
|
|
|
|
|
|
|
package main; |
3123
|
|
|
|
|
|
|
|
3124
|
|
|
|
|
|
|
use Venus::Space; |
3125
|
|
|
|
|
|
|
|
3126
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/goo'); |
3127
|
|
|
|
|
|
|
|
3128
|
|
|
|
|
|
|
my $use = $space->use('Venus'); |
3129
|
|
|
|
|
|
|
|
3130
|
|
|
|
|
|
|
# bless({ value => "foo/goo" }, "Venus::Space") |
3131
|
|
|
|
|
|
|
|
3132
|
|
|
|
|
|
|
=back |
3133
|
|
|
|
|
|
|
|
3134
|
|
|
|
|
|
|
=over 4 |
3135
|
|
|
|
|
|
|
|
3136
|
|
|
|
|
|
|
=item use example 2 |
3137
|
|
|
|
|
|
|
|
3138
|
|
|
|
|
|
|
package main; |
3139
|
|
|
|
|
|
|
|
3140
|
|
|
|
|
|
|
use Venus::Space; |
3141
|
|
|
|
|
|
|
|
3142
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/hoo'); |
3143
|
|
|
|
|
|
|
|
3144
|
|
|
|
|
|
|
my $use = $space->use('Venus', 'error'); |
3145
|
|
|
|
|
|
|
|
3146
|
|
|
|
|
|
|
# bless({ value => "foo/hoo" }, "Venus::Space") |
3147
|
|
|
|
|
|
|
|
3148
|
|
|
|
|
|
|
=back |
3149
|
|
|
|
|
|
|
|
3150
|
|
|
|
|
|
|
=over 4 |
3151
|
|
|
|
|
|
|
|
3152
|
|
|
|
|
|
|
=item use example 3 |
3153
|
|
|
|
|
|
|
|
3154
|
|
|
|
|
|
|
package main; |
3155
|
|
|
|
|
|
|
|
3156
|
|
|
|
|
|
|
use Venus::Space; |
3157
|
|
|
|
|
|
|
|
3158
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/foo'); |
3159
|
|
|
|
|
|
|
|
3160
|
|
|
|
|
|
|
my $use = $space->use(['Venus', 9.99], 'error'); |
3161
|
|
|
|
|
|
|
|
3162
|
|
|
|
|
|
|
=back |
3163
|
|
|
|
|
|
|
|
3164
|
|
|
|
|
|
|
=cut |
3165
|
|
|
|
|
|
|
|
3166
|
|
|
|
|
|
|
=head2 variables |
3167
|
|
|
|
|
|
|
|
3168
|
|
|
|
|
|
|
variables() (ArrayRef[Tuple[Str, ArrayRef]]) |
3169
|
|
|
|
|
|
|
|
3170
|
|
|
|
|
|
|
The variables method searches the package namespace for variables and returns |
3171
|
|
|
|
|
|
|
their names. |
3172
|
|
|
|
|
|
|
|
3173
|
|
|
|
|
|
|
I> |
3174
|
|
|
|
|
|
|
|
3175
|
|
|
|
|
|
|
=over 4 |
3176
|
|
|
|
|
|
|
|
3177
|
|
|
|
|
|
|
=item variables example 1 |
3178
|
|
|
|
|
|
|
|
3179
|
|
|
|
|
|
|
package Etc; |
3180
|
|
|
|
|
|
|
|
3181
|
|
|
|
|
|
|
our $init = 0; |
3182
|
|
|
|
|
|
|
our $func = 1; |
3183
|
|
|
|
|
|
|
|
3184
|
|
|
|
|
|
|
our @does = (1..4); |
3185
|
|
|
|
|
|
|
our %sets = (1..4); |
3186
|
|
|
|
|
|
|
|
3187
|
|
|
|
|
|
|
package main; |
3188
|
|
|
|
|
|
|
|
3189
|
|
|
|
|
|
|
use Venus::Space; |
3190
|
|
|
|
|
|
|
|
3191
|
|
|
|
|
|
|
my $space = Venus::Space->new('etc'); |
3192
|
|
|
|
|
|
|
|
3193
|
|
|
|
|
|
|
my $variables = $space->variables; |
3194
|
|
|
|
|
|
|
|
3195
|
|
|
|
|
|
|
# [ |
3196
|
|
|
|
|
|
|
# ["arrays", ["does"]], |
3197
|
|
|
|
|
|
|
# ["hashes", ["sets"]], |
3198
|
|
|
|
|
|
|
# ["scalars", ["func", "init"]], |
3199
|
|
|
|
|
|
|
# ] |
3200
|
|
|
|
|
|
|
|
3201
|
|
|
|
|
|
|
=back |
3202
|
|
|
|
|
|
|
|
3203
|
|
|
|
|
|
|
=cut |
3204
|
|
|
|
|
|
|
|
3205
|
|
|
|
|
|
|
=head2 version |
3206
|
|
|
|
|
|
|
|
3207
|
|
|
|
|
|
|
version() (Maybe[Str]) |
3208
|
|
|
|
|
|
|
|
3209
|
|
|
|
|
|
|
The version method returns the C declared on the target package, if |
3210
|
|
|
|
|
|
|
any. |
3211
|
|
|
|
|
|
|
|
3212
|
|
|
|
|
|
|
I> |
3213
|
|
|
|
|
|
|
|
3214
|
|
|
|
|
|
|
=over 4 |
3215
|
|
|
|
|
|
|
|
3216
|
|
|
|
|
|
|
=item version example 1 |
3217
|
|
|
|
|
|
|
|
3218
|
|
|
|
|
|
|
package Foo::Boo; |
3219
|
|
|
|
|
|
|
|
3220
|
|
|
|
|
|
|
sub import; |
3221
|
|
|
|
|
|
|
|
3222
|
|
|
|
|
|
|
package main; |
3223
|
|
|
|
|
|
|
|
3224
|
|
|
|
|
|
|
use Venus::Space; |
3225
|
|
|
|
|
|
|
|
3226
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/boo'); |
3227
|
|
|
|
|
|
|
|
3228
|
|
|
|
|
|
|
my $version = $space->version; |
3229
|
|
|
|
|
|
|
|
3230
|
|
|
|
|
|
|
# undef |
3231
|
|
|
|
|
|
|
|
3232
|
|
|
|
|
|
|
=back |
3233
|
|
|
|
|
|
|
|
3234
|
|
|
|
|
|
|
=over 4 |
3235
|
|
|
|
|
|
|
|
3236
|
|
|
|
|
|
|
=item version example 2 |
3237
|
|
|
|
|
|
|
|
3238
|
|
|
|
|
|
|
package Foo::Boo; |
3239
|
|
|
|
|
|
|
|
3240
|
|
|
|
|
|
|
our $VERSION = 0.01; |
3241
|
|
|
|
|
|
|
|
3242
|
|
|
|
|
|
|
package main; |
3243
|
|
|
|
|
|
|
|
3244
|
|
|
|
|
|
|
use Venus::Space; |
3245
|
|
|
|
|
|
|
|
3246
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/boo'); |
3247
|
|
|
|
|
|
|
|
3248
|
|
|
|
|
|
|
my $version = $space->version; |
3249
|
|
|
|
|
|
|
|
3250
|
|
|
|
|
|
|
# 0.01 |
3251
|
|
|
|
|
|
|
|
3252
|
|
|
|
|
|
|
=back |
3253
|
|
|
|
|
|
|
|
3254
|
|
|
|
|
|
|
=cut |
3255
|
|
|
|
|
|
|
|
3256
|
|
|
|
|
|
|
=head2 visible |
3257
|
|
|
|
|
|
|
|
3258
|
|
|
|
|
|
|
visible() (Bool) |
3259
|
|
|
|
|
|
|
|
3260
|
|
|
|
|
|
|
The visible method returns truthy is the package namespace is visible, i.e. has |
3261
|
|
|
|
|
|
|
symbols defined. |
3262
|
|
|
|
|
|
|
|
3263
|
|
|
|
|
|
|
I> |
3264
|
|
|
|
|
|
|
|
3265
|
|
|
|
|
|
|
=over 4 |
3266
|
|
|
|
|
|
|
|
3267
|
|
|
|
|
|
|
=item visible example 1 |
3268
|
|
|
|
|
|
|
|
3269
|
|
|
|
|
|
|
# given: synopsis |
3270
|
|
|
|
|
|
|
|
3271
|
|
|
|
|
|
|
package main; |
3272
|
|
|
|
|
|
|
|
3273
|
|
|
|
|
|
|
my $visible = $space->visible; |
3274
|
|
|
|
|
|
|
|
3275
|
|
|
|
|
|
|
# 1 |
3276
|
|
|
|
|
|
|
|
3277
|
|
|
|
|
|
|
=back |
3278
|
|
|
|
|
|
|
|
3279
|
|
|
|
|
|
|
=over 4 |
3280
|
|
|
|
|
|
|
|
3281
|
|
|
|
|
|
|
=item visible example 2 |
3282
|
|
|
|
|
|
|
|
3283
|
|
|
|
|
|
|
package Foo::Fe; |
3284
|
|
|
|
|
|
|
|
3285
|
|
|
|
|
|
|
package main; |
3286
|
|
|
|
|
|
|
|
3287
|
|
|
|
|
|
|
use Venus::Space; |
3288
|
|
|
|
|
|
|
|
3289
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/fe'); |
3290
|
|
|
|
|
|
|
|
3291
|
|
|
|
|
|
|
my $visible = $space->visible; |
3292
|
|
|
|
|
|
|
|
3293
|
|
|
|
|
|
|
# 0 |
3294
|
|
|
|
|
|
|
|
3295
|
|
|
|
|
|
|
=back |
3296
|
|
|
|
|
|
|
|
3297
|
|
|
|
|
|
|
=over 4 |
3298
|
|
|
|
|
|
|
|
3299
|
|
|
|
|
|
|
=item visible example 3 |
3300
|
|
|
|
|
|
|
|
3301
|
|
|
|
|
|
|
package Foo::Fe; |
3302
|
|
|
|
|
|
|
|
3303
|
|
|
|
|
|
|
our $VERSION = 0.01; |
3304
|
|
|
|
|
|
|
|
3305
|
|
|
|
|
|
|
package main; |
3306
|
|
|
|
|
|
|
|
3307
|
|
|
|
|
|
|
use Venus::Space; |
3308
|
|
|
|
|
|
|
|
3309
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/fe'); |
3310
|
|
|
|
|
|
|
|
3311
|
|
|
|
|
|
|
my $visible = $space->visible; |
3312
|
|
|
|
|
|
|
|
3313
|
|
|
|
|
|
|
# 1 |
3314
|
|
|
|
|
|
|
|
3315
|
|
|
|
|
|
|
=back |
3316
|
|
|
|
|
|
|
|
3317
|
|
|
|
|
|
|
=over 4 |
3318
|
|
|
|
|
|
|
|
3319
|
|
|
|
|
|
|
=item visible example 4 |
3320
|
|
|
|
|
|
|
|
3321
|
|
|
|
|
|
|
package Foo::Fi; |
3322
|
|
|
|
|
|
|
|
3323
|
|
|
|
|
|
|
sub import; |
3324
|
|
|
|
|
|
|
|
3325
|
|
|
|
|
|
|
package main; |
3326
|
|
|
|
|
|
|
|
3327
|
|
|
|
|
|
|
use Venus::Space; |
3328
|
|
|
|
|
|
|
|
3329
|
|
|
|
|
|
|
my $space = Venus::Space->new('foo/fi'); |
3330
|
|
|
|
|
|
|
|
3331
|
|
|
|
|
|
|
my $visible = $space->visible; |
3332
|
|
|
|
|
|
|
|
3333
|
|
|
|
|
|
|
# 1 |
3334
|
|
|
|
|
|
|
|
3335
|
|
|
|
|
|
|
=back |
3336
|
|
|
|
|
|
|
|
3337
|
|
|
|
|
|
|
=cut |
3338
|
|
|
|
|
|
|
|
3339
|
|
|
|
|
|
|
=head1 ERRORS |
3340
|
|
|
|
|
|
|
|
3341
|
|
|
|
|
|
|
This package may raise the following errors: |
3342
|
|
|
|
|
|
|
|
3343
|
|
|
|
|
|
|
=cut |
3344
|
|
|
|
|
|
|
|
3345
|
|
|
|
|
|
|
=over 4 |
3346
|
|
|
|
|
|
|
|
3347
|
|
|
|
|
|
|
=item error: C |
3348
|
|
|
|
|
|
|
|
3349
|
|
|
|
|
|
|
This package may raise an error_on_call_missing exception. |
3350
|
|
|
|
|
|
|
|
3351
|
|
|
|
|
|
|
B |
3352
|
|
|
|
|
|
|
|
3353
|
|
|
|
|
|
|
# given: synopsis; |
3354
|
|
|
|
|
|
|
|
3355
|
|
|
|
|
|
|
my $input = { |
3356
|
|
|
|
|
|
|
throw => 'error_on_call_missing', |
3357
|
|
|
|
|
|
|
package => 'Example', |
3358
|
|
|
|
|
|
|
routine => 'execute', |
3359
|
|
|
|
|
|
|
}; |
3360
|
|
|
|
|
|
|
|
3361
|
|
|
|
|
|
|
my $error = $space->catch('error', $input); |
3362
|
|
|
|
|
|
|
|
3363
|
|
|
|
|
|
|
# my $name = $error->name; |
3364
|
|
|
|
|
|
|
|
3365
|
|
|
|
|
|
|
# "on_call_missing" |
3366
|
|
|
|
|
|
|
|
3367
|
|
|
|
|
|
|
# my $message = $error->render; |
3368
|
|
|
|
|
|
|
|
3369
|
|
|
|
|
|
|
# "Unable to locate class method \"execute\" via package \"Example\"" |
3370
|
|
|
|
|
|
|
|
3371
|
|
|
|
|
|
|
# my $package = $error->stash('package'); |
3372
|
|
|
|
|
|
|
|
3373
|
|
|
|
|
|
|
# "Example" |
3374
|
|
|
|
|
|
|
|
3375
|
|
|
|
|
|
|
# my $routine = $error->stash('routine'); |
3376
|
|
|
|
|
|
|
|
3377
|
|
|
|
|
|
|
# "execute" |
3378
|
|
|
|
|
|
|
|
3379
|
|
|
|
|
|
|
=back |
3380
|
|
|
|
|
|
|
|
3381
|
|
|
|
|
|
|
=over 4 |
3382
|
|
|
|
|
|
|
|
3383
|
|
|
|
|
|
|
=item error: C |
3384
|
|
|
|
|
|
|
|
3385
|
|
|
|
|
|
|
This package may raise an error_on_call_undefined exception. |
3386
|
|
|
|
|
|
|
|
3387
|
|
|
|
|
|
|
B |
3388
|
|
|
|
|
|
|
|
3389
|
|
|
|
|
|
|
# given: synopsis; |
3390
|
|
|
|
|
|
|
|
3391
|
|
|
|
|
|
|
my $input = { |
3392
|
|
|
|
|
|
|
throw => 'error_on_call_undefined', |
3393
|
|
|
|
|
|
|
package => 'Example', |
3394
|
|
|
|
|
|
|
routine => 'execute', |
3395
|
|
|
|
|
|
|
}; |
3396
|
|
|
|
|
|
|
|
3397
|
|
|
|
|
|
|
my $error = $space->catch('error', $input); |
3398
|
|
|
|
|
|
|
|
3399
|
|
|
|
|
|
|
# my $name = $error->name; |
3400
|
|
|
|
|
|
|
|
3401
|
|
|
|
|
|
|
# "on_call_undefined" |
3402
|
|
|
|
|
|
|
|
3403
|
|
|
|
|
|
|
# my $message = $error->render; |
3404
|
|
|
|
|
|
|
|
3405
|
|
|
|
|
|
|
# "Attempt to call undefined class method in package \"Example\"" |
3406
|
|
|
|
|
|
|
|
3407
|
|
|
|
|
|
|
# my $package = $error->stash('package'); |
3408
|
|
|
|
|
|
|
|
3409
|
|
|
|
|
|
|
# "Example" |
3410
|
|
|
|
|
|
|
|
3411
|
|
|
|
|
|
|
# my $routine = $error->stash('routine'); |
3412
|
|
|
|
|
|
|
|
3413
|
|
|
|
|
|
|
# "execute" |
3414
|
|
|
|
|
|
|
|
3415
|
|
|
|
|
|
|
=back |
3416
|
|
|
|
|
|
|
|
3417
|
|
|
|
|
|
|
=over 4 |
3418
|
|
|
|
|
|
|
|
3419
|
|
|
|
|
|
|
=item error: C |
3420
|
|
|
|
|
|
|
|
3421
|
|
|
|
|
|
|
This package may raise an error_on_cop_missing exception. |
3422
|
|
|
|
|
|
|
|
3423
|
|
|
|
|
|
|
B |
3424
|
|
|
|
|
|
|
|
3425
|
|
|
|
|
|
|
# given: synopsis; |
3426
|
|
|
|
|
|
|
|
3427
|
|
|
|
|
|
|
my $input = { |
3428
|
|
|
|
|
|
|
throw => 'error_on_cop_missing', |
3429
|
|
|
|
|
|
|
package => 'Example', |
3430
|
|
|
|
|
|
|
routine => 'execute', |
3431
|
|
|
|
|
|
|
}; |
3432
|
|
|
|
|
|
|
|
3433
|
|
|
|
|
|
|
my $error = $space->catch('error', $input); |
3434
|
|
|
|
|
|
|
|
3435
|
|
|
|
|
|
|
# my $name = $error->name; |
3436
|
|
|
|
|
|
|
|
3437
|
|
|
|
|
|
|
# "on_cop_missing" |
3438
|
|
|
|
|
|
|
|
3439
|
|
|
|
|
|
|
# my $message = $error->render; |
3440
|
|
|
|
|
|
|
|
3441
|
|
|
|
|
|
|
# "Unable to locate object method \"execute\" via package \"Example\"" |
3442
|
|
|
|
|
|
|
|
3443
|
|
|
|
|
|
|
# my $package = $error->stash('package'); |
3444
|
|
|
|
|
|
|
|
3445
|
|
|
|
|
|
|
# "Example" |
3446
|
|
|
|
|
|
|
|
3447
|
|
|
|
|
|
|
# my $routine = $error->stash('routine'); |
3448
|
|
|
|
|
|
|
|
3449
|
|
|
|
|
|
|
# "execute" |
3450
|
|
|
|
|
|
|
|
3451
|
|
|
|
|
|
|
=back |
3452
|
|
|
|
|
|
|
|
3453
|
|
|
|
|
|
|
=over 4 |
3454
|
|
|
|
|
|
|
|
3455
|
|
|
|
|
|
|
=item error: C |
3456
|
|
|
|
|
|
|
|
3457
|
|
|
|
|
|
|
This package may raise an error_on_cop_undefined exception. |
3458
|
|
|
|
|
|
|
|
3459
|
|
|
|
|
|
|
B |
3460
|
|
|
|
|
|
|
|
3461
|
|
|
|
|
|
|
# given: synopsis; |
3462
|
|
|
|
|
|
|
|
3463
|
|
|
|
|
|
|
my $input = { |
3464
|
|
|
|
|
|
|
throw => 'error_on_cop_undefined', |
3465
|
|
|
|
|
|
|
package => 'Example', |
3466
|
|
|
|
|
|
|
routine => 'execute', |
3467
|
|
|
|
|
|
|
}; |
3468
|
|
|
|
|
|
|
|
3469
|
|
|
|
|
|
|
my $error = $space->catch('error', $input); |
3470
|
|
|
|
|
|
|
|
3471
|
|
|
|
|
|
|
# my $name = $error->name; |
3472
|
|
|
|
|
|
|
|
3473
|
|
|
|
|
|
|
# "on_cop_undefined" |
3474
|
|
|
|
|
|
|
|
3475
|
|
|
|
|
|
|
# my $message = $error->render; |
3476
|
|
|
|
|
|
|
|
3477
|
|
|
|
|
|
|
# "Attempt to cop undefined object method from package \"$class\"" |
3478
|
|
|
|
|
|
|
|
3479
|
|
|
|
|
|
|
# my $package = $error->stash('package'); |
3480
|
|
|
|
|
|
|
|
3481
|
|
|
|
|
|
|
# "Example" |
3482
|
|
|
|
|
|
|
|
3483
|
|
|
|
|
|
|
# my $routine = $error->stash('routine'); |
3484
|
|
|
|
|
|
|
|
3485
|
|
|
|
|
|
|
# "execute" |
3486
|
|
|
|
|
|
|
|
3487
|
|
|
|
|
|
|
=back |
3488
|
|
|
|
|
|
|
|
3489
|
|
|
|
|
|
|
=over 4 |
3490
|
|
|
|
|
|
|
|
3491
|
|
|
|
|
|
|
=item error: C |
3492
|
|
|
|
|
|
|
|
3493
|
|
|
|
|
|
|
This package may raise an error_on_eval exception. |
3494
|
|
|
|
|
|
|
|
3495
|
|
|
|
|
|
|
B |
3496
|
|
|
|
|
|
|
|
3497
|
|
|
|
|
|
|
# given: synopsis; |
3498
|
|
|
|
|
|
|
|
3499
|
|
|
|
|
|
|
my $input = { |
3500
|
|
|
|
|
|
|
throw => 'error_on_eval', |
3501
|
|
|
|
|
|
|
error => 'Exception!', |
3502
|
|
|
|
|
|
|
package => 'Example', |
3503
|
|
|
|
|
|
|
}; |
3504
|
|
|
|
|
|
|
|
3505
|
|
|
|
|
|
|
my $error = $space->catch('error', $input); |
3506
|
|
|
|
|
|
|
|
3507
|
|
|
|
|
|
|
# my $name = $error->name; |
3508
|
|
|
|
|
|
|
|
3509
|
|
|
|
|
|
|
# "on_eval" |
3510
|
|
|
|
|
|
|
|
3511
|
|
|
|
|
|
|
# my $message = $error->render; |
3512
|
|
|
|
|
|
|
|
3513
|
|
|
|
|
|
|
# "Exception!" |
3514
|
|
|
|
|
|
|
|
3515
|
|
|
|
|
|
|
# my $package = $error->stash('package'); |
3516
|
|
|
|
|
|
|
|
3517
|
|
|
|
|
|
|
# "Example" |
3518
|
|
|
|
|
|
|
|
3519
|
|
|
|
|
|
|
=back |
3520
|
|
|
|
|
|
|
|
3521
|
|
|
|
|
|
|
=over 4 |
3522
|
|
|
|
|
|
|
|
3523
|
|
|
|
|
|
|
=item error: C |
3524
|
|
|
|
|
|
|
|
3525
|
|
|
|
|
|
|
This package may raise an error_on_load exception. |
3526
|
|
|
|
|
|
|
|
3527
|
|
|
|
|
|
|
B |
3528
|
|
|
|
|
|
|
|
3529
|
|
|
|
|
|
|
# given: synopsis; |
3530
|
|
|
|
|
|
|
|
3531
|
|
|
|
|
|
|
my $input = { |
3532
|
|
|
|
|
|
|
throw => 'error_on_load', |
3533
|
|
|
|
|
|
|
package => 'Example', |
3534
|
|
|
|
|
|
|
error => 'cause unknown', |
3535
|
|
|
|
|
|
|
}; |
3536
|
|
|
|
|
|
|
|
3537
|
|
|
|
|
|
|
my $error = $space->catch('error', $input); |
3538
|
|
|
|
|
|
|
|
3539
|
|
|
|
|
|
|
# my $name = $error->name; |
3540
|
|
|
|
|
|
|
|
3541
|
|
|
|
|
|
|
# "on_load" |
3542
|
|
|
|
|
|
|
|
3543
|
|
|
|
|
|
|
# my $message = $error->render; |
3544
|
|
|
|
|
|
|
|
3545
|
|
|
|
|
|
|
# "Error attempting to load Example: \"cause unknown\"" |
3546
|
|
|
|
|
|
|
|
3547
|
|
|
|
|
|
|
# my $package = $error->stash('package'); |
3548
|
|
|
|
|
|
|
|
3549
|
|
|
|
|
|
|
# "Example" |
3550
|
|
|
|
|
|
|
|
3551
|
|
|
|
|
|
|
=back |
3552
|
|
|
|
|
|
|
|
3553
|
|
|
|
|
|
|
=over 4 |
3554
|
|
|
|
|
|
|
|
3555
|
|
|
|
|
|
|
=item error: C |
3556
|
|
|
|
|
|
|
|
3557
|
|
|
|
|
|
|
This package may raise an error_on_swap exception. |
3558
|
|
|
|
|
|
|
|
3559
|
|
|
|
|
|
|
B |
3560
|
|
|
|
|
|
|
|
3561
|
|
|
|
|
|
|
# given: synopsis; |
3562
|
|
|
|
|
|
|
|
3563
|
|
|
|
|
|
|
my $input = { |
3564
|
|
|
|
|
|
|
throw => 'error_on_swap', |
3565
|
|
|
|
|
|
|
package => 'Example', |
3566
|
|
|
|
|
|
|
routine => 'execute', |
3567
|
|
|
|
|
|
|
}; |
3568
|
|
|
|
|
|
|
|
3569
|
|
|
|
|
|
|
my $error = $space->catch('error', $input); |
3570
|
|
|
|
|
|
|
|
3571
|
|
|
|
|
|
|
# my $name = $error->name; |
3572
|
|
|
|
|
|
|
|
3573
|
|
|
|
|
|
|
# "on_swap" |
3574
|
|
|
|
|
|
|
|
3575
|
|
|
|
|
|
|
# my $message = $error->render; |
3576
|
|
|
|
|
|
|
|
3577
|
|
|
|
|
|
|
# "Attempt to swap undefined subroutine in package \"$class\"" |
3578
|
|
|
|
|
|
|
|
3579
|
|
|
|
|
|
|
# my $package = $error->stash('package'); |
3580
|
|
|
|
|
|
|
|
3581
|
|
|
|
|
|
|
# "Example" |
3582
|
|
|
|
|
|
|
|
3583
|
|
|
|
|
|
|
# my $routine = $error->stash('routine'); |
3584
|
|
|
|
|
|
|
|
3585
|
|
|
|
|
|
|
# "execute" |
3586
|
|
|
|
|
|
|
|
3587
|
|
|
|
|
|
|
=back |
3588
|
|
|
|
|
|
|
|
3589
|
|
|
|
|
|
|
=head1 AUTHORS |
3590
|
|
|
|
|
|
|
|
3591
|
|
|
|
|
|
|
Awncorp, C |
3592
|
|
|
|
|
|
|
|
3593
|
|
|
|
|
|
|
=cut |
3594
|
|
|
|
|
|
|
|
3595
|
|
|
|
|
|
|
=head1 LICENSE |
3596
|
|
|
|
|
|
|
|
3597
|
|
|
|
|
|
|
Copyright (C) 2000, Al Newkirk. |
3598
|
|
|
|
|
|
|
|
3599
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
3600
|
|
|
|
|
|
|
the terms of the Apache license version 2.0. |
3601
|
|
|
|
|
|
|
|
3602
|
|
|
|
|
|
|
=cut |