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