line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Venus; |
2
|
|
|
|
|
|
|
|
3
|
87
|
|
|
87
|
|
1428
|
use 5.018; |
|
87
|
|
|
|
|
276
|
|
4
|
|
|
|
|
|
|
|
5
|
87
|
|
|
87
|
|
505
|
use strict; |
|
87
|
|
|
|
|
171
|
|
|
87
|
|
|
|
|
1809
|
|
6
|
87
|
|
|
87
|
|
432
|
use warnings; |
|
87
|
|
|
|
|
231
|
|
|
87
|
|
|
|
|
7174
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# VERSION |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '3.55'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# AUTHORITY |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:AWNCORP'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# IMPORTS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub import { |
19
|
97
|
|
|
97
|
|
846
|
my ($self, @args) = @_; |
20
|
|
|
|
|
|
|
|
21
|
97
|
|
|
|
|
293
|
my $target = caller; |
22
|
|
|
|
|
|
|
|
23
|
87
|
|
|
87
|
|
576
|
no strict 'refs'; |
|
87
|
|
|
|
|
200
|
|
|
87
|
|
|
|
|
91871
|
|
24
|
|
|
|
|
|
|
|
25
|
97
|
|
|
|
|
2871
|
my %exports = ( |
26
|
|
|
|
|
|
|
args => 1, |
27
|
|
|
|
|
|
|
array => 1, |
28
|
|
|
|
|
|
|
arrayref => 1, |
29
|
|
|
|
|
|
|
assert => 1, |
30
|
|
|
|
|
|
|
async => 1, |
31
|
|
|
|
|
|
|
await => 1, |
32
|
|
|
|
|
|
|
bool => 1, |
33
|
|
|
|
|
|
|
box => 1, |
34
|
|
|
|
|
|
|
call => 1, |
35
|
|
|
|
|
|
|
cast => 1, |
36
|
|
|
|
|
|
|
catch => 1, |
37
|
|
|
|
|
|
|
caught => 1, |
38
|
|
|
|
|
|
|
chain => 1, |
39
|
|
|
|
|
|
|
check => 1, |
40
|
|
|
|
|
|
|
clargs => 1, |
41
|
|
|
|
|
|
|
cli => 1, |
42
|
|
|
|
|
|
|
code => 1, |
43
|
|
|
|
|
|
|
config => 1, |
44
|
|
|
|
|
|
|
container => 1, |
45
|
|
|
|
|
|
|
cop => 1, |
46
|
|
|
|
|
|
|
data => 1, |
47
|
|
|
|
|
|
|
date => 1, |
48
|
|
|
|
|
|
|
docs => 1, |
49
|
|
|
|
|
|
|
error => 1, |
50
|
|
|
|
|
|
|
false => 1, |
51
|
|
|
|
|
|
|
fault => 1, |
52
|
|
|
|
|
|
|
float => 1, |
53
|
|
|
|
|
|
|
gather => 1, |
54
|
|
|
|
|
|
|
hash => 1, |
55
|
|
|
|
|
|
|
hashref => 1, |
56
|
|
|
|
|
|
|
is_bool => 1, |
57
|
|
|
|
|
|
|
is_false => 1, |
58
|
|
|
|
|
|
|
is_true => 1, |
59
|
|
|
|
|
|
|
json => 1, |
60
|
|
|
|
|
|
|
list => 1, |
61
|
|
|
|
|
|
|
load => 1, |
62
|
|
|
|
|
|
|
log => 1, |
63
|
|
|
|
|
|
|
make => 1, |
64
|
|
|
|
|
|
|
match => 1, |
65
|
|
|
|
|
|
|
merge => 1, |
66
|
|
|
|
|
|
|
meta => 1, |
67
|
|
|
|
|
|
|
name => 1, |
68
|
|
|
|
|
|
|
number => 1, |
69
|
|
|
|
|
|
|
opts => 1, |
70
|
|
|
|
|
|
|
pairs => 1, |
71
|
|
|
|
|
|
|
path => 1, |
72
|
|
|
|
|
|
|
perl => 1, |
73
|
|
|
|
|
|
|
process => 1, |
74
|
|
|
|
|
|
|
proto => 1, |
75
|
|
|
|
|
|
|
puts => 1, |
76
|
|
|
|
|
|
|
raise => 1, |
77
|
|
|
|
|
|
|
random => 1, |
78
|
|
|
|
|
|
|
range => 1, |
79
|
|
|
|
|
|
|
regexp => 1, |
80
|
|
|
|
|
|
|
replace => 1, |
81
|
|
|
|
|
|
|
render => 1, |
82
|
|
|
|
|
|
|
resolve => 1, |
83
|
|
|
|
|
|
|
roll => 1, |
84
|
|
|
|
|
|
|
search => 1, |
85
|
|
|
|
|
|
|
space => 1, |
86
|
|
|
|
|
|
|
schema => 1, |
87
|
|
|
|
|
|
|
string => 1, |
88
|
|
|
|
|
|
|
syscall => 1, |
89
|
|
|
|
|
|
|
template => 1, |
90
|
|
|
|
|
|
|
test => 1, |
91
|
|
|
|
|
|
|
text => 1, |
92
|
|
|
|
|
|
|
then => 1, |
93
|
|
|
|
|
|
|
throw => 1, |
94
|
|
|
|
|
|
|
true => 1, |
95
|
|
|
|
|
|
|
try => 1, |
96
|
|
|
|
|
|
|
type => 1, |
97
|
|
|
|
|
|
|
unpack => 1, |
98
|
|
|
|
|
|
|
vars => 1, |
99
|
|
|
|
|
|
|
venus => 1, |
100
|
|
|
|
|
|
|
work => 1, |
101
|
|
|
|
|
|
|
wrap => 1, |
102
|
|
|
|
|
|
|
yaml => 1, |
103
|
|
|
|
|
|
|
); |
104
|
|
|
|
|
|
|
|
105
|
97
|
|
33
|
|
|
455
|
@args = grep defined && !ref && /^[A-Za-z]/ && $exports{$_}, @args; |
106
|
|
|
|
|
|
|
|
107
|
97
|
|
|
|
|
208
|
my %seen; |
108
|
97
|
|
|
|
|
618
|
for my $name (grep !$seen{$_}++, @args, 'true', 'false') { |
109
|
203
|
100
|
|
|
|
2216
|
*{"${target}::${name}"} = $self->can($name) if !$target->can($name); |
|
199
|
|
|
|
|
854
|
|
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
97
|
|
|
|
|
33386
|
return $self; |
113
|
|
|
|
|
|
|
} |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
# HOOKS |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub _qx { |
118
|
0
|
|
|
0
|
|
0
|
my (@args) = @_; |
119
|
0
|
|
|
|
|
0
|
local $| = 1; |
120
|
0
|
|
|
0
|
|
0
|
local $SIG{__WARN__} = sub {}; |
121
|
0
|
0
|
|
|
|
0
|
(do{local $_ = qx(@{[@args]}); chomp if $_; $_}, $?, ($? >> 8)) |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# FUNCTIONS |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub args ($;$@) { |
127
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
128
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
0
|
require Venus::Args; |
130
|
|
|
|
|
|
|
|
131
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
132
|
0
|
|
|
|
|
0
|
return Venus::Args->new($data); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
0
|
|
|
|
|
0
|
return Venus::Args->new($data)->$code(@args); |
136
|
|
|
|
|
|
|
} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
sub array ($;$@) { |
139
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
140
|
|
|
|
|
|
|
|
141
|
0
|
|
|
|
|
0
|
require Venus::Array; |
142
|
|
|
|
|
|
|
|
143
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
144
|
0
|
|
|
|
|
0
|
return Venus::Array->new($data); |
145
|
|
|
|
|
|
|
} |
146
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
0
|
return Venus::Array->new($data)->$code(@args); |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub arrayref (@) { |
151
|
0
|
|
|
0
|
1
|
0
|
my (@args) = @_; |
152
|
|
|
|
|
|
|
|
153
|
0
|
0
|
|
|
|
0
|
return @args > 1 |
|
|
0
|
|
|
|
|
|
154
|
|
|
|
|
|
|
? ([@args]) |
155
|
|
|
|
|
|
|
: ((ref $args[0] eq 'ARRAY') ? ($args[0]) : ([@args])); |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
sub assert ($$) { |
159
|
0
|
|
|
0
|
1
|
0
|
my ($data, $expr) = @_; |
160
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
0
|
require Venus::Assert; |
162
|
|
|
|
|
|
|
|
163
|
0
|
|
|
|
|
0
|
my $assert = Venus::Assert->new('name', 'assert(?, ?)')->expression($expr); |
164
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
0
|
return $assert->validate($data); |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub async ($) { |
169
|
0
|
|
|
0
|
1
|
0
|
my ($code) = @_; |
170
|
|
|
|
|
|
|
|
171
|
0
|
|
|
|
|
0
|
require Venus::Process; |
172
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
0
|
return Venus::Process->new->async($code); |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
sub await ($;$) { |
177
|
0
|
|
|
0
|
1
|
0
|
my ($process, $timeout) = @_; |
178
|
|
|
|
|
|
|
|
179
|
0
|
|
|
|
|
0
|
require Venus::Process; |
180
|
|
|
|
|
|
|
|
181
|
0
|
|
|
|
|
0
|
return $process->await($timeout); |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
sub bool (;$) { |
185
|
0
|
|
|
0
|
1
|
0
|
my ($data) = @_; |
186
|
|
|
|
|
|
|
|
187
|
0
|
|
|
|
|
0
|
require Venus::Boolean; |
188
|
|
|
|
|
|
|
|
189
|
0
|
|
|
|
|
0
|
return Venus::Boolean->new($data); |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
sub box ($) { |
193
|
0
|
|
|
0
|
1
|
0
|
my ($data) = @_; |
194
|
|
|
|
|
|
|
|
195
|
0
|
|
|
|
|
0
|
require Venus::Box; |
196
|
|
|
|
|
|
|
|
197
|
0
|
|
|
|
|
0
|
my $box = Venus::Box->new($data); |
198
|
|
|
|
|
|
|
|
199
|
0
|
|
|
|
|
0
|
return $box; |
200
|
|
|
|
|
|
|
} |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
sub call (@) { |
203
|
0
|
|
|
0
|
1
|
0
|
my ($data, @args) = @_; |
204
|
0
|
|
|
|
|
0
|
my $next = @args; |
205
|
0
|
0
|
0
|
|
|
0
|
if ($next && UNIVERSAL::isa($data, 'CODE')) { |
206
|
0
|
|
|
|
|
0
|
return $data->(@args); |
207
|
|
|
|
|
|
|
} |
208
|
0
|
|
|
|
|
0
|
my $code = shift(@args); |
209
|
0
|
0
|
0
|
|
|
0
|
if ($next && Scalar::Util::blessed($data)) { |
210
|
0
|
0
|
0
|
|
|
0
|
return $data->$code(@args) if UNIVERSAL::can($data, $code) |
211
|
|
|
|
|
|
|
|| UNIVERSAL::can($data, 'AUTOLOAD'); |
212
|
0
|
|
|
|
|
0
|
$next = 0; |
213
|
|
|
|
|
|
|
} |
214
|
0
|
0
|
0
|
|
|
0
|
if ($next && ref($data) eq 'SCALAR') { |
215
|
0
|
0
|
|
|
|
0
|
return $$data->$code(@args) if UNIVERSAL::can(load($$data)->package, $code); |
216
|
0
|
|
|
|
|
0
|
$next = 0; |
217
|
|
|
|
|
|
|
} |
218
|
0
|
0
|
0
|
|
|
0
|
if ($next && UNIVERSAL::can(load($data)->package, $code)) { |
219
|
87
|
|
|
87
|
|
717
|
no strict 'refs'; |
|
87
|
|
|
|
|
217
|
|
|
87
|
|
|
|
|
7767
|
|
220
|
0
|
|
|
|
|
0
|
return *{"${data}::${code}"}{"CODE"} ? |
221
|
0
|
0
|
|
|
|
0
|
&{"${data}::${code}"}(@args) : $data->$code(@args[1..$#args]); |
|
0
|
|
|
|
|
0
|
|
222
|
|
|
|
|
|
|
} |
223
|
0
|
0
|
0
|
|
|
0
|
if ($next && UNIVERSAL::can($data, 'AUTOLOAD')) { |
224
|
87
|
|
|
87
|
|
679
|
no strict 'refs'; |
|
87
|
|
|
|
|
219
|
|
|
87
|
|
|
|
|
496729
|
|
225
|
0
|
|
|
|
|
0
|
return &{"${data}::${code}"}(@args); |
|
0
|
|
|
|
|
0
|
|
226
|
|
|
|
|
|
|
} |
227
|
0
|
|
|
|
|
0
|
fault("Exception! call(@{[join(', ', map qq('$_'), @_)]}) failed."); |
|
0
|
|
|
|
|
0
|
|
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
sub cast (;$$) { |
231
|
0
|
0
|
|
0
|
1
|
0
|
my ($data, $into) = (@_ ? (@_) : ($_)); |
232
|
|
|
|
|
|
|
|
233
|
0
|
|
|
|
|
0
|
require Venus::Type; |
234
|
|
|
|
|
|
|
|
235
|
0
|
|
|
|
|
0
|
my $type = Venus::Type->new($data); |
236
|
|
|
|
|
|
|
|
237
|
0
|
0
|
|
|
|
0
|
return $into ? $type->cast($into) : $type->deduce; |
238
|
|
|
|
|
|
|
} |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
sub catch (&) { |
241
|
26
|
|
|
26
|
1
|
74
|
my ($data) = @_; |
242
|
|
|
|
|
|
|
|
243
|
26
|
|
|
|
|
40
|
my $error; |
244
|
|
|
|
|
|
|
|
245
|
26
|
|
|
|
|
108
|
require Venus::Try; |
246
|
|
|
|
|
|
|
|
247
|
26
|
|
|
|
|
111
|
my @result = Venus::Try->new($data)->error(\$error)->result; |
248
|
|
|
|
|
|
|
|
249
|
26
|
50
|
|
|
|
93
|
return wantarray ? ($error ? ($error, undef) : ($error, @result)) : $error; |
|
|
100
|
|
|
|
|
|
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
sub caught ($$;&) { |
253
|
0
|
|
|
0
|
1
|
0
|
my ($data, $type, $code) = @_; |
254
|
|
|
|
|
|
|
|
255
|
0
|
0
|
|
|
|
0
|
($type, my($name)) = @$type if ref $type eq 'ARRAY'; |
256
|
|
|
|
|
|
|
|
257
|
0
|
|
0
|
|
|
0
|
my $is_true = $data |
258
|
|
|
|
|
|
|
&& UNIVERSAL::isa($data, $type) |
259
|
|
|
|
|
|
|
&& UNIVERSAL::isa($data, 'Venus::Error') |
260
|
|
|
|
|
|
|
&& ( |
261
|
|
|
|
|
|
|
$data->name |
262
|
|
|
|
|
|
|
? ($name ? $data->of($name) : true()) |
263
|
|
|
|
|
|
|
: (!$name ? true() : false()) |
264
|
|
|
|
|
|
|
); |
265
|
|
|
|
|
|
|
|
266
|
0
|
0
|
|
|
|
0
|
if ($is_true) { |
267
|
0
|
|
|
|
|
0
|
local $_ = $data; |
268
|
|
|
|
|
|
|
|
269
|
0
|
0
|
|
|
|
0
|
return $code ? $code->($data) : $data; |
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
else { |
272
|
0
|
|
|
|
|
0
|
return undef; |
273
|
|
|
|
|
|
|
} |
274
|
|
|
|
|
|
|
} |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
sub chain { |
277
|
0
|
|
|
0
|
1
|
0
|
my ($data, @args) = @_; |
278
|
|
|
|
|
|
|
|
279
|
0
|
0
|
|
|
|
0
|
return if !$data; |
280
|
|
|
|
|
|
|
|
281
|
0
|
0
|
|
|
|
0
|
for my $next (map +(ref($_) eq 'ARRAY' ? $_ : [$_]), @args) { |
282
|
0
|
|
|
|
|
0
|
$data = call($data, @$next); |
283
|
|
|
|
|
|
|
} |
284
|
|
|
|
|
|
|
|
285
|
0
|
|
|
|
|
0
|
return $data; |
286
|
|
|
|
|
|
|
} |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
sub check ($$) { |
289
|
0
|
|
|
0
|
1
|
0
|
my ($data, $expr) = @_; |
290
|
|
|
|
|
|
|
|
291
|
0
|
|
|
|
|
0
|
require Venus::Assert; |
292
|
|
|
|
|
|
|
|
293
|
0
|
|
|
|
|
0
|
return Venus::Assert->new->expression($expr)->check($data); |
294
|
|
|
|
|
|
|
} |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
sub clargs (@) { |
297
|
0
|
|
|
0
|
1
|
0
|
my (@args) = @_; |
298
|
|
|
|
|
|
|
|
299
|
0
|
0
|
|
|
|
0
|
my ($argv, $specs) = (@args > 1) |
300
|
|
|
|
|
|
|
? (map arrayref($_), @args) |
301
|
|
|
|
|
|
|
: ([@ARGV], arrayref(@args)); |
302
|
|
|
|
|
|
|
|
303
|
|
|
|
|
|
|
return ( |
304
|
0
|
|
|
|
|
0
|
args($argv), opts($argv, 'reparse', $specs), vars({}), |
305
|
|
|
|
|
|
|
); |
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
sub cli (;$) { |
309
|
0
|
|
|
0
|
1
|
0
|
my ($data) = @_; |
310
|
|
|
|
|
|
|
|
311
|
0
|
|
|
|
|
0
|
require Venus::Cli; |
312
|
|
|
|
|
|
|
|
313
|
0
|
|
0
|
|
|
0
|
my $cli = Venus::Cli->new($data || [@ARGV]); |
314
|
|
|
|
|
|
|
|
315
|
0
|
|
|
|
|
0
|
return $cli; |
316
|
|
|
|
|
|
|
} |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
sub code ($;$@) { |
319
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
320
|
|
|
|
|
|
|
|
321
|
0
|
|
|
|
|
0
|
require Venus::Code; |
322
|
|
|
|
|
|
|
|
323
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
324
|
0
|
|
|
|
|
0
|
return Venus::Code->new($data); |
325
|
|
|
|
|
|
|
} |
326
|
|
|
|
|
|
|
|
327
|
0
|
|
|
|
|
0
|
return Venus::Code->new($data)->$code(@args); |
328
|
|
|
|
|
|
|
} |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
sub config ($;$@) { |
331
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
332
|
|
|
|
|
|
|
|
333
|
0
|
|
|
|
|
0
|
require Venus::Config; |
334
|
|
|
|
|
|
|
|
335
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
336
|
0
|
|
|
|
|
0
|
return Venus::Config->new($data); |
337
|
|
|
|
|
|
|
} |
338
|
|
|
|
|
|
|
|
339
|
0
|
|
|
|
|
0
|
return Venus::Config->new($data)->$code(@args); |
340
|
|
|
|
|
|
|
} |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
sub container ($;$@) { |
343
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
344
|
|
|
|
|
|
|
|
345
|
0
|
|
|
|
|
0
|
require Venus::Container; |
346
|
|
|
|
|
|
|
|
347
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
348
|
0
|
|
|
|
|
0
|
return Venus::Container->new($data); |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
|
351
|
0
|
|
|
|
|
0
|
return Venus::Container->new($data)->$code(@args); |
352
|
|
|
|
|
|
|
} |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
sub cop (@) { |
355
|
0
|
|
|
0
|
1
|
0
|
my ($data, @args) = @_; |
356
|
|
|
|
|
|
|
|
357
|
0
|
|
|
|
|
0
|
require Scalar::Util; |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
($data, $args[0]) = map { |
360
|
0
|
0
|
|
|
|
0
|
ref eq 'SCALAR' ? $$_ : Scalar::Util::blessed($_) ? ref($_) : $_ |
|
0
|
0
|
|
|
|
0
|
|
361
|
|
|
|
|
|
|
} ($data, $args[0]); |
362
|
|
|
|
|
|
|
|
363
|
0
|
|
|
|
|
0
|
return space("$data")->cop(@args); |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
|
366
|
|
|
|
|
|
|
sub data ($;$@) { |
367
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
368
|
|
|
|
|
|
|
|
369
|
0
|
|
|
|
|
0
|
require Venus::Data; |
370
|
|
|
|
|
|
|
|
371
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
372
|
0
|
|
|
|
|
0
|
return Venus::Data->new($data); |
373
|
|
|
|
|
|
|
} |
374
|
|
|
|
|
|
|
|
375
|
0
|
|
|
|
|
0
|
return Venus::Data->new($data)->$code(@args); |
376
|
|
|
|
|
|
|
} |
377
|
|
|
|
|
|
|
|
378
|
|
|
|
|
|
|
sub date ($;$@) { |
379
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
380
|
|
|
|
|
|
|
|
381
|
0
|
|
|
|
|
0
|
require Venus::Date; |
382
|
|
|
|
|
|
|
|
383
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
384
|
0
|
|
|
|
|
0
|
return Venus::Date->new($data); |
385
|
|
|
|
|
|
|
} |
386
|
|
|
|
|
|
|
|
387
|
0
|
|
|
|
|
0
|
return Venus::Date->new($data)->$code(@args); |
388
|
|
|
|
|
|
|
} |
389
|
|
|
|
|
|
|
|
390
|
|
|
|
|
|
|
sub docs { |
391
|
0
|
|
|
0
|
1
|
0
|
my (@args) = @_; |
392
|
|
|
|
|
|
|
|
393
|
0
|
|
|
|
|
0
|
my $file = (grep -f, (caller(0))[1], $0)[0]; |
394
|
|
|
|
|
|
|
|
395
|
0
|
|
|
|
|
0
|
my $data = data($file); |
396
|
|
|
|
|
|
|
|
397
|
0
|
0
|
|
|
|
0
|
return $data->docs->string(@args > 1 ? @args : (undef, @args)); |
398
|
|
|
|
|
|
|
} |
399
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
sub error (;$) { |
401
|
7
|
|
|
7
|
1
|
26
|
my ($data) = @_; |
402
|
|
|
|
|
|
|
|
403
|
7
|
|
100
|
|
|
42
|
$data //= {}; |
404
|
7
|
|
33
|
|
|
86
|
$data->{context} //= (caller(1))[3]; |
405
|
|
|
|
|
|
|
|
406
|
7
|
|
|
|
|
2269
|
require Venus::Throw; |
407
|
|
|
|
|
|
|
|
408
|
7
|
|
|
|
|
49
|
return Venus::Throw->new->error($data); |
409
|
|
|
|
|
|
|
} |
410
|
|
|
|
|
|
|
|
411
|
|
|
|
|
|
|
sub false () { |
412
|
|
|
|
|
|
|
|
413
|
10311
|
|
|
10311
|
1
|
75554
|
require Venus::False; |
414
|
|
|
|
|
|
|
|
415
|
10311
|
|
|
|
|
40686
|
return Venus::False->value; |
416
|
|
|
|
|
|
|
} |
417
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
sub fault (;$) { |
419
|
1
|
|
|
1
|
1
|
4
|
my ($data) = @_; |
420
|
|
|
|
|
|
|
|
421
|
1
|
|
|
|
|
745
|
require Venus::Fault; |
422
|
|
|
|
|
|
|
|
423
|
1
|
|
|
|
|
5
|
return Venus::Fault->new($data)->throw; |
424
|
|
|
|
|
|
|
} |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
sub float ($;$@) { |
427
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
428
|
|
|
|
|
|
|
|
429
|
0
|
|
|
|
|
0
|
require Venus::Float; |
430
|
|
|
|
|
|
|
|
431
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
432
|
0
|
|
|
|
|
0
|
return Venus::Float->new($data); |
433
|
|
|
|
|
|
|
} |
434
|
|
|
|
|
|
|
|
435
|
0
|
|
|
|
|
0
|
return Venus::Float->new($data)->$code(@args); |
436
|
|
|
|
|
|
|
} |
437
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
sub gather ($;&) { |
439
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code) = @_; |
440
|
|
|
|
|
|
|
|
441
|
0
|
|
|
|
|
0
|
require Venus::Gather; |
442
|
|
|
|
|
|
|
|
443
|
0
|
|
|
|
|
0
|
my $match = Venus::Gather->new($data); |
444
|
|
|
|
|
|
|
|
445
|
0
|
0
|
|
|
|
0
|
return $match if !$code; |
446
|
|
|
|
|
|
|
|
447
|
0
|
|
|
|
|
0
|
local $_ = $match; |
448
|
|
|
|
|
|
|
|
449
|
0
|
|
|
|
|
0
|
my $returned = $code->($match, $data); |
450
|
|
|
|
|
|
|
|
451
|
0
|
0
|
|
|
|
0
|
$match->data($returned) if ref $returned eq 'HASH'; |
452
|
|
|
|
|
|
|
|
453
|
0
|
|
|
|
|
0
|
return $match->result; |
454
|
|
|
|
|
|
|
} |
455
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
sub hash ($;$@) { |
457
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
458
|
|
|
|
|
|
|
|
459
|
0
|
|
|
|
|
0
|
require Venus::Hash; |
460
|
|
|
|
|
|
|
|
461
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
462
|
0
|
|
|
|
|
0
|
return Venus::Hash->new($data); |
463
|
|
|
|
|
|
|
} |
464
|
|
|
|
|
|
|
|
465
|
0
|
|
|
|
|
0
|
return Venus::Hash->new($data)->$code(@args); |
466
|
|
|
|
|
|
|
} |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
sub hashref (@) { |
469
|
0
|
|
|
0
|
1
|
0
|
my (@args) = @_; |
470
|
|
|
|
|
|
|
|
471
|
0
|
0
|
|
|
|
0
|
return @args > 1 |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
472
|
|
|
|
|
|
|
? ({(scalar(@args) % 2) ? (@args, undef) : @args}) |
473
|
|
|
|
|
|
|
: ((ref $args[0] eq 'HASH') |
474
|
|
|
|
|
|
|
? ($args[0]) |
475
|
|
|
|
|
|
|
: ({(scalar(@args) % 2) ? (@args, undef) : @args})); |
476
|
|
|
|
|
|
|
} |
477
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
sub is_bool ($) { |
479
|
0
|
|
|
0
|
1
|
0
|
my ($data) = @_; |
480
|
|
|
|
|
|
|
|
481
|
0
|
0
|
|
|
|
0
|
return type($data, 'coded', 'BOOLEAN') ? true() : false(); |
482
|
|
|
|
|
|
|
} |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
sub is_false ($) { |
485
|
0
|
|
|
0
|
1
|
0
|
my ($data) = @_; |
486
|
|
|
|
|
|
|
|
487
|
0
|
|
|
|
|
0
|
require Venus::Boolean; |
488
|
|
|
|
|
|
|
|
489
|
0
|
|
|
|
|
0
|
return Venus::Boolean->new($data)->is_false; |
490
|
|
|
|
|
|
|
} |
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
sub is_true ($) { |
493
|
0
|
|
|
0
|
1
|
0
|
my ($data) = @_; |
494
|
|
|
|
|
|
|
|
495
|
0
|
|
|
|
|
0
|
require Venus::Boolean; |
496
|
|
|
|
|
|
|
|
497
|
0
|
|
|
|
|
0
|
return Venus::Boolean->new($data)->is_true; |
498
|
|
|
|
|
|
|
} |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
sub json (;$$) { |
501
|
0
|
|
|
0
|
1
|
0
|
my ($code, $data) = @_; |
502
|
|
|
|
|
|
|
|
503
|
0
|
|
|
|
|
0
|
require Venus::Json; |
504
|
|
|
|
|
|
|
|
505
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
506
|
0
|
|
|
|
|
0
|
return Venus::Json->new; |
507
|
|
|
|
|
|
|
} |
508
|
|
|
|
|
|
|
|
509
|
0
|
0
|
|
|
|
0
|
if (lc($code) eq 'decode') { |
510
|
0
|
|
|
|
|
0
|
return Venus::Json->new->decode($data); |
511
|
|
|
|
|
|
|
} |
512
|
|
|
|
|
|
|
|
513
|
0
|
0
|
|
|
|
0
|
if (lc($code) eq 'encode') { |
514
|
0
|
|
|
|
|
0
|
return Venus::Json->new(value => $data)->encode; |
515
|
|
|
|
|
|
|
} |
516
|
|
|
|
|
|
|
|
517
|
0
|
|
|
|
|
0
|
return fault(qq(Invalid "json" action "$code")); |
518
|
|
|
|
|
|
|
} |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
sub list (@) { |
521
|
0
|
|
|
0
|
1
|
0
|
my (@args) = @_; |
522
|
|
|
|
|
|
|
|
523
|
0
|
0
|
|
|
|
0
|
return map {defined $_ ? (ref eq 'ARRAY' ? (@{$_}) : ($_)) : ($_)} @args; |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
524
|
|
|
|
|
|
|
} |
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
sub load ($) { |
527
|
0
|
|
|
0
|
1
|
0
|
my ($data) = @_; |
528
|
|
|
|
|
|
|
|
529
|
0
|
|
|
|
|
0
|
return space($data)->do('load'); |
530
|
|
|
|
|
|
|
} |
531
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
sub log (@) { |
533
|
0
|
|
|
0
|
1
|
0
|
my (@args) = @_; |
534
|
|
|
|
|
|
|
|
535
|
0
|
|
|
|
|
0
|
state $codes = { |
536
|
|
|
|
|
|
|
debug => 'debug', |
537
|
|
|
|
|
|
|
error => 'error', |
538
|
|
|
|
|
|
|
fatal => 'fatal', |
539
|
|
|
|
|
|
|
info => 'info', |
540
|
|
|
|
|
|
|
trace => 'trace', |
541
|
|
|
|
|
|
|
warn => 'warn', |
542
|
|
|
|
|
|
|
}; |
543
|
|
|
|
|
|
|
|
544
|
0
|
0
|
0
|
|
|
0
|
unshift @args, 'debug' if @args && !$codes->{$args[0]}; |
545
|
|
|
|
|
|
|
|
546
|
0
|
|
|
|
|
0
|
require Venus::Log; |
547
|
|
|
|
|
|
|
|
548
|
0
|
|
|
|
|
0
|
my $log = Venus::Log->new($ENV{VENUS_LOG_LEVEL}); |
549
|
|
|
|
|
|
|
|
550
|
0
|
0
|
|
|
|
0
|
return $log if !@args; |
551
|
|
|
|
|
|
|
|
552
|
0
|
|
|
|
|
0
|
my $code = shift @args; |
553
|
|
|
|
|
|
|
|
554
|
0
|
|
|
|
|
0
|
return $log->$code(@args); |
555
|
|
|
|
|
|
|
} |
556
|
|
|
|
|
|
|
|
557
|
|
|
|
|
|
|
sub make (@) { |
558
|
|
|
|
|
|
|
|
559
|
0
|
0
|
|
0
|
1
|
0
|
return if !@_; |
560
|
|
|
|
|
|
|
|
561
|
0
|
|
|
|
|
0
|
return call($_[0], 'new', @_); |
562
|
|
|
|
|
|
|
} |
563
|
|
|
|
|
|
|
|
564
|
|
|
|
|
|
|
sub match ($;&) { |
565
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code) = @_; |
566
|
|
|
|
|
|
|
|
567
|
0
|
|
|
|
|
0
|
require Venus::Match; |
568
|
|
|
|
|
|
|
|
569
|
0
|
|
|
|
|
0
|
my $match = Venus::Match->new($data); |
570
|
|
|
|
|
|
|
|
571
|
0
|
0
|
|
|
|
0
|
return $match if !$code; |
572
|
|
|
|
|
|
|
|
573
|
0
|
|
|
|
|
0
|
local $_ = $match; |
574
|
|
|
|
|
|
|
|
575
|
0
|
|
|
|
|
0
|
my $returned = $code->($match, $data); |
576
|
|
|
|
|
|
|
|
577
|
0
|
0
|
|
|
|
0
|
$match->data($returned) if ref $returned eq 'HASH'; |
578
|
|
|
|
|
|
|
|
579
|
0
|
|
|
|
|
0
|
return $match->result; |
580
|
|
|
|
|
|
|
} |
581
|
|
|
|
|
|
|
|
582
|
|
|
|
|
|
|
sub merge { |
583
|
78
|
|
|
78
|
1
|
153
|
my ($lvalue, @rvalues) = @_; |
584
|
|
|
|
|
|
|
|
585
|
78
|
50
|
|
|
|
140
|
if (!$lvalue) { |
586
|
0
|
|
|
|
|
0
|
return {}; |
587
|
|
|
|
|
|
|
} |
588
|
|
|
|
|
|
|
|
589
|
78
|
|
|
|
|
105
|
my $rvalue; |
590
|
|
|
|
|
|
|
|
591
|
78
|
100
|
|
|
|
135
|
if (@rvalues > 1) { |
592
|
1
|
|
|
|
|
12
|
my $result = $lvalue; |
593
|
1
|
|
|
|
|
24
|
$result = merge($result, $_) for @rvalues; |
594
|
1
|
|
|
|
|
5
|
return $result; |
595
|
|
|
|
|
|
|
} |
596
|
|
|
|
|
|
|
else { |
597
|
77
|
|
|
|
|
105
|
$rvalue = $rvalues[0]; |
598
|
|
|
|
|
|
|
} |
599
|
|
|
|
|
|
|
|
600
|
77
|
50
|
|
|
|
132
|
if (!$rvalue) { |
601
|
0
|
|
|
|
|
0
|
return $lvalue; |
602
|
|
|
|
|
|
|
} |
603
|
|
|
|
|
|
|
|
604
|
77
|
100
|
|
|
|
186
|
if (ref $lvalue eq 'HASH') { |
605
|
70
|
50
|
|
|
|
120
|
if (ref $rvalue eq 'HASH') { |
606
|
70
|
|
|
|
|
81
|
for my $index (keys %{$rvalue}) { |
|
70
|
|
|
|
|
167
|
|
607
|
166
|
|
|
|
|
235
|
my $lprop = $lvalue->{$index}; |
608
|
166
|
|
|
|
|
198
|
my $rprop = $rvalue->{$index}; |
609
|
166
|
100
|
100
|
|
|
672
|
$lvalue->{$index} = ( |
610
|
|
|
|
|
|
|
((ref($lprop) eq 'HASH') && (ref($rprop) eq 'HASH')) |
611
|
|
|
|
|
|
|
|| ((ref($lprop) eq 'ARRAY') && (ref($rprop) eq 'ARRAY')) |
612
|
|
|
|
|
|
|
) |
613
|
|
|
|
|
|
|
? merge($lprop, $rprop) |
614
|
|
|
|
|
|
|
: $rprop; |
615
|
|
|
|
|
|
|
} |
616
|
|
|
|
|
|
|
} |
617
|
|
|
|
|
|
|
else { |
618
|
0
|
|
|
|
|
0
|
$lvalue = $rvalue; |
619
|
|
|
|
|
|
|
} |
620
|
|
|
|
|
|
|
} |
621
|
|
|
|
|
|
|
|
622
|
77
|
100
|
|
|
|
165
|
if (ref $lvalue eq 'ARRAY') { |
623
|
7
|
50
|
|
|
|
28
|
if (ref $rvalue eq 'ARRAY') { |
624
|
7
|
|
|
|
|
11
|
for my $index (0..$#{$rvalue}) { |
|
7
|
|
|
|
|
25
|
|
625
|
30
|
|
|
|
|
45
|
my $lprop = $lvalue->[$index]; |
626
|
30
|
|
|
|
|
36
|
my $rprop = $rvalue->[$index]; |
627
|
30
|
100
|
66
|
|
|
145
|
$lvalue->[$index] = ( |
628
|
|
|
|
|
|
|
((ref($lprop) eq 'HASH') && (ref($rprop) eq 'HASH')) |
629
|
|
|
|
|
|
|
|| ((ref($lprop) eq 'ARRAY') && (ref($rprop) eq 'ARRAY')) |
630
|
|
|
|
|
|
|
) |
631
|
|
|
|
|
|
|
? merge($lprop, $rprop) |
632
|
|
|
|
|
|
|
: $rprop; |
633
|
|
|
|
|
|
|
} |
634
|
|
|
|
|
|
|
} |
635
|
|
|
|
|
|
|
else { |
636
|
0
|
|
|
|
|
0
|
$lvalue = $rvalue; |
637
|
|
|
|
|
|
|
} |
638
|
|
|
|
|
|
|
} |
639
|
|
|
|
|
|
|
|
640
|
77
|
|
|
|
|
170
|
return $lvalue; |
641
|
|
|
|
|
|
|
} |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
sub meta ($;$@) { |
644
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
645
|
|
|
|
|
|
|
|
646
|
0
|
|
|
|
|
0
|
require Venus::Meta; |
647
|
|
|
|
|
|
|
|
648
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
649
|
0
|
|
|
|
|
0
|
return Venus::Meta->new(name => $data); |
650
|
|
|
|
|
|
|
} |
651
|
|
|
|
|
|
|
|
652
|
0
|
|
|
|
|
0
|
return Venus::Meta->new(name => $data)->$code(@args); |
653
|
|
|
|
|
|
|
} |
654
|
|
|
|
|
|
|
|
655
|
|
|
|
|
|
|
sub name ($;$@) { |
656
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
657
|
|
|
|
|
|
|
|
658
|
0
|
|
|
|
|
0
|
require Venus::Name; |
659
|
|
|
|
|
|
|
|
660
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
661
|
0
|
|
|
|
|
0
|
return Venus::Name->new($data); |
662
|
|
|
|
|
|
|
} |
663
|
|
|
|
|
|
|
|
664
|
0
|
|
|
|
|
0
|
return Venus::Name->new($data)->$code(@args); |
665
|
|
|
|
|
|
|
} |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
sub number ($;$@) { |
668
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
669
|
|
|
|
|
|
|
|
670
|
0
|
|
|
|
|
0
|
require Venus::Number; |
671
|
|
|
|
|
|
|
|
672
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
673
|
0
|
|
|
|
|
0
|
return Venus::Number->new($data); |
674
|
|
|
|
|
|
|
} |
675
|
|
|
|
|
|
|
|
676
|
0
|
|
|
|
|
0
|
return Venus::Number->new($data)->$code(@args); |
677
|
|
|
|
|
|
|
} |
678
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
sub opts ($;$@) { |
680
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
681
|
|
|
|
|
|
|
|
682
|
0
|
|
|
|
|
0
|
require Venus::Opts; |
683
|
|
|
|
|
|
|
|
684
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
685
|
0
|
|
|
|
|
0
|
return Venus::Opts->new($data); |
686
|
|
|
|
|
|
|
} |
687
|
|
|
|
|
|
|
|
688
|
0
|
|
|
|
|
0
|
return Venus::Opts->new($data)->$code(@args); |
689
|
|
|
|
|
|
|
} |
690
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
sub pairs (@) { |
692
|
0
|
|
|
0
|
1
|
0
|
my ($args) = @_; |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
my $result = defined $args |
695
|
|
|
|
|
|
|
? ( |
696
|
|
|
|
|
|
|
ref $args eq 'ARRAY' |
697
|
0
|
|
|
|
|
0
|
? ([map {[$_, $args->[$_]]} 0..$#{$args}]) |
|
0
|
|
|
|
|
0
|
|
698
|
0
|
0
|
|
|
|
0
|
: (ref $args eq 'HASH' ? ([map {[$_, $args->{$_}]} sort keys %{$args}]) : ([]))) |
|
0
|
0
|
|
|
|
0
|
|
|
0
|
0
|
|
|
|
0
|
|
699
|
|
|
|
|
|
|
: []; |
700
|
|
|
|
|
|
|
|
701
|
0
|
0
|
|
|
|
0
|
return wantarray ? @{$result} : $result; |
|
0
|
|
|
|
|
0
|
|
702
|
|
|
|
|
|
|
} |
703
|
|
|
|
|
|
|
|
704
|
|
|
|
|
|
|
sub path ($;$@) { |
705
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
706
|
|
|
|
|
|
|
|
707
|
0
|
|
|
|
|
0
|
require Venus::Path; |
708
|
|
|
|
|
|
|
|
709
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
710
|
0
|
|
|
|
|
0
|
return Venus::Path->new($data); |
711
|
|
|
|
|
|
|
} |
712
|
|
|
|
|
|
|
|
713
|
0
|
|
|
|
|
0
|
return Venus::Path->new($data)->$code(@args); |
714
|
|
|
|
|
|
|
} |
715
|
|
|
|
|
|
|
|
716
|
|
|
|
|
|
|
sub perl (;$$) { |
717
|
0
|
|
|
0
|
1
|
0
|
my ($code, $data) = @_; |
718
|
|
|
|
|
|
|
|
719
|
0
|
|
|
|
|
0
|
require Venus::Dump; |
720
|
|
|
|
|
|
|
|
721
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
722
|
0
|
|
|
|
|
0
|
return Venus::Dump->new; |
723
|
|
|
|
|
|
|
} |
724
|
|
|
|
|
|
|
|
725
|
0
|
0
|
|
|
|
0
|
if (lc($code) eq 'decode') { |
726
|
0
|
|
|
|
|
0
|
return Venus::Dump->new->decode($data); |
727
|
|
|
|
|
|
|
} |
728
|
|
|
|
|
|
|
|
729
|
0
|
0
|
|
|
|
0
|
if (lc($code) eq 'encode') { |
730
|
0
|
|
|
|
|
0
|
return Venus::Dump->new(value => $data)->encode; |
731
|
|
|
|
|
|
|
} |
732
|
|
|
|
|
|
|
|
733
|
0
|
|
|
|
|
0
|
return fault(qq(Invalid "perl" action "$code")); |
734
|
|
|
|
|
|
|
} |
735
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
sub process (;$@) { |
737
|
0
|
|
|
0
|
1
|
0
|
my ($code, @args) = @_; |
738
|
|
|
|
|
|
|
|
739
|
0
|
|
|
|
|
0
|
require Venus::Process; |
740
|
|
|
|
|
|
|
|
741
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
742
|
0
|
|
|
|
|
0
|
return Venus::Process->new; |
743
|
|
|
|
|
|
|
} |
744
|
|
|
|
|
|
|
|
745
|
0
|
|
|
|
|
0
|
return Venus::Process->new->$code(@args); |
746
|
|
|
|
|
|
|
} |
747
|
|
|
|
|
|
|
|
748
|
|
|
|
|
|
|
sub proto ($;$@) { |
749
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
750
|
|
|
|
|
|
|
|
751
|
0
|
|
|
|
|
0
|
require Venus::Prototype; |
752
|
|
|
|
|
|
|
|
753
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
754
|
0
|
|
|
|
|
0
|
return Venus::Prototype->new($data); |
755
|
|
|
|
|
|
|
} |
756
|
|
|
|
|
|
|
|
757
|
0
|
|
|
|
|
0
|
return Venus::Prototype->new($data)->$code(@args); |
758
|
|
|
|
|
|
|
} |
759
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
sub puts ($;@) { |
761
|
0
|
|
|
0
|
1
|
0
|
my ($data, @args) = @_; |
762
|
|
|
|
|
|
|
|
763
|
0
|
|
|
|
|
0
|
$data = cast($data); |
764
|
|
|
|
|
|
|
|
765
|
0
|
|
|
|
|
0
|
my $result = []; |
766
|
|
|
|
|
|
|
|
767
|
0
|
0
|
|
|
|
0
|
if ($data->isa('Venus::Hash')) { |
|
|
0
|
|
|
|
|
|
768
|
0
|
|
|
|
|
0
|
$result = $data->puts(@args); |
769
|
|
|
|
|
|
|
} |
770
|
|
|
|
|
|
|
elsif ($data->isa('Venus::Array')) { |
771
|
0
|
|
|
|
|
0
|
$result = $data->puts(@args); |
772
|
|
|
|
|
|
|
} |
773
|
|
|
|
|
|
|
|
774
|
0
|
0
|
|
|
|
0
|
return wantarray ? (@{$result}) : $result; |
|
0
|
|
|
|
|
0
|
|
775
|
|
|
|
|
|
|
} |
776
|
|
|
|
|
|
|
|
777
|
|
|
|
|
|
|
sub raise ($;$) { |
778
|
6
|
|
|
6
|
1
|
34
|
my ($self, $data) = @_; |
779
|
|
|
|
|
|
|
|
780
|
6
|
50
|
|
|
|
27
|
($self, my $parent) = (@$self) if (ref($self) eq 'ARRAY'); |
781
|
|
|
|
|
|
|
|
782
|
6
|
|
100
|
|
|
39
|
$data //= {}; |
783
|
6
|
|
33
|
|
|
447
|
$data->{context} //= (caller(1))[3]; |
784
|
|
|
|
|
|
|
|
785
|
6
|
50
|
|
|
|
45
|
$parent = 'Venus::Error' if !$parent; |
786
|
|
|
|
|
|
|
|
787
|
6
|
|
|
|
|
917
|
require Venus::Throw; |
788
|
|
|
|
|
|
|
|
789
|
6
|
|
|
|
|
66
|
return Venus::Throw->new(package => $self, parent => $parent)->error($data); |
790
|
|
|
|
|
|
|
} |
791
|
|
|
|
|
|
|
|
792
|
|
|
|
|
|
|
sub random (;$@) { |
793
|
0
|
|
|
0
|
1
|
0
|
my ($code, @args) = @_; |
794
|
|
|
|
|
|
|
|
795
|
0
|
|
|
|
|
0
|
require Venus::Random; |
796
|
|
|
|
|
|
|
|
797
|
0
|
|
|
|
|
0
|
state $random = Venus::Random->new; |
798
|
|
|
|
|
|
|
|
799
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
800
|
0
|
|
|
|
|
0
|
return $random; |
801
|
|
|
|
|
|
|
} |
802
|
|
|
|
|
|
|
|
803
|
0
|
|
|
|
|
0
|
return $random->$code(@args); |
804
|
|
|
|
|
|
|
} |
805
|
|
|
|
|
|
|
|
806
|
|
|
|
|
|
|
sub range ($;@) { |
807
|
0
|
|
|
0
|
1
|
0
|
my ($data, @args) = @_; |
808
|
|
|
|
|
|
|
|
809
|
0
|
|
|
|
|
0
|
return array($data, 'range', @args); |
810
|
|
|
|
|
|
|
} |
811
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
sub regexp ($;$@) { |
813
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
814
|
|
|
|
|
|
|
|
815
|
0
|
|
|
|
|
0
|
require Venus::Regexp; |
816
|
|
|
|
|
|
|
|
817
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
818
|
0
|
|
|
|
|
0
|
return Venus::Regexp->new($data); |
819
|
|
|
|
|
|
|
} |
820
|
|
|
|
|
|
|
|
821
|
0
|
|
|
|
|
0
|
return Venus::Regexp->new($data)->$code(@args); |
822
|
|
|
|
|
|
|
} |
823
|
|
|
|
|
|
|
|
824
|
|
|
|
|
|
|
sub render ($;$) { |
825
|
0
|
|
|
0
|
1
|
0
|
my ($data, $args) = @_; |
826
|
|
|
|
|
|
|
|
827
|
0
|
|
0
|
|
|
0
|
return template($data, 'render', undef, $args || {}); |
828
|
|
|
|
|
|
|
} |
829
|
|
|
|
|
|
|
|
830
|
|
|
|
|
|
|
sub replace ($;$@) { |
831
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
832
|
|
|
|
|
|
|
|
833
|
0
|
|
|
|
|
0
|
my @keys = qw( |
834
|
|
|
|
|
|
|
string |
835
|
|
|
|
|
|
|
regexp |
836
|
|
|
|
|
|
|
substr |
837
|
|
|
|
|
|
|
); |
838
|
|
|
|
|
|
|
|
839
|
0
|
0
|
|
|
|
0
|
my @data = (ref $data eq 'ARRAY' ? (map +(shift(@keys), $_), @{$data}) : $data); |
|
0
|
|
|
|
|
0
|
|
840
|
|
|
|
|
|
|
|
841
|
0
|
|
|
|
|
0
|
require Venus::Replace; |
842
|
|
|
|
|
|
|
|
843
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
844
|
0
|
|
|
|
|
0
|
return Venus::Replace->new(@data); |
845
|
|
|
|
|
|
|
} |
846
|
|
|
|
|
|
|
|
847
|
0
|
|
|
|
|
0
|
return Venus::Replace->new(@data)->$code(@args); |
848
|
|
|
|
|
|
|
} |
849
|
|
|
|
|
|
|
|
850
|
|
|
|
|
|
|
sub resolve ($;@) { |
851
|
0
|
|
|
0
|
1
|
0
|
my ($data, @args) = @_; |
852
|
|
|
|
|
|
|
|
853
|
0
|
|
|
|
|
0
|
return container($data, 'resolve', @args); |
854
|
|
|
|
|
|
|
} |
855
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
sub roll (@) { |
857
|
|
|
|
|
|
|
|
858
|
0
|
|
|
0
|
1
|
0
|
return (@_[1,0,2..$#_]); |
859
|
|
|
|
|
|
|
} |
860
|
|
|
|
|
|
|
|
861
|
|
|
|
|
|
|
sub schema ($;$@) { |
862
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
863
|
|
|
|
|
|
|
|
864
|
0
|
|
|
|
|
0
|
require Venus::Schema; |
865
|
|
|
|
|
|
|
|
866
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
867
|
0
|
|
|
|
|
0
|
return Venus::Schema->new($data); |
868
|
|
|
|
|
|
|
} |
869
|
|
|
|
|
|
|
|
870
|
0
|
|
|
|
|
0
|
return Venus::Schema->new($data)->$code(@args); |
871
|
|
|
|
|
|
|
} |
872
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
sub search ($;$@) { |
874
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
875
|
|
|
|
|
|
|
|
876
|
0
|
|
|
|
|
0
|
my @keys = qw( |
877
|
|
|
|
|
|
|
string |
878
|
|
|
|
|
|
|
regexp |
879
|
|
|
|
|
|
|
); |
880
|
|
|
|
|
|
|
|
881
|
0
|
0
|
|
|
|
0
|
my @data = (ref $data eq 'ARRAY' ? (map +(shift(@keys), $_), @{$data}) : $data); |
|
0
|
|
|
|
|
0
|
|
882
|
|
|
|
|
|
|
|
883
|
0
|
|
|
|
|
0
|
require Venus::Search; |
884
|
|
|
|
|
|
|
|
885
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
886
|
0
|
|
|
|
|
0
|
return Venus::Search->new(@data); |
887
|
|
|
|
|
|
|
} |
888
|
|
|
|
|
|
|
|
889
|
0
|
|
|
|
|
0
|
return Venus::Search->new(@data)->$code(@args); |
890
|
|
|
|
|
|
|
} |
891
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
sub space ($;$@) { |
893
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
894
|
|
|
|
|
|
|
|
895
|
0
|
|
|
|
|
0
|
require Venus::Space; |
896
|
|
|
|
|
|
|
|
897
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
898
|
0
|
|
|
|
|
0
|
return Venus::Space->new($data); |
899
|
|
|
|
|
|
|
} |
900
|
|
|
|
|
|
|
|
901
|
0
|
|
|
|
|
0
|
return Venus::Space->new($data)->$code(@args); |
902
|
|
|
|
|
|
|
} |
903
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
sub string ($;$@) { |
905
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
906
|
|
|
|
|
|
|
|
907
|
0
|
|
|
|
|
0
|
require Venus::String; |
908
|
|
|
|
|
|
|
|
909
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
910
|
0
|
|
|
|
|
0
|
return Venus::String->new($data); |
911
|
|
|
|
|
|
|
} |
912
|
|
|
|
|
|
|
|
913
|
0
|
|
|
|
|
0
|
return Venus::String->new($data)->$code(@args); |
914
|
|
|
|
|
|
|
} |
915
|
|
|
|
|
|
|
|
916
|
|
|
|
|
|
|
sub syscall ($;@) { |
917
|
0
|
|
|
0
|
1
|
0
|
my (@args) = @_; |
918
|
|
|
|
|
|
|
|
919
|
0
|
|
|
|
|
0
|
require Venus::Os; |
920
|
|
|
|
|
|
|
|
921
|
0
|
|
|
|
|
0
|
for (my $i = 0; $i < @args; $i++) { |
922
|
0
|
0
|
|
|
|
0
|
if ($args[$i] =~ /^\|+$/) { |
923
|
0
|
|
|
|
|
0
|
next; |
924
|
|
|
|
|
|
|
} |
925
|
0
|
0
|
|
|
|
0
|
if ($args[$i] =~ /^\&+$/) { |
926
|
0
|
|
|
|
|
0
|
next; |
927
|
|
|
|
|
|
|
} |
928
|
0
|
0
|
|
|
|
0
|
if ($args[$i] =~ /^\w+$/) { |
929
|
0
|
|
|
|
|
0
|
next; |
930
|
|
|
|
|
|
|
} |
931
|
0
|
0
|
|
|
|
0
|
if ($args[$i] =~ /^[<>]+$/) { |
932
|
0
|
|
|
|
|
0
|
next; |
933
|
|
|
|
|
|
|
} |
934
|
0
|
0
|
|
|
|
0
|
if ($args[$i] =~ /^\d[<>&]+\d?$/) { |
935
|
0
|
|
|
|
|
0
|
next; |
936
|
|
|
|
|
|
|
} |
937
|
0
|
0
|
|
|
|
0
|
if ($args[$i] =~ /\$[A-Z]\w+/) { |
938
|
0
|
|
|
|
|
0
|
next; |
939
|
|
|
|
|
|
|
} |
940
|
0
|
0
|
|
|
|
0
|
if ($args[$i] =~ /^\$\((.*)\)$/) { |
941
|
0
|
|
|
|
|
0
|
next; |
942
|
|
|
|
|
|
|
} |
943
|
0
|
|
|
|
|
0
|
$args[$i] = Venus::Os->quote($args[$i]); |
944
|
|
|
|
|
|
|
} |
945
|
|
|
|
|
|
|
|
946
|
0
|
|
|
|
|
0
|
my ($data, $exit, $code) = (_qx(@args)); |
947
|
|
|
|
|
|
|
|
948
|
0
|
0
|
|
|
|
0
|
return wantarray ? ($data, $code) : (($exit == 0) ? true() : false()); |
|
|
0
|
|
|
|
|
|
949
|
|
|
|
|
|
|
} |
950
|
|
|
|
|
|
|
|
951
|
|
|
|
|
|
|
sub template ($;$@) { |
952
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
953
|
|
|
|
|
|
|
|
954
|
0
|
|
|
|
|
0
|
require Venus::Template; |
955
|
|
|
|
|
|
|
|
956
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
957
|
0
|
|
|
|
|
0
|
return Venus::Template->new($data); |
958
|
|
|
|
|
|
|
} |
959
|
|
|
|
|
|
|
|
960
|
0
|
|
|
|
|
0
|
return Venus::Template->new($data)->$code(@args); |
961
|
|
|
|
|
|
|
} |
962
|
|
|
|
|
|
|
|
963
|
|
|
|
|
|
|
sub test ($;$@) { |
964
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
965
|
|
|
|
|
|
|
|
966
|
0
|
|
|
|
|
0
|
require Venus::Test; |
967
|
|
|
|
|
|
|
|
968
|
0
|
0
|
|
|
|
0
|
if (!$code) { |
969
|
0
|
|
|
|
|
0
|
return Venus::Test->new($data); |
970
|
|
|
|
|
|
|
} |
971
|
|
|
|
|
|
|
|
972
|
0
|
|
|
|
|
0
|
return Venus::Test->new($data)->$code(@args); |
973
|
|
|
|
|
|
|
} |
974
|
|
|
|
|
|
|
|
975
|
|
|
|
|
|
|
sub text { |
976
|
0
|
|
|
0
|
1
|
0
|
my (@args) = @_; |
977
|
|
|
|
|
|
|
|
978
|
0
|
|
|
|
|
0
|
my $file = (grep -f, (caller(0))[1], $0)[0]; |
979
|
|
|
|
|
|
|
|
980
|
0
|
|
|
|
|
0
|
my $data = data($file); |
981
|
|
|
|
|
|
|
|
982
|
0
|
0
|
|
|
|
0
|
return $data->text->string(@args > 1 ? @args : (undef, @args)); |
983
|
|
|
|
|
|
|
} |
984
|
|
|
|
|
|
|
|
985
|
|
|
|
|
|
|
sub then (@) { |
986
|
|
|
|
|
|
|
|
987
|
0
|
|
|
0
|
1
|
0
|
return ($_[0], call(@_)); |
988
|
|
|
|
|
|
|
} |
989
|
|
|
|
|
|
|
|
990
|
|
|
|
|
|
|
sub throw ($;$@) { |
991
|
0
|
|
|
0
|
1
|
0
|
my ($data, $code, @args) = @_; |
992
|
|
|
|
|
|
|
|
993
|
0
|
|
|
|
|
0
|
require Venus::Throw; |
994
|
|
|
|
|
|
|
|
995
|
0
|
|
|
|
|
0
|
my $throw = Venus::Throw->new(context => (caller(1))[3])->do( |
996
|
|
|
|
|
|
|
frame => 1, |
997
|
|
|
|
|
|
|
); |
998
|
|
|
|
|
|
|
|
999
|
0
|
0
|
|
|
|
0
|
if (ref $data ne 'HASH') { |
1000
|
0
|
0
|
|
|
|
0
|
$throw->package($data) if $data; |
1001
|
|
|
|
|
|
|
} |
1002
|
|
|
|
|
|
|
else { |
1003
|
0
|
0
|
|
|
|
0
|
if (exists $data->{as}) { |
1004
|
0
|
|
|
|
|
0
|
$throw->as($data->{as}); |
1005
|
|
|
|
|
|
|
} |
1006
|
0
|
0
|
|
|
|
0
|
if (exists $data->{capture}) { |
1007
|
0
|
|
|
|
|
0
|
$throw->capture(@{$data->{capture}}); |
|
0
|
|
|
|
|
0
|
|
1008
|
|
|
|
|
|
|
} |
1009
|
0
|
0
|
|
|
|
0
|
if (exists $data->{context}) { |
1010
|
0
|
|
|
|
|
0
|
$throw->context($data->{context}); |
1011
|
|
|
|
|
|
|
} |
1012
|
0
|
0
|
|
|
|
0
|
if (exists $data->{error}) { |
1013
|
0
|
|
|
|
|
0
|
$throw->error($data->{error}); |
1014
|
|
|
|
|
|
|
} |
1015
|
0
|
0
|
|
|
|
0
|
if (exists $data->{frame}) { |
1016
|
0
|
|
|
|
|
0
|
$throw->frame($data->{frame}); |
1017
|
|
|
|
|
|
|
} |
1018
|
0
|
0
|
|
|
|
0
|
if (exists $data->{message}) { |
1019
|
0
|
|
|
|
|
0
|
$throw->message($data->{message}); |
1020
|
|
|
|
|
|
|
} |
1021
|
0
|
0
|
|
|
|
0
|
if (exists $data->{name}) { |
1022
|
0
|
|
|
|
|
0
|
$throw->name($data->{name}); |
1023
|
|
|
|
|
|
|
} |
1024
|
0
|
0
|
|
|
|
0
|
if (exists $data->{package}) { |
1025
|
0
|
|
|
|
|
0
|
$throw->package($data->{package}); |
1026
|
|
|
|
|
|
|
} |
1027
|
0
|
0
|
|
|
|
0
|
if (exists $data->{parent}) { |
1028
|
0
|
|
|
|
|
0
|
$throw->parent($data->{parent}); |
1029
|
|
|
|
|
|
|
} |
1030
|
0
|
0
|
|
|
|
0
|
if (exists $data->{stash}) { |
1031
|
0
|
|
|
|
|
0
|
$throw->stash($_, $data->{stash}->{$_}) for keys %{$data->{stash}}; |
|
0
|
|
|
|
|
0
|
|
1032
|
|
|
|
|
|
|
} |
1033
|
0
|
0
|
|
|
|
0
|
if (exists $data->{on}) { |
1034
|
0
|
|
|
|
|
0
|
$throw->on($data->{on}); |
1035
|
|
|
|
|
|
|
} |
1036
|
|
|
|
|
|
|
} |
1037
|
|
|
|
|
|
|
|
1038
|
0
|
0
|
|
|
|
0
|
return $throw if !$code; |
1039
|
|
|
|
|
|
|
|
1040
|
0
|
|
|
|
|
0
|
return $throw->$code(@args); |
1041
|
|
|
|
|
|
|
} |
1042
|
|
|
|
|
|
|
|
1043
|
|
|
|
|
|
|
sub true () { |
1044
|
|
|
|
|
|
|
|
1045
|
3076
|
|
|
3076
|
1
|
48509
|
require Venus::True; |
1046
|
|
|
|
|
|
|
|
1047
|
3076
|
|
|
|
|
12639
|
return Venus::True->value; |
1048
|
|
|
|
|
|
|
} |
1049
|
|
|
|
|
|
|
|
1050
|
|
|
|
|
|
|
sub try ($;$@) { |
1051
|
0
|
|
|
0
|
1
|
|
my ($data, $code, @args) = @_; |
1052
|
|
|
|
|
|
|
|
1053
|
0
|
|
|
|
|
|
require Venus::Try; |
1054
|
|
|
|
|
|
|
|
1055
|
0
|
0
|
|
|
|
|
if (!$code) { |
1056
|
0
|
|
|
|
|
|
return Venus::Try->new($data); |
1057
|
|
|
|
|
|
|
} |
1058
|
|
|
|
|
|
|
|
1059
|
0
|
|
|
|
|
|
return Venus::Try->new($data)->$code(@args); |
1060
|
|
|
|
|
|
|
} |
1061
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
sub type ($;$@) { |
1063
|
0
|
|
|
0
|
1
|
|
my ($data, $code, @args) = @_; |
1064
|
|
|
|
|
|
|
|
1065
|
0
|
|
|
|
|
|
require Venus::Type; |
1066
|
|
|
|
|
|
|
|
1067
|
0
|
0
|
|
|
|
|
if (!$code) { |
1068
|
0
|
|
|
|
|
|
return Venus::Type->new($data); |
1069
|
|
|
|
|
|
|
} |
1070
|
|
|
|
|
|
|
|
1071
|
0
|
|
|
|
|
|
return Venus::Type->new($data)->$code(@args); |
1072
|
|
|
|
|
|
|
} |
1073
|
|
|
|
|
|
|
|
1074
|
|
|
|
|
|
|
sub unpack (@) { |
1075
|
0
|
|
|
0
|
1
|
|
my (@args) = @_; |
1076
|
|
|
|
|
|
|
|
1077
|
0
|
|
|
|
|
|
require Venus::Unpack; |
1078
|
|
|
|
|
|
|
|
1079
|
0
|
|
|
|
|
|
return Venus::Unpack->new->do('args', @args)->all; |
1080
|
|
|
|
|
|
|
} |
1081
|
|
|
|
|
|
|
|
1082
|
|
|
|
|
|
|
sub vars ($;$@) { |
1083
|
0
|
|
|
0
|
1
|
|
my ($data, $code, @args) = @_; |
1084
|
|
|
|
|
|
|
|
1085
|
0
|
|
|
|
|
|
require Venus::Vars; |
1086
|
|
|
|
|
|
|
|
1087
|
0
|
0
|
|
|
|
|
if (!$code) { |
1088
|
0
|
|
|
|
|
|
return Venus::Vars->new($data); |
1089
|
|
|
|
|
|
|
} |
1090
|
|
|
|
|
|
|
|
1091
|
0
|
|
|
|
|
|
return Venus::Vars->new($data)->$code(@args); |
1092
|
|
|
|
|
|
|
} |
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
sub venus ($;@) { |
1095
|
0
|
|
|
0
|
1
|
|
my ($name, @args) = @_; |
1096
|
|
|
|
|
|
|
|
1097
|
0
|
0
|
|
|
|
|
@args = ('new') if !@args; |
1098
|
|
|
|
|
|
|
|
1099
|
0
|
|
|
|
|
|
return chain(\space(join('/', 'Venus', $name))->package, @args); |
1100
|
|
|
|
|
|
|
} |
1101
|
|
|
|
|
|
|
|
1102
|
|
|
|
|
|
|
sub work ($) { |
1103
|
0
|
|
|
0
|
1
|
|
my ($data) = @_; |
1104
|
|
|
|
|
|
|
|
1105
|
0
|
|
|
|
|
|
require Venus::Process; |
1106
|
|
|
|
|
|
|
|
1107
|
0
|
|
|
|
|
|
return Venus::Process->new->do('work', $data); |
1108
|
|
|
|
|
|
|
} |
1109
|
|
|
|
|
|
|
|
1110
|
|
|
|
|
|
|
sub wrap ($;$) { |
1111
|
0
|
|
|
0
|
1
|
|
my ($data, $name) = @_; |
1112
|
|
|
|
|
|
|
|
1113
|
0
|
0
|
|
|
|
|
return if !@_; |
1114
|
|
|
|
|
|
|
|
1115
|
0
|
|
0
|
|
|
|
my $moniker = $name // $data =~ s/\W//gr; |
1116
|
0
|
|
|
|
|
|
my $caller = caller(0); |
1117
|
|
|
|
|
|
|
|
1118
|
87
|
|
|
87
|
|
834
|
no strict 'refs'; |
|
87
|
|
|
|
|
249
|
|
|
87
|
|
|
|
|
4034
|
|
1119
|
87
|
|
|
87
|
|
643
|
no warnings 'redefine'; |
|
87
|
|
|
|
|
200
|
|
|
87
|
|
|
|
|
65148
|
|
1120
|
|
|
|
|
|
|
|
1121
|
0
|
0
|
|
0
|
|
|
return *{"${caller}::${moniker}"} = sub {@_ ? make($data, @_) : $data}; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
} |
1123
|
|
|
|
|
|
|
|
1124
|
|
|
|
|
|
|
sub yaml (;$$) { |
1125
|
0
|
|
|
0
|
1
|
|
my ($code, $data) = @_; |
1126
|
|
|
|
|
|
|
|
1127
|
0
|
|
|
|
|
|
require Venus::Yaml; |
1128
|
|
|
|
|
|
|
|
1129
|
0
|
0
|
|
|
|
|
if (!$code) { |
1130
|
0
|
|
|
|
|
|
return Venus::Yaml->new; |
1131
|
|
|
|
|
|
|
} |
1132
|
|
|
|
|
|
|
|
1133
|
0
|
0
|
|
|
|
|
if (lc($code) eq 'decode') { |
1134
|
0
|
|
|
|
|
|
return Venus::Yaml->new->decode($data); |
1135
|
|
|
|
|
|
|
} |
1136
|
|
|
|
|
|
|
|
1137
|
0
|
0
|
|
|
|
|
if (lc($code) eq 'encode') { |
1138
|
0
|
|
|
|
|
|
return Venus::Yaml->new(value => $data)->encode; |
1139
|
|
|
|
|
|
|
} |
1140
|
|
|
|
|
|
|
|
1141
|
0
|
|
|
|
|
|
return fault(qq(Invalid "yaml" action "$code")); |
1142
|
|
|
|
|
|
|
} |
1143
|
|
|
|
|
|
|
|
1144
|
|
|
|
|
|
|
1; |
1145
|
|
|
|
|
|
|
|
1146
|
|
|
|
|
|
|
|
1147
|
|
|
|
|
|
|
=head1 NAME |
1148
|
|
|
|
|
|
|
|
1149
|
|
|
|
|
|
|
Venus - OO Library |
1150
|
|
|
|
|
|
|
|
1151
|
|
|
|
|
|
|
=cut |
1152
|
|
|
|
|
|
|
|
1153
|
|
|
|
|
|
|
=head1 ABSTRACT |
1154
|
|
|
|
|
|
|
|
1155
|
|
|
|
|
|
|
OO Standard Library for Perl 5 |
1156
|
|
|
|
|
|
|
|
1157
|
|
|
|
|
|
|
=cut |
1158
|
|
|
|
|
|
|
|
1159
|
|
|
|
|
|
|
=head1 VERSION |
1160
|
|
|
|
|
|
|
|
1161
|
|
|
|
|
|
|
3.55 |
1162
|
|
|
|
|
|
|
|
1163
|
|
|
|
|
|
|
=cut |
1164
|
|
|
|
|
|
|
|
1165
|
|
|
|
|
|
|
=head1 SYNOPSIS |
1166
|
|
|
|
|
|
|
|
1167
|
|
|
|
|
|
|
package main; |
1168
|
|
|
|
|
|
|
|
1169
|
|
|
|
|
|
|
use Venus 'catch', 'error', 'raise'; |
1170
|
|
|
|
|
|
|
|
1171
|
|
|
|
|
|
|
# error handling |
1172
|
|
|
|
|
|
|
my ($error, $result) = catch { |
1173
|
|
|
|
|
|
|
error; |
1174
|
|
|
|
|
|
|
}; |
1175
|
|
|
|
|
|
|
|
1176
|
|
|
|
|
|
|
# boolean keywords |
1177
|
|
|
|
|
|
|
if ($result) { |
1178
|
|
|
|
|
|
|
error; |
1179
|
|
|
|
|
|
|
} |
1180
|
|
|
|
|
|
|
|
1181
|
|
|
|
|
|
|
# raise exceptions |
1182
|
|
|
|
|
|
|
if ($result) { |
1183
|
|
|
|
|
|
|
raise 'MyApp::Error'; |
1184
|
|
|
|
|
|
|
} |
1185
|
|
|
|
|
|
|
|
1186
|
|
|
|
|
|
|
# boolean keywords, and more! |
1187
|
|
|
|
|
|
|
true ne false; |
1188
|
|
|
|
|
|
|
|
1189
|
|
|
|
|
|
|
=cut |
1190
|
|
|
|
|
|
|
|
1191
|
|
|
|
|
|
|
=head1 DESCRIPTION |
1192
|
|
|
|
|
|
|
|
1193
|
|
|
|
|
|
|
This library provides an object-orientation framework and extendible standard |
1194
|
|
|
|
|
|
|
library for Perl 5 with classes which wrap most native Perl data types. Venus |
1195
|
|
|
|
|
|
|
has a simple modular architecture, robust library of classes, methods, and |
1196
|
|
|
|
|
|
|
roles, supports pure-Perl autoboxing, advanced exception handling, "true" and |
1197
|
|
|
|
|
|
|
"false" functions, package introspection, command-line options parsing, and |
1198
|
|
|
|
|
|
|
more. This package will always automatically exports C and C |
1199
|
|
|
|
|
|
|
keyword functions (unless existing routines of the same name already exist in |
1200
|
|
|
|
|
|
|
the calling package or its parents), otherwise exports keyword functions as |
1201
|
|
|
|
|
|
|
requested at import. This library requires Perl C<5.18+>. |
1202
|
|
|
|
|
|
|
|
1203
|
|
|
|
|
|
|
=head1 CAPABILITIES |
1204
|
|
|
|
|
|
|
|
1205
|
|
|
|
|
|
|
The following is a short list of capabilities: |
1206
|
|
|
|
|
|
|
|
1207
|
|
|
|
|
|
|
=over 4 |
1208
|
|
|
|
|
|
|
|
1209
|
|
|
|
|
|
|
=item * |
1210
|
|
|
|
|
|
|
|
1211
|
|
|
|
|
|
|
Perl 5.18.0+ |
1212
|
|
|
|
|
|
|
|
1213
|
|
|
|
|
|
|
=item * |
1214
|
|
|
|
|
|
|
|
1215
|
|
|
|
|
|
|
Zero Dependencies |
1216
|
|
|
|
|
|
|
|
1217
|
|
|
|
|
|
|
=item * |
1218
|
|
|
|
|
|
|
|
1219
|
|
|
|
|
|
|
Fast Object-Orientation |
1220
|
|
|
|
|
|
|
|
1221
|
|
|
|
|
|
|
=item * |
1222
|
|
|
|
|
|
|
|
1223
|
|
|
|
|
|
|
Robust Standard Library |
1224
|
|
|
|
|
|
|
|
1225
|
|
|
|
|
|
|
=item * |
1226
|
|
|
|
|
|
|
|
1227
|
|
|
|
|
|
|
Intuitive Value Classes |
1228
|
|
|
|
|
|
|
|
1229
|
|
|
|
|
|
|
=item * |
1230
|
|
|
|
|
|
|
|
1231
|
|
|
|
|
|
|
Pure Perl Autoboxing |
1232
|
|
|
|
|
|
|
|
1233
|
|
|
|
|
|
|
=item * |
1234
|
|
|
|
|
|
|
|
1235
|
|
|
|
|
|
|
Convenient Utility Classes |
1236
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
=item * |
1238
|
|
|
|
|
|
|
|
1239
|
|
|
|
|
|
|
Simple Package Reflection |
1240
|
|
|
|
|
|
|
|
1241
|
|
|
|
|
|
|
=item * |
1242
|
|
|
|
|
|
|
|
1243
|
|
|
|
|
|
|
Flexible Exception Handling |
1244
|
|
|
|
|
|
|
|
1245
|
|
|
|
|
|
|
=item * |
1246
|
|
|
|
|
|
|
|
1247
|
|
|
|
|
|
|
Composable Standards |
1248
|
|
|
|
|
|
|
|
1249
|
|
|
|
|
|
|
=item * |
1250
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
Pluggable (no monkeypatching) |
1252
|
|
|
|
|
|
|
|
1253
|
|
|
|
|
|
|
=item * |
1254
|
|
|
|
|
|
|
|
1255
|
|
|
|
|
|
|
Proxyable Methods |
1256
|
|
|
|
|
|
|
|
1257
|
|
|
|
|
|
|
=item * |
1258
|
|
|
|
|
|
|
|
1259
|
|
|
|
|
|
|
Type Assertions |
1260
|
|
|
|
|
|
|
|
1261
|
|
|
|
|
|
|
=item * |
1262
|
|
|
|
|
|
|
|
1263
|
|
|
|
|
|
|
Type Coercions |
1264
|
|
|
|
|
|
|
|
1265
|
|
|
|
|
|
|
=item * |
1266
|
|
|
|
|
|
|
|
1267
|
|
|
|
|
|
|
Value Casting |
1268
|
|
|
|
|
|
|
|
1269
|
|
|
|
|
|
|
=item * |
1270
|
|
|
|
|
|
|
|
1271
|
|
|
|
|
|
|
Boolean Values |
1272
|
|
|
|
|
|
|
|
1273
|
|
|
|
|
|
|
=item * |
1274
|
|
|
|
|
|
|
|
1275
|
|
|
|
|
|
|
Complete Documentation |
1276
|
|
|
|
|
|
|
|
1277
|
|
|
|
|
|
|
=item * |
1278
|
|
|
|
|
|
|
|
1279
|
|
|
|
|
|
|
Complete Test Coverage |
1280
|
|
|
|
|
|
|
|
1281
|
|
|
|
|
|
|
=back |
1282
|
|
|
|
|
|
|
|
1283
|
|
|
|
|
|
|
=cut |
1284
|
|
|
|
|
|
|
|
1285
|
|
|
|
|
|
|
=head1 FUNCTIONS |
1286
|
|
|
|
|
|
|
|
1287
|
|
|
|
|
|
|
This package provides the following functions: |
1288
|
|
|
|
|
|
|
|
1289
|
|
|
|
|
|
|
=cut |
1290
|
|
|
|
|
|
|
|
1291
|
|
|
|
|
|
|
=head2 args |
1292
|
|
|
|
|
|
|
|
1293
|
|
|
|
|
|
|
args(ArrayRef $value, Str | CodeRef $code, Any @args) (Any) |
1294
|
|
|
|
|
|
|
|
1295
|
|
|
|
|
|
|
The args function builds and returns a L object, or dispatches to |
1296
|
|
|
|
|
|
|
the coderef or method provided. |
1297
|
|
|
|
|
|
|
|
1298
|
|
|
|
|
|
|
I> |
1299
|
|
|
|
|
|
|
|
1300
|
|
|
|
|
|
|
=over 4 |
1301
|
|
|
|
|
|
|
|
1302
|
|
|
|
|
|
|
=item args example 1 |
1303
|
|
|
|
|
|
|
|
1304
|
|
|
|
|
|
|
package main; |
1305
|
|
|
|
|
|
|
|
1306
|
|
|
|
|
|
|
use Venus 'args'; |
1307
|
|
|
|
|
|
|
|
1308
|
|
|
|
|
|
|
my $args = args ['--resource', 'users']; |
1309
|
|
|
|
|
|
|
|
1310
|
|
|
|
|
|
|
# bless({...}, 'Venus::Args') |
1311
|
|
|
|
|
|
|
|
1312
|
|
|
|
|
|
|
=back |
1313
|
|
|
|
|
|
|
|
1314
|
|
|
|
|
|
|
=over 4 |
1315
|
|
|
|
|
|
|
|
1316
|
|
|
|
|
|
|
=item args example 2 |
1317
|
|
|
|
|
|
|
|
1318
|
|
|
|
|
|
|
package main; |
1319
|
|
|
|
|
|
|
|
1320
|
|
|
|
|
|
|
use Venus 'args'; |
1321
|
|
|
|
|
|
|
|
1322
|
|
|
|
|
|
|
my $args = args ['--resource', 'users'], 'indexed'; |
1323
|
|
|
|
|
|
|
|
1324
|
|
|
|
|
|
|
# {0 => '--resource', 1 => 'users'} |
1325
|
|
|
|
|
|
|
|
1326
|
|
|
|
|
|
|
=back |
1327
|
|
|
|
|
|
|
|
1328
|
|
|
|
|
|
|
=cut |
1329
|
|
|
|
|
|
|
|
1330
|
|
|
|
|
|
|
=head2 array |
1331
|
|
|
|
|
|
|
|
1332
|
|
|
|
|
|
|
array(ArrayRef | HashRef $value, Str | CodeRef $code, Any @args) (Any) |
1333
|
|
|
|
|
|
|
|
1334
|
|
|
|
|
|
|
The array function builds and returns a L object, or dispatches |
1335
|
|
|
|
|
|
|
to the coderef or method provided. |
1336
|
|
|
|
|
|
|
|
1337
|
|
|
|
|
|
|
I> |
1338
|
|
|
|
|
|
|
|
1339
|
|
|
|
|
|
|
=over 4 |
1340
|
|
|
|
|
|
|
|
1341
|
|
|
|
|
|
|
=item array example 1 |
1342
|
|
|
|
|
|
|
|
1343
|
|
|
|
|
|
|
package main; |
1344
|
|
|
|
|
|
|
|
1345
|
|
|
|
|
|
|
use Venus 'array'; |
1346
|
|
|
|
|
|
|
|
1347
|
|
|
|
|
|
|
my $array = array []; |
1348
|
|
|
|
|
|
|
|
1349
|
|
|
|
|
|
|
# bless({...}, 'Venus::Array') |
1350
|
|
|
|
|
|
|
|
1351
|
|
|
|
|
|
|
=back |
1352
|
|
|
|
|
|
|
|
1353
|
|
|
|
|
|
|
=over 4 |
1354
|
|
|
|
|
|
|
|
1355
|
|
|
|
|
|
|
=item array example 2 |
1356
|
|
|
|
|
|
|
|
1357
|
|
|
|
|
|
|
package main; |
1358
|
|
|
|
|
|
|
|
1359
|
|
|
|
|
|
|
use Venus 'array'; |
1360
|
|
|
|
|
|
|
|
1361
|
|
|
|
|
|
|
my $array = array [1..4], 'push', 5..9; |
1362
|
|
|
|
|
|
|
|
1363
|
|
|
|
|
|
|
# [1..9] |
1364
|
|
|
|
|
|
|
|
1365
|
|
|
|
|
|
|
=back |
1366
|
|
|
|
|
|
|
|
1367
|
|
|
|
|
|
|
=cut |
1368
|
|
|
|
|
|
|
|
1369
|
|
|
|
|
|
|
=head2 arrayref |
1370
|
|
|
|
|
|
|
|
1371
|
|
|
|
|
|
|
arrayref(Any @args) (ArrayRef) |
1372
|
|
|
|
|
|
|
|
1373
|
|
|
|
|
|
|
The arrayref function takes a list of arguments and returns a arrayref. |
1374
|
|
|
|
|
|
|
|
1375
|
|
|
|
|
|
|
I> |
1376
|
|
|
|
|
|
|
|
1377
|
|
|
|
|
|
|
=over 4 |
1378
|
|
|
|
|
|
|
|
1379
|
|
|
|
|
|
|
=item arrayref example 1 |
1380
|
|
|
|
|
|
|
|
1381
|
|
|
|
|
|
|
package main; |
1382
|
|
|
|
|
|
|
|
1383
|
|
|
|
|
|
|
use Venus 'arrayref'; |
1384
|
|
|
|
|
|
|
|
1385
|
|
|
|
|
|
|
my $arrayref = arrayref(content => 'example'); |
1386
|
|
|
|
|
|
|
|
1387
|
|
|
|
|
|
|
# [content => "example"] |
1388
|
|
|
|
|
|
|
|
1389
|
|
|
|
|
|
|
=back |
1390
|
|
|
|
|
|
|
|
1391
|
|
|
|
|
|
|
=over 4 |
1392
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
=item arrayref example 2 |
1394
|
|
|
|
|
|
|
|
1395
|
|
|
|
|
|
|
package main; |
1396
|
|
|
|
|
|
|
|
1397
|
|
|
|
|
|
|
use Venus 'arrayref'; |
1398
|
|
|
|
|
|
|
|
1399
|
|
|
|
|
|
|
my $arrayref = arrayref([content => 'example']); |
1400
|
|
|
|
|
|
|
|
1401
|
|
|
|
|
|
|
# [content => "example"] |
1402
|
|
|
|
|
|
|
|
1403
|
|
|
|
|
|
|
=back |
1404
|
|
|
|
|
|
|
|
1405
|
|
|
|
|
|
|
=over 4 |
1406
|
|
|
|
|
|
|
|
1407
|
|
|
|
|
|
|
=item arrayref example 3 |
1408
|
|
|
|
|
|
|
|
1409
|
|
|
|
|
|
|
package main; |
1410
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
use Venus 'arrayref'; |
1412
|
|
|
|
|
|
|
|
1413
|
|
|
|
|
|
|
my $arrayref = arrayref('content'); |
1414
|
|
|
|
|
|
|
|
1415
|
|
|
|
|
|
|
# ['content'] |
1416
|
|
|
|
|
|
|
|
1417
|
|
|
|
|
|
|
=back |
1418
|
|
|
|
|
|
|
|
1419
|
|
|
|
|
|
|
=cut |
1420
|
|
|
|
|
|
|
|
1421
|
|
|
|
|
|
|
=head2 assert |
1422
|
|
|
|
|
|
|
|
1423
|
|
|
|
|
|
|
assert(Any $data, Str $expr) (Any) |
1424
|
|
|
|
|
|
|
|
1425
|
|
|
|
|
|
|
The assert function builds a L object and returns the result of |
1426
|
|
|
|
|
|
|
a L operation. |
1427
|
|
|
|
|
|
|
|
1428
|
|
|
|
|
|
|
I> |
1429
|
|
|
|
|
|
|
|
1430
|
|
|
|
|
|
|
=over 4 |
1431
|
|
|
|
|
|
|
|
1432
|
|
|
|
|
|
|
=item assert example 1 |
1433
|
|
|
|
|
|
|
|
1434
|
|
|
|
|
|
|
package main; |
1435
|
|
|
|
|
|
|
|
1436
|
|
|
|
|
|
|
use Venus 'assert'; |
1437
|
|
|
|
|
|
|
|
1438
|
|
|
|
|
|
|
my $assert = assert(1234567890, 'number'); |
1439
|
|
|
|
|
|
|
|
1440
|
|
|
|
|
|
|
# 1234567890 |
1441
|
|
|
|
|
|
|
|
1442
|
|
|
|
|
|
|
=back |
1443
|
|
|
|
|
|
|
|
1444
|
|
|
|
|
|
|
=over 4 |
1445
|
|
|
|
|
|
|
|
1446
|
|
|
|
|
|
|
=item assert example 2 |
1447
|
|
|
|
|
|
|
|
1448
|
|
|
|
|
|
|
package main; |
1449
|
|
|
|
|
|
|
|
1450
|
|
|
|
|
|
|
use Venus 'assert'; |
1451
|
|
|
|
|
|
|
|
1452
|
|
|
|
|
|
|
my $assert = assert(1234567890, 'float'); |
1453
|
|
|
|
|
|
|
|
1454
|
|
|
|
|
|
|
# Exception! (isa Venus::Assert::Error) |
1455
|
|
|
|
|
|
|
|
1456
|
|
|
|
|
|
|
=back |
1457
|
|
|
|
|
|
|
|
1458
|
|
|
|
|
|
|
=cut |
1459
|
|
|
|
|
|
|
|
1460
|
|
|
|
|
|
|
=head2 async |
1461
|
|
|
|
|
|
|
|
1462
|
|
|
|
|
|
|
async(CodeRef $code, Any @args) (Process) |
1463
|
|
|
|
|
|
|
|
1464
|
|
|
|
|
|
|
The async function accepts a callback and executes it asynchronously via |
1465
|
|
|
|
|
|
|
L. This function returns a |
1466
|
|
|
|
|
|
|
L<"dyadic"|Venus::Process/is_dyadic> L object which can be used |
1467
|
|
|
|
|
|
|
with L. |
1468
|
|
|
|
|
|
|
|
1469
|
|
|
|
|
|
|
I> |
1470
|
|
|
|
|
|
|
|
1471
|
|
|
|
|
|
|
=over 4 |
1472
|
|
|
|
|
|
|
|
1473
|
|
|
|
|
|
|
=item async example 1 |
1474
|
|
|
|
|
|
|
|
1475
|
|
|
|
|
|
|
package main; |
1476
|
|
|
|
|
|
|
|
1477
|
|
|
|
|
|
|
use Venus 'async'; |
1478
|
|
|
|
|
|
|
|
1479
|
|
|
|
|
|
|
my $async = async sub{ |
1480
|
|
|
|
|
|
|
'done' |
1481
|
|
|
|
|
|
|
}; |
1482
|
|
|
|
|
|
|
|
1483
|
|
|
|
|
|
|
# bless({...}, 'Venus::Process') |
1484
|
|
|
|
|
|
|
|
1485
|
|
|
|
|
|
|
=back |
1486
|
|
|
|
|
|
|
|
1487
|
|
|
|
|
|
|
=cut |
1488
|
|
|
|
|
|
|
|
1489
|
|
|
|
|
|
|
=head2 await |
1490
|
|
|
|
|
|
|
|
1491
|
|
|
|
|
|
|
await(Process $process, Int $timeout) (Any) |
1492
|
|
|
|
|
|
|
|
1493
|
|
|
|
|
|
|
The await function accepts a L<"dyadic"|Venus::Process/is_dyadic> |
1494
|
|
|
|
|
|
|
L object and eventually returns a value (or values) for it. The |
1495
|
|
|
|
|
|
|
value(s) returned are the return values or emissions from the asychronous |
1496
|
|
|
|
|
|
|
callback executed with L which produced the process object. |
1497
|
|
|
|
|
|
|
|
1498
|
|
|
|
|
|
|
I> |
1499
|
|
|
|
|
|
|
|
1500
|
|
|
|
|
|
|
=over 4 |
1501
|
|
|
|
|
|
|
|
1502
|
|
|
|
|
|
|
=item await example 1 |
1503
|
|
|
|
|
|
|
|
1504
|
|
|
|
|
|
|
package main; |
1505
|
|
|
|
|
|
|
|
1506
|
|
|
|
|
|
|
use Venus 'async', 'await'; |
1507
|
|
|
|
|
|
|
|
1508
|
|
|
|
|
|
|
my $process; |
1509
|
|
|
|
|
|
|
|
1510
|
|
|
|
|
|
|
my $async = async sub{ |
1511
|
|
|
|
|
|
|
($process) = @_; |
1512
|
|
|
|
|
|
|
# in forked process ... |
1513
|
|
|
|
|
|
|
return 'done'; |
1514
|
|
|
|
|
|
|
}; |
1515
|
|
|
|
|
|
|
|
1516
|
|
|
|
|
|
|
my $await = await $async; |
1517
|
|
|
|
|
|
|
|
1518
|
|
|
|
|
|
|
# ['done'] |
1519
|
|
|
|
|
|
|
|
1520
|
|
|
|
|
|
|
=back |
1521
|
|
|
|
|
|
|
|
1522
|
|
|
|
|
|
|
=cut |
1523
|
|
|
|
|
|
|
|
1524
|
|
|
|
|
|
|
=head2 bool |
1525
|
|
|
|
|
|
|
|
1526
|
|
|
|
|
|
|
bool(Any $value) (Boolean) |
1527
|
|
|
|
|
|
|
|
1528
|
|
|
|
|
|
|
The bool function builds and returns a L object. |
1529
|
|
|
|
|
|
|
|
1530
|
|
|
|
|
|
|
I> |
1531
|
|
|
|
|
|
|
|
1532
|
|
|
|
|
|
|
=over 4 |
1533
|
|
|
|
|
|
|
|
1534
|
|
|
|
|
|
|
=item bool example 1 |
1535
|
|
|
|
|
|
|
|
1536
|
|
|
|
|
|
|
package main; |
1537
|
|
|
|
|
|
|
|
1538
|
|
|
|
|
|
|
use Venus 'bool'; |
1539
|
|
|
|
|
|
|
|
1540
|
|
|
|
|
|
|
my $bool = bool; |
1541
|
|
|
|
|
|
|
|
1542
|
|
|
|
|
|
|
# bless({value => 0}, 'Venus::Boolean') |
1543
|
|
|
|
|
|
|
|
1544
|
|
|
|
|
|
|
=back |
1545
|
|
|
|
|
|
|
|
1546
|
|
|
|
|
|
|
=over 4 |
1547
|
|
|
|
|
|
|
|
1548
|
|
|
|
|
|
|
=item bool example 2 |
1549
|
|
|
|
|
|
|
|
1550
|
|
|
|
|
|
|
package main; |
1551
|
|
|
|
|
|
|
|
1552
|
|
|
|
|
|
|
use Venus 'bool'; |
1553
|
|
|
|
|
|
|
|
1554
|
|
|
|
|
|
|
my $bool = bool 1_000; |
1555
|
|
|
|
|
|
|
|
1556
|
|
|
|
|
|
|
# bless({value => 1}, 'Venus::Boolean') |
1557
|
|
|
|
|
|
|
|
1558
|
|
|
|
|
|
|
=back |
1559
|
|
|
|
|
|
|
|
1560
|
|
|
|
|
|
|
=cut |
1561
|
|
|
|
|
|
|
|
1562
|
|
|
|
|
|
|
=head2 box |
1563
|
|
|
|
|
|
|
|
1564
|
|
|
|
|
|
|
box(Any $data) (Box) |
1565
|
|
|
|
|
|
|
|
1566
|
|
|
|
|
|
|
The box function returns a L object for the argument provided. |
1567
|
|
|
|
|
|
|
|
1568
|
|
|
|
|
|
|
I> |
1569
|
|
|
|
|
|
|
|
1570
|
|
|
|
|
|
|
=over 4 |
1571
|
|
|
|
|
|
|
|
1572
|
|
|
|
|
|
|
=item box example 1 |
1573
|
|
|
|
|
|
|
|
1574
|
|
|
|
|
|
|
package main; |
1575
|
|
|
|
|
|
|
|
1576
|
|
|
|
|
|
|
use Venus 'box'; |
1577
|
|
|
|
|
|
|
|
1578
|
|
|
|
|
|
|
my $box = box({}); |
1579
|
|
|
|
|
|
|
|
1580
|
|
|
|
|
|
|
# bless({value => bless({value => {}}, 'Venus::Hash')}, 'Venus::Box') |
1581
|
|
|
|
|
|
|
|
1582
|
|
|
|
|
|
|
=back |
1583
|
|
|
|
|
|
|
|
1584
|
|
|
|
|
|
|
=over 4 |
1585
|
|
|
|
|
|
|
|
1586
|
|
|
|
|
|
|
=item box example 2 |
1587
|
|
|
|
|
|
|
|
1588
|
|
|
|
|
|
|
package main; |
1589
|
|
|
|
|
|
|
|
1590
|
|
|
|
|
|
|
use Venus 'box'; |
1591
|
|
|
|
|
|
|
|
1592
|
|
|
|
|
|
|
my $box = box([]); |
1593
|
|
|
|
|
|
|
|
1594
|
|
|
|
|
|
|
# bless({value => bless({value => []}, 'Venus::Array')}, 'Venus::Box') |
1595
|
|
|
|
|
|
|
|
1596
|
|
|
|
|
|
|
=back |
1597
|
|
|
|
|
|
|
|
1598
|
|
|
|
|
|
|
=cut |
1599
|
|
|
|
|
|
|
|
1600
|
|
|
|
|
|
|
=head2 call |
1601
|
|
|
|
|
|
|
|
1602
|
|
|
|
|
|
|
call(Str | Object | CodeRef $data, Any @args) (Any) |
1603
|
|
|
|
|
|
|
|
1604
|
|
|
|
|
|
|
The call function dispatches function and method calls to a package and returns |
1605
|
|
|
|
|
|
|
the result. |
1606
|
|
|
|
|
|
|
|
1607
|
|
|
|
|
|
|
I> |
1608
|
|
|
|
|
|
|
|
1609
|
|
|
|
|
|
|
=over 4 |
1610
|
|
|
|
|
|
|
|
1611
|
|
|
|
|
|
|
=item call example 1 |
1612
|
|
|
|
|
|
|
|
1613
|
|
|
|
|
|
|
package main; |
1614
|
|
|
|
|
|
|
|
1615
|
|
|
|
|
|
|
use Venus 'call'; |
1616
|
|
|
|
|
|
|
|
1617
|
|
|
|
|
|
|
require Digest::SHA; |
1618
|
|
|
|
|
|
|
|
1619
|
|
|
|
|
|
|
my $result = call(\'Digest::SHA', 'new'); |
1620
|
|
|
|
|
|
|
|
1621
|
|
|
|
|
|
|
# bless(do{\(my $o = '...')}, 'digest::sha') |
1622
|
|
|
|
|
|
|
|
1623
|
|
|
|
|
|
|
=back |
1624
|
|
|
|
|
|
|
|
1625
|
|
|
|
|
|
|
=over 4 |
1626
|
|
|
|
|
|
|
|
1627
|
|
|
|
|
|
|
=item call example 2 |
1628
|
|
|
|
|
|
|
|
1629
|
|
|
|
|
|
|
package main; |
1630
|
|
|
|
|
|
|
|
1631
|
|
|
|
|
|
|
use Venus 'call'; |
1632
|
|
|
|
|
|
|
|
1633
|
|
|
|
|
|
|
require Digest::SHA; |
1634
|
|
|
|
|
|
|
|
1635
|
|
|
|
|
|
|
my $result = call('Digest::SHA', 'sha1_hex'); |
1636
|
|
|
|
|
|
|
|
1637
|
|
|
|
|
|
|
# "da39a3ee5e6b4b0d3255bfef95601890afd80709" |
1638
|
|
|
|
|
|
|
|
1639
|
|
|
|
|
|
|
=back |
1640
|
|
|
|
|
|
|
|
1641
|
|
|
|
|
|
|
=over 4 |
1642
|
|
|
|
|
|
|
|
1643
|
|
|
|
|
|
|
=item call example 3 |
1644
|
|
|
|
|
|
|
|
1645
|
|
|
|
|
|
|
package main; |
1646
|
|
|
|
|
|
|
|
1647
|
|
|
|
|
|
|
use Venus 'call'; |
1648
|
|
|
|
|
|
|
|
1649
|
|
|
|
|
|
|
require Venus::Hash; |
1650
|
|
|
|
|
|
|
|
1651
|
|
|
|
|
|
|
my $result = call(sub{'Venus::Hash'->new(@_)}, {1..4}); |
1652
|
|
|
|
|
|
|
|
1653
|
|
|
|
|
|
|
# bless({value => {1..4}}, 'Venus::Hash') |
1654
|
|
|
|
|
|
|
|
1655
|
|
|
|
|
|
|
=back |
1656
|
|
|
|
|
|
|
|
1657
|
|
|
|
|
|
|
=over 4 |
1658
|
|
|
|
|
|
|
|
1659
|
|
|
|
|
|
|
=item call example 4 |
1660
|
|
|
|
|
|
|
|
1661
|
|
|
|
|
|
|
package main; |
1662
|
|
|
|
|
|
|
|
1663
|
|
|
|
|
|
|
use Venus 'call'; |
1664
|
|
|
|
|
|
|
|
1665
|
|
|
|
|
|
|
require Venus::Box; |
1666
|
|
|
|
|
|
|
|
1667
|
|
|
|
|
|
|
my $result = call(Venus::Box->new(value => {}), 'merge', {1..4}); |
1668
|
|
|
|
|
|
|
|
1669
|
|
|
|
|
|
|
# bless({value => bless({value => {1..4}}, 'Venus::Hash')}, 'Venus::Box') |
1670
|
|
|
|
|
|
|
|
1671
|
|
|
|
|
|
|
=back |
1672
|
|
|
|
|
|
|
|
1673
|
|
|
|
|
|
|
=cut |
1674
|
|
|
|
|
|
|
|
1675
|
|
|
|
|
|
|
=head2 cast |
1676
|
|
|
|
|
|
|
|
1677
|
|
|
|
|
|
|
cast(Any $data, Str $type) (Object) |
1678
|
|
|
|
|
|
|
|
1679
|
|
|
|
|
|
|
The cast function returns the argument provided as an object, promoting native |
1680
|
|
|
|
|
|
|
Perl data types to data type objects. The optional second argument can be the |
1681
|
|
|
|
|
|
|
name of the type for the object to cast to explicitly. |
1682
|
|
|
|
|
|
|
|
1683
|
|
|
|
|
|
|
I> |
1684
|
|
|
|
|
|
|
|
1685
|
|
|
|
|
|
|
=over 4 |
1686
|
|
|
|
|
|
|
|
1687
|
|
|
|
|
|
|
=item cast example 1 |
1688
|
|
|
|
|
|
|
|
1689
|
|
|
|
|
|
|
package main; |
1690
|
|
|
|
|
|
|
|
1691
|
|
|
|
|
|
|
use Venus 'cast'; |
1692
|
|
|
|
|
|
|
|
1693
|
|
|
|
|
|
|
my $undef = cast; |
1694
|
|
|
|
|
|
|
|
1695
|
|
|
|
|
|
|
# bless({value => undef}, "Venus::Undef") |
1696
|
|
|
|
|
|
|
|
1697
|
|
|
|
|
|
|
=back |
1698
|
|
|
|
|
|
|
|
1699
|
|
|
|
|
|
|
=over 4 |
1700
|
|
|
|
|
|
|
|
1701
|
|
|
|
|
|
|
=item cast example 2 |
1702
|
|
|
|
|
|
|
|
1703
|
|
|
|
|
|
|
package main; |
1704
|
|
|
|
|
|
|
|
1705
|
|
|
|
|
|
|
use Venus 'cast'; |
1706
|
|
|
|
|
|
|
|
1707
|
|
|
|
|
|
|
my @booleans = map cast, true, false; |
1708
|
|
|
|
|
|
|
|
1709
|
|
|
|
|
|
|
# (bless({value => 1}, "Venus::Boolean"), bless({value => 0}, "Venus::Boolean")) |
1710
|
|
|
|
|
|
|
|
1711
|
|
|
|
|
|
|
=back |
1712
|
|
|
|
|
|
|
|
1713
|
|
|
|
|
|
|
=over 4 |
1714
|
|
|
|
|
|
|
|
1715
|
|
|
|
|
|
|
=item cast example 3 |
1716
|
|
|
|
|
|
|
|
1717
|
|
|
|
|
|
|
package main; |
1718
|
|
|
|
|
|
|
|
1719
|
|
|
|
|
|
|
use Venus 'cast'; |
1720
|
|
|
|
|
|
|
|
1721
|
|
|
|
|
|
|
my $example = cast bless({}, "Example"); |
1722
|
|
|
|
|
|
|
|
1723
|
|
|
|
|
|
|
# bless({value => 1}, "Example") |
1724
|
|
|
|
|
|
|
|
1725
|
|
|
|
|
|
|
=back |
1726
|
|
|
|
|
|
|
|
1727
|
|
|
|
|
|
|
=over 4 |
1728
|
|
|
|
|
|
|
|
1729
|
|
|
|
|
|
|
=item cast example 4 |
1730
|
|
|
|
|
|
|
|
1731
|
|
|
|
|
|
|
package main; |
1732
|
|
|
|
|
|
|
|
1733
|
|
|
|
|
|
|
use Venus 'cast'; |
1734
|
|
|
|
|
|
|
|
1735
|
|
|
|
|
|
|
my $float = cast 1.23; |
1736
|
|
|
|
|
|
|
|
1737
|
|
|
|
|
|
|
# bless({value => "1.23"}, "Venus::Float") |
1738
|
|
|
|
|
|
|
|
1739
|
|
|
|
|
|
|
=back |
1740
|
|
|
|
|
|
|
|
1741
|
|
|
|
|
|
|
=cut |
1742
|
|
|
|
|
|
|
|
1743
|
|
|
|
|
|
|
=head2 catch |
1744
|
|
|
|
|
|
|
|
1745
|
|
|
|
|
|
|
catch(CodeRef $block) (Error, Any) |
1746
|
|
|
|
|
|
|
|
1747
|
|
|
|
|
|
|
The catch function executes the code block trapping errors and returning the |
1748
|
|
|
|
|
|
|
caught exception in scalar context, and also returning the result as a second |
1749
|
|
|
|
|
|
|
argument in list context. |
1750
|
|
|
|
|
|
|
|
1751
|
|
|
|
|
|
|
I> |
1752
|
|
|
|
|
|
|
|
1753
|
|
|
|
|
|
|
=over 4 |
1754
|
|
|
|
|
|
|
|
1755
|
|
|
|
|
|
|
=item catch example 1 |
1756
|
|
|
|
|
|
|
|
1757
|
|
|
|
|
|
|
package main; |
1758
|
|
|
|
|
|
|
|
1759
|
|
|
|
|
|
|
use Venus 'catch'; |
1760
|
|
|
|
|
|
|
|
1761
|
|
|
|
|
|
|
my $error = catch {die}; |
1762
|
|
|
|
|
|
|
|
1763
|
|
|
|
|
|
|
$error; |
1764
|
|
|
|
|
|
|
|
1765
|
|
|
|
|
|
|
# "Died at ..." |
1766
|
|
|
|
|
|
|
|
1767
|
|
|
|
|
|
|
=back |
1768
|
|
|
|
|
|
|
|
1769
|
|
|
|
|
|
|
=over 4 |
1770
|
|
|
|
|
|
|
|
1771
|
|
|
|
|
|
|
=item catch example 2 |
1772
|
|
|
|
|
|
|
|
1773
|
|
|
|
|
|
|
package main; |
1774
|
|
|
|
|
|
|
|
1775
|
|
|
|
|
|
|
use Venus 'catch'; |
1776
|
|
|
|
|
|
|
|
1777
|
|
|
|
|
|
|
my ($error, $result) = catch {error}; |
1778
|
|
|
|
|
|
|
|
1779
|
|
|
|
|
|
|
$error; |
1780
|
|
|
|
|
|
|
|
1781
|
|
|
|
|
|
|
# bless({...}, 'Venus::Error') |
1782
|
|
|
|
|
|
|
|
1783
|
|
|
|
|
|
|
=back |
1784
|
|
|
|
|
|
|
|
1785
|
|
|
|
|
|
|
=over 4 |
1786
|
|
|
|
|
|
|
|
1787
|
|
|
|
|
|
|
=item catch example 3 |
1788
|
|
|
|
|
|
|
|
1789
|
|
|
|
|
|
|
package main; |
1790
|
|
|
|
|
|
|
|
1791
|
|
|
|
|
|
|
use Venus 'catch'; |
1792
|
|
|
|
|
|
|
|
1793
|
|
|
|
|
|
|
my ($error, $result) = catch {true}; |
1794
|
|
|
|
|
|
|
|
1795
|
|
|
|
|
|
|
$result; |
1796
|
|
|
|
|
|
|
|
1797
|
|
|
|
|
|
|
# 1 |
1798
|
|
|
|
|
|
|
|
1799
|
|
|
|
|
|
|
=back |
1800
|
|
|
|
|
|
|
|
1801
|
|
|
|
|
|
|
=cut |
1802
|
|
|
|
|
|
|
|
1803
|
|
|
|
|
|
|
=head2 caught |
1804
|
|
|
|
|
|
|
|
1805
|
|
|
|
|
|
|
caught(Object $error, Str | Tuple[Str, Str] $identity, CodeRef $block) (Any) |
1806
|
|
|
|
|
|
|
|
1807
|
|
|
|
|
|
|
The caught function evaluates the exception object provided and validates its |
1808
|
|
|
|
|
|
|
identity and name (if provided) then executes the code block provided returning |
1809
|
|
|
|
|
|
|
the result of the callback. If no callback is provided this function returns |
1810
|
|
|
|
|
|
|
the exception object on success and C on failure. |
1811
|
|
|
|
|
|
|
|
1812
|
|
|
|
|
|
|
I> |
1813
|
|
|
|
|
|
|
|
1814
|
|
|
|
|
|
|
=over 4 |
1815
|
|
|
|
|
|
|
|
1816
|
|
|
|
|
|
|
=item caught example 1 |
1817
|
|
|
|
|
|
|
|
1818
|
|
|
|
|
|
|
package main; |
1819
|
|
|
|
|
|
|
|
1820
|
|
|
|
|
|
|
use Venus 'catch', 'caught', 'error'; |
1821
|
|
|
|
|
|
|
|
1822
|
|
|
|
|
|
|
my $error = catch { error }; |
1823
|
|
|
|
|
|
|
|
1824
|
|
|
|
|
|
|
my $result = caught $error, 'Venus::Error'; |
1825
|
|
|
|
|
|
|
|
1826
|
|
|
|
|
|
|
# bless(..., 'Venus::Error') |
1827
|
|
|
|
|
|
|
|
1828
|
|
|
|
|
|
|
=back |
1829
|
|
|
|
|
|
|
|
1830
|
|
|
|
|
|
|
=over 4 |
1831
|
|
|
|
|
|
|
|
1832
|
|
|
|
|
|
|
=item caught example 2 |
1833
|
|
|
|
|
|
|
|
1834
|
|
|
|
|
|
|
package main; |
1835
|
|
|
|
|
|
|
|
1836
|
|
|
|
|
|
|
use Venus 'catch', 'caught', 'raise'; |
1837
|
|
|
|
|
|
|
|
1838
|
|
|
|
|
|
|
my $error = catch { raise 'Example::Error' }; |
1839
|
|
|
|
|
|
|
|
1840
|
|
|
|
|
|
|
my $result = caught $error, 'Venus::Error'; |
1841
|
|
|
|
|
|
|
|
1842
|
|
|
|
|
|
|
# bless(..., 'Venus::Error') |
1843
|
|
|
|
|
|
|
|
1844
|
|
|
|
|
|
|
=back |
1845
|
|
|
|
|
|
|
|
1846
|
|
|
|
|
|
|
=over 4 |
1847
|
|
|
|
|
|
|
|
1848
|
|
|
|
|
|
|
=item caught example 3 |
1849
|
|
|
|
|
|
|
|
1850
|
|
|
|
|
|
|
package main; |
1851
|
|
|
|
|
|
|
|
1852
|
|
|
|
|
|
|
use Venus 'catch', 'caught', 'raise'; |
1853
|
|
|
|
|
|
|
|
1854
|
|
|
|
|
|
|
my $error = catch { raise 'Example::Error' }; |
1855
|
|
|
|
|
|
|
|
1856
|
|
|
|
|
|
|
my $result = caught $error, 'Example::Error'; |
1857
|
|
|
|
|
|
|
|
1858
|
|
|
|
|
|
|
# bless(..., 'Venus::Error') |
1859
|
|
|
|
|
|
|
|
1860
|
|
|
|
|
|
|
=back |
1861
|
|
|
|
|
|
|
|
1862
|
|
|
|
|
|
|
=over 4 |
1863
|
|
|
|
|
|
|
|
1864
|
|
|
|
|
|
|
=item caught example 4 |
1865
|
|
|
|
|
|
|
|
1866
|
|
|
|
|
|
|
package main; |
1867
|
|
|
|
|
|
|
|
1868
|
|
|
|
|
|
|
use Venus 'catch', 'caught', 'raise'; |
1869
|
|
|
|
|
|
|
|
1870
|
|
|
|
|
|
|
my $error = catch { raise 'Example::Error', { name => 'on.test' } }; |
1871
|
|
|
|
|
|
|
|
1872
|
|
|
|
|
|
|
my $result = caught $error, ['Example::Error', 'on.test']; |
1873
|
|
|
|
|
|
|
|
1874
|
|
|
|
|
|
|
# bless(..., 'Venus::Error') |
1875
|
|
|
|
|
|
|
|
1876
|
|
|
|
|
|
|
=back |
1877
|
|
|
|
|
|
|
|
1878
|
|
|
|
|
|
|
=over 4 |
1879
|
|
|
|
|
|
|
|
1880
|
|
|
|
|
|
|
=item caught example 5 |
1881
|
|
|
|
|
|
|
|
1882
|
|
|
|
|
|
|
package main; |
1883
|
|
|
|
|
|
|
|
1884
|
|
|
|
|
|
|
use Venus 'catch', 'caught', 'raise'; |
1885
|
|
|
|
|
|
|
|
1886
|
|
|
|
|
|
|
my $error = catch { raise 'Example::Error', { name => 'on.recv' } }; |
1887
|
|
|
|
|
|
|
|
1888
|
|
|
|
|
|
|
my $result = caught $error, ['Example::Error', 'on.send']; |
1889
|
|
|
|
|
|
|
|
1890
|
|
|
|
|
|
|
# undef |
1891
|
|
|
|
|
|
|
|
1892
|
|
|
|
|
|
|
=back |
1893
|
|
|
|
|
|
|
|
1894
|
|
|
|
|
|
|
=over 4 |
1895
|
|
|
|
|
|
|
|
1896
|
|
|
|
|
|
|
=item caught example 6 |
1897
|
|
|
|
|
|
|
|
1898
|
|
|
|
|
|
|
package main; |
1899
|
|
|
|
|
|
|
|
1900
|
|
|
|
|
|
|
use Venus 'catch', 'caught', 'error'; |
1901
|
|
|
|
|
|
|
|
1902
|
|
|
|
|
|
|
my $error = catch { error }; |
1903
|
|
|
|
|
|
|
|
1904
|
|
|
|
|
|
|
my $result = caught $error, ['Example::Error', 'on.send']; |
1905
|
|
|
|
|
|
|
|
1906
|
|
|
|
|
|
|
# undef |
1907
|
|
|
|
|
|
|
|
1908
|
|
|
|
|
|
|
=back |
1909
|
|
|
|
|
|
|
|
1910
|
|
|
|
|
|
|
=over 4 |
1911
|
|
|
|
|
|
|
|
1912
|
|
|
|
|
|
|
=item caught example 7 |
1913
|
|
|
|
|
|
|
|
1914
|
|
|
|
|
|
|
package main; |
1915
|
|
|
|
|
|
|
|
1916
|
|
|
|
|
|
|
use Venus 'catch', 'caught', 'error'; |
1917
|
|
|
|
|
|
|
|
1918
|
|
|
|
|
|
|
my $error = catch { error }; |
1919
|
|
|
|
|
|
|
|
1920
|
|
|
|
|
|
|
my $result = caught $error, ['Example::Error']; |
1921
|
|
|
|
|
|
|
|
1922
|
|
|
|
|
|
|
# undef |
1923
|
|
|
|
|
|
|
|
1924
|
|
|
|
|
|
|
=back |
1925
|
|
|
|
|
|
|
|
1926
|
|
|
|
|
|
|
=over 4 |
1927
|
|
|
|
|
|
|
|
1928
|
|
|
|
|
|
|
=item caught example 8 |
1929
|
|
|
|
|
|
|
|
1930
|
|
|
|
|
|
|
package main; |
1931
|
|
|
|
|
|
|
|
1932
|
|
|
|
|
|
|
use Venus 'catch', 'caught', 'error'; |
1933
|
|
|
|
|
|
|
|
1934
|
|
|
|
|
|
|
my $error = catch { error }; |
1935
|
|
|
|
|
|
|
|
1936
|
|
|
|
|
|
|
my $result = caught $error, 'Example::Error'; |
1937
|
|
|
|
|
|
|
|
1938
|
|
|
|
|
|
|
# undef |
1939
|
|
|
|
|
|
|
|
1940
|
|
|
|
|
|
|
=back |
1941
|
|
|
|
|
|
|
|
1942
|
|
|
|
|
|
|
=over 4 |
1943
|
|
|
|
|
|
|
|
1944
|
|
|
|
|
|
|
=item caught example 9 |
1945
|
|
|
|
|
|
|
|
1946
|
|
|
|
|
|
|
package main; |
1947
|
|
|
|
|
|
|
|
1948
|
|
|
|
|
|
|
use Venus 'catch', 'caught', 'error'; |
1949
|
|
|
|
|
|
|
|
1950
|
|
|
|
|
|
|
my $error = catch { error { name => 'on.send' } }; |
1951
|
|
|
|
|
|
|
|
1952
|
|
|
|
|
|
|
my $result = caught $error, ['Venus::Error', 'on.send']; |
1953
|
|
|
|
|
|
|
|
1954
|
|
|
|
|
|
|
# bless(..., 'Venus::Error') |
1955
|
|
|
|
|
|
|
|
1956
|
|
|
|
|
|
|
=back |
1957
|
|
|
|
|
|
|
|
1958
|
|
|
|
|
|
|
=over 4 |
1959
|
|
|
|
|
|
|
|
1960
|
|
|
|
|
|
|
=item caught example 10 |
1961
|
|
|
|
|
|
|
|
1962
|
|
|
|
|
|
|
package main; |
1963
|
|
|
|
|
|
|
|
1964
|
|
|
|
|
|
|
use Venus 'catch', 'caught', 'error'; |
1965
|
|
|
|
|
|
|
|
1966
|
|
|
|
|
|
|
my $error = catch { error { name => 'on.send.open' } }; |
1967
|
|
|
|
|
|
|
|
1968
|
|
|
|
|
|
|
my $result = caught $error, ['Venus::Error', 'on.send'], sub { |
1969
|
|
|
|
|
|
|
$error->stash('caught', true) if $error->is('on.send.open'); |
1970
|
|
|
|
|
|
|
return $error; |
1971
|
|
|
|
|
|
|
}; |
1972
|
|
|
|
|
|
|
|
1973
|
|
|
|
|
|
|
# bless(..., 'Venus::Error') |
1974
|
|
|
|
|
|
|
|
1975
|
|
|
|
|
|
|
=back |
1976
|
|
|
|
|
|
|
|
1977
|
|
|
|
|
|
|
=cut |
1978
|
|
|
|
|
|
|
|
1979
|
|
|
|
|
|
|
=head2 chain |
1980
|
|
|
|
|
|
|
|
1981
|
|
|
|
|
|
|
chain(Str | Object | CodeRef $self, Str | ArrayRef[Str] @args) (Any) |
1982
|
|
|
|
|
|
|
|
1983
|
|
|
|
|
|
|
The chain function chains function and method calls to a package (and return |
1984
|
|
|
|
|
|
|
values) and returns the result. |
1985
|
|
|
|
|
|
|
|
1986
|
|
|
|
|
|
|
I> |
1987
|
|
|
|
|
|
|
|
1988
|
|
|
|
|
|
|
=over 4 |
1989
|
|
|
|
|
|
|
|
1990
|
|
|
|
|
|
|
=item chain example 1 |
1991
|
|
|
|
|
|
|
|
1992
|
|
|
|
|
|
|
package main; |
1993
|
|
|
|
|
|
|
|
1994
|
|
|
|
|
|
|
use Venus 'chain'; |
1995
|
|
|
|
|
|
|
|
1996
|
|
|
|
|
|
|
my $result = chain('Venus::Path', ['new', 't'], 'exists'); |
1997
|
|
|
|
|
|
|
|
1998
|
|
|
|
|
|
|
# 1 |
1999
|
|
|
|
|
|
|
|
2000
|
|
|
|
|
|
|
=back |
2001
|
|
|
|
|
|
|
|
2002
|
|
|
|
|
|
|
=over 4 |
2003
|
|
|
|
|
|
|
|
2004
|
|
|
|
|
|
|
=item chain example 2 |
2005
|
|
|
|
|
|
|
|
2006
|
|
|
|
|
|
|
package main; |
2007
|
|
|
|
|
|
|
|
2008
|
|
|
|
|
|
|
use Venus 'chain'; |
2009
|
|
|
|
|
|
|
|
2010
|
|
|
|
|
|
|
my $result = chain('Venus::Path', ['new', 't'], ['test', 'd']); |
2011
|
|
|
|
|
|
|
|
2012
|
|
|
|
|
|
|
# 1 |
2013
|
|
|
|
|
|
|
|
2014
|
|
|
|
|
|
|
=back |
2015
|
|
|
|
|
|
|
|
2016
|
|
|
|
|
|
|
=cut |
2017
|
|
|
|
|
|
|
|
2018
|
|
|
|
|
|
|
=head2 check |
2019
|
|
|
|
|
|
|
|
2020
|
|
|
|
|
|
|
check(Any $data, Str $expr) (Bool) |
2021
|
|
|
|
|
|
|
|
2022
|
|
|
|
|
|
|
The check function builds a L object and returns the result of |
2023
|
|
|
|
|
|
|
a L operation. |
2024
|
|
|
|
|
|
|
|
2025
|
|
|
|
|
|
|
I> |
2026
|
|
|
|
|
|
|
|
2027
|
|
|
|
|
|
|
=over 4 |
2028
|
|
|
|
|
|
|
|
2029
|
|
|
|
|
|
|
=item check example 1 |
2030
|
|
|
|
|
|
|
|
2031
|
|
|
|
|
|
|
package main; |
2032
|
|
|
|
|
|
|
|
2033
|
|
|
|
|
|
|
use Venus 'check'; |
2034
|
|
|
|
|
|
|
|
2035
|
|
|
|
|
|
|
my $check = check(rand, 'float'); |
2036
|
|
|
|
|
|
|
|
2037
|
|
|
|
|
|
|
# true |
2038
|
|
|
|
|
|
|
|
2039
|
|
|
|
|
|
|
=back |
2040
|
|
|
|
|
|
|
|
2041
|
|
|
|
|
|
|
=over 4 |
2042
|
|
|
|
|
|
|
|
2043
|
|
|
|
|
|
|
=item check example 2 |
2044
|
|
|
|
|
|
|
|
2045
|
|
|
|
|
|
|
package main; |
2046
|
|
|
|
|
|
|
|
2047
|
|
|
|
|
|
|
use Venus 'check'; |
2048
|
|
|
|
|
|
|
|
2049
|
|
|
|
|
|
|
my $check = check(rand, 'string'); |
2050
|
|
|
|
|
|
|
|
2051
|
|
|
|
|
|
|
# false |
2052
|
|
|
|
|
|
|
|
2053
|
|
|
|
|
|
|
=back |
2054
|
|
|
|
|
|
|
|
2055
|
|
|
|
|
|
|
=cut |
2056
|
|
|
|
|
|
|
|
2057
|
|
|
|
|
|
|
=head2 clargs |
2058
|
|
|
|
|
|
|
|
2059
|
|
|
|
|
|
|
clargs(ArrayRef $args, ArrayRef $spec) (Args, Opts, Vars) |
2060
|
|
|
|
|
|
|
|
2061
|
|
|
|
|
|
|
The clargs function accepts a single arrayref of L specs, or an |
2062
|
|
|
|
|
|
|
arrayref of arguments followed by an arrayref of L specs, and |
2063
|
|
|
|
|
|
|
returns a three element list of L, L, and |
2064
|
|
|
|
|
|
|
L objects. If only a single arrayref is provided, the arguments |
2065
|
|
|
|
|
|
|
will be taken from C<@ARGV>. |
2066
|
|
|
|
|
|
|
|
2067
|
|
|
|
|
|
|
I> |
2068
|
|
|
|
|
|
|
|
2069
|
|
|
|
|
|
|
=over 4 |
2070
|
|
|
|
|
|
|
|
2071
|
|
|
|
|
|
|
=item clargs example 1 |
2072
|
|
|
|
|
|
|
|
2073
|
|
|
|
|
|
|
package main; |
2074
|
|
|
|
|
|
|
|
2075
|
|
|
|
|
|
|
use Venus 'clargs'; |
2076
|
|
|
|
|
|
|
|
2077
|
|
|
|
|
|
|
my ($args, $opts, $vars) = clargs; |
2078
|
|
|
|
|
|
|
|
2079
|
|
|
|
|
|
|
# ( |
2080
|
|
|
|
|
|
|
# bless(..., 'Venus::Args'), |
2081
|
|
|
|
|
|
|
# bless(..., 'Venus::Opts'), |
2082
|
|
|
|
|
|
|
# bless(..., 'Venus::Vars') |
2083
|
|
|
|
|
|
|
# ) |
2084
|
|
|
|
|
|
|
|
2085
|
|
|
|
|
|
|
=back |
2086
|
|
|
|
|
|
|
|
2087
|
|
|
|
|
|
|
=over 4 |
2088
|
|
|
|
|
|
|
|
2089
|
|
|
|
|
|
|
=item clargs example 2 |
2090
|
|
|
|
|
|
|
|
2091
|
|
|
|
|
|
|
package main; |
2092
|
|
|
|
|
|
|
|
2093
|
|
|
|
|
|
|
use Venus 'clargs'; |
2094
|
|
|
|
|
|
|
|
2095
|
|
|
|
|
|
|
my ($args, $opts, $vars) = clargs ['resource|r=s', 'help|h']; |
2096
|
|
|
|
|
|
|
|
2097
|
|
|
|
|
|
|
# ( |
2098
|
|
|
|
|
|
|
# bless(..., 'Venus::Args'), |
2099
|
|
|
|
|
|
|
# bless(..., 'Venus::Opts'), |
2100
|
|
|
|
|
|
|
# bless(..., 'Venus::Vars') |
2101
|
|
|
|
|
|
|
# ) |
2102
|
|
|
|
|
|
|
|
2103
|
|
|
|
|
|
|
=back |
2104
|
|
|
|
|
|
|
|
2105
|
|
|
|
|
|
|
=over 4 |
2106
|
|
|
|
|
|
|
|
2107
|
|
|
|
|
|
|
=item clargs example 3 |
2108
|
|
|
|
|
|
|
|
2109
|
|
|
|
|
|
|
package main; |
2110
|
|
|
|
|
|
|
|
2111
|
|
|
|
|
|
|
use Venus 'clargs'; |
2112
|
|
|
|
|
|
|
|
2113
|
|
|
|
|
|
|
my ($args, $opts, $vars) = clargs ['--resource', 'help'], |
2114
|
|
|
|
|
|
|
['resource|r=s', 'help|h']; |
2115
|
|
|
|
|
|
|
|
2116
|
|
|
|
|
|
|
# ( |
2117
|
|
|
|
|
|
|
# bless(..., 'Venus::Args'), |
2118
|
|
|
|
|
|
|
# bless(..., 'Venus::Opts'), |
2119
|
|
|
|
|
|
|
# bless(..., 'Venus::Vars') |
2120
|
|
|
|
|
|
|
# ) |
2121
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
=back |
2123
|
|
|
|
|
|
|
|
2124
|
|
|
|
|
|
|
=cut |
2125
|
|
|
|
|
|
|
|
2126
|
|
|
|
|
|
|
=head2 cli |
2127
|
|
|
|
|
|
|
|
2128
|
|
|
|
|
|
|
cli(ArrayRef $args) (Cli) |
2129
|
|
|
|
|
|
|
|
2130
|
|
|
|
|
|
|
The cli function builds and returns a L object. |
2131
|
|
|
|
|
|
|
|
2132
|
|
|
|
|
|
|
I> |
2133
|
|
|
|
|
|
|
|
2134
|
|
|
|
|
|
|
=over 4 |
2135
|
|
|
|
|
|
|
|
2136
|
|
|
|
|
|
|
=item cli example 1 |
2137
|
|
|
|
|
|
|
|
2138
|
|
|
|
|
|
|
package main; |
2139
|
|
|
|
|
|
|
|
2140
|
|
|
|
|
|
|
use Venus 'cli'; |
2141
|
|
|
|
|
|
|
|
2142
|
|
|
|
|
|
|
my $cli = cli; |
2143
|
|
|
|
|
|
|
|
2144
|
|
|
|
|
|
|
# bless({...}, 'Venus::Cli') |
2145
|
|
|
|
|
|
|
|
2146
|
|
|
|
|
|
|
=back |
2147
|
|
|
|
|
|
|
|
2148
|
|
|
|
|
|
|
=over 4 |
2149
|
|
|
|
|
|
|
|
2150
|
|
|
|
|
|
|
=item cli example 2 |
2151
|
|
|
|
|
|
|
|
2152
|
|
|
|
|
|
|
package main; |
2153
|
|
|
|
|
|
|
|
2154
|
|
|
|
|
|
|
use Venus 'cli'; |
2155
|
|
|
|
|
|
|
|
2156
|
|
|
|
|
|
|
my $cli = cli ['--help']; |
2157
|
|
|
|
|
|
|
|
2158
|
|
|
|
|
|
|
# bless({...}, 'Venus::Cli') |
2159
|
|
|
|
|
|
|
|
2160
|
|
|
|
|
|
|
# $cli->set('opt', 'help', {})->opt('help'); |
2161
|
|
|
|
|
|
|
|
2162
|
|
|
|
|
|
|
# 1 |
2163
|
|
|
|
|
|
|
|
2164
|
|
|
|
|
|
|
=back |
2165
|
|
|
|
|
|
|
|
2166
|
|
|
|
|
|
|
=cut |
2167
|
|
|
|
|
|
|
|
2168
|
|
|
|
|
|
|
=head2 code |
2169
|
|
|
|
|
|
|
|
2170
|
|
|
|
|
|
|
code(CodeRef $value, Str | CodeRef $code, Any @args) (Any) |
2171
|
|
|
|
|
|
|
|
2172
|
|
|
|
|
|
|
The code function builds and returns a L object, or dispatches |
2173
|
|
|
|
|
|
|
to the coderef or method provided. |
2174
|
|
|
|
|
|
|
|
2175
|
|
|
|
|
|
|
I> |
2176
|
|
|
|
|
|
|
|
2177
|
|
|
|
|
|
|
=over 4 |
2178
|
|
|
|
|
|
|
|
2179
|
|
|
|
|
|
|
=item code example 1 |
2180
|
|
|
|
|
|
|
|
2181
|
|
|
|
|
|
|
package main; |
2182
|
|
|
|
|
|
|
|
2183
|
|
|
|
|
|
|
use Venus 'code'; |
2184
|
|
|
|
|
|
|
|
2185
|
|
|
|
|
|
|
my $code = code sub {}; |
2186
|
|
|
|
|
|
|
|
2187
|
|
|
|
|
|
|
# bless({...}, 'Venus::Code') |
2188
|
|
|
|
|
|
|
|
2189
|
|
|
|
|
|
|
=back |
2190
|
|
|
|
|
|
|
|
2191
|
|
|
|
|
|
|
=over 4 |
2192
|
|
|
|
|
|
|
|
2193
|
|
|
|
|
|
|
=item code example 2 |
2194
|
|
|
|
|
|
|
|
2195
|
|
|
|
|
|
|
package main; |
2196
|
|
|
|
|
|
|
|
2197
|
|
|
|
|
|
|
use Venus 'code'; |
2198
|
|
|
|
|
|
|
|
2199
|
|
|
|
|
|
|
my $code = code sub {[1, @_]}, 'curry', 2,3,4; |
2200
|
|
|
|
|
|
|
|
2201
|
|
|
|
|
|
|
# sub {...} |
2202
|
|
|
|
|
|
|
|
2203
|
|
|
|
|
|
|
=back |
2204
|
|
|
|
|
|
|
|
2205
|
|
|
|
|
|
|
=cut |
2206
|
|
|
|
|
|
|
|
2207
|
|
|
|
|
|
|
=head2 config |
2208
|
|
|
|
|
|
|
|
2209
|
|
|
|
|
|
|
config(HashRef $value, Str | CodeRef $code, Any @args) (Any) |
2210
|
|
|
|
|
|
|
|
2211
|
|
|
|
|
|
|
The config function builds and returns a L object, or dispatches |
2212
|
|
|
|
|
|
|
to the coderef or method provided. |
2213
|
|
|
|
|
|
|
|
2214
|
|
|
|
|
|
|
I> |
2215
|
|
|
|
|
|
|
|
2216
|
|
|
|
|
|
|
=over 4 |
2217
|
|
|
|
|
|
|
|
2218
|
|
|
|
|
|
|
=item config example 1 |
2219
|
|
|
|
|
|
|
|
2220
|
|
|
|
|
|
|
package main; |
2221
|
|
|
|
|
|
|
|
2222
|
|
|
|
|
|
|
use Venus 'config'; |
2223
|
|
|
|
|
|
|
|
2224
|
|
|
|
|
|
|
my $config = config {}; |
2225
|
|
|
|
|
|
|
|
2226
|
|
|
|
|
|
|
# bless({...}, 'Venus::Config') |
2227
|
|
|
|
|
|
|
|
2228
|
|
|
|
|
|
|
=back |
2229
|
|
|
|
|
|
|
|
2230
|
|
|
|
|
|
|
=over 4 |
2231
|
|
|
|
|
|
|
|
2232
|
|
|
|
|
|
|
=item config example 2 |
2233
|
|
|
|
|
|
|
|
2234
|
|
|
|
|
|
|
package main; |
2235
|
|
|
|
|
|
|
|
2236
|
|
|
|
|
|
|
use Venus 'config'; |
2237
|
|
|
|
|
|
|
|
2238
|
|
|
|
|
|
|
my $config = config {}, 'read_perl', '{"data"=>1}'; |
2239
|
|
|
|
|
|
|
|
2240
|
|
|
|
|
|
|
# bless({...}, 'Venus::Config') |
2241
|
|
|
|
|
|
|
|
2242
|
|
|
|
|
|
|
=back |
2243
|
|
|
|
|
|
|
|
2244
|
|
|
|
|
|
|
=cut |
2245
|
|
|
|
|
|
|
|
2246
|
|
|
|
|
|
|
=head2 container |
2247
|
|
|
|
|
|
|
|
2248
|
|
|
|
|
|
|
container(HashRef $value, Str | CodeRef $code, Any @args) (Any) |
2249
|
|
|
|
|
|
|
|
2250
|
|
|
|
|
|
|
The container function builds and returns a L object, or |
2251
|
|
|
|
|
|
|
dispatches to the coderef or method provided. |
2252
|
|
|
|
|
|
|
|
2253
|
|
|
|
|
|
|
I> |
2254
|
|
|
|
|
|
|
|
2255
|
|
|
|
|
|
|
=over 4 |
2256
|
|
|
|
|
|
|
|
2257
|
|
|
|
|
|
|
=item container example 1 |
2258
|
|
|
|
|
|
|
|
2259
|
|
|
|
|
|
|
package main; |
2260
|
|
|
|
|
|
|
|
2261
|
|
|
|
|
|
|
use Venus 'container'; |
2262
|
|
|
|
|
|
|
|
2263
|
|
|
|
|
|
|
my $container = container {}; |
2264
|
|
|
|
|
|
|
|
2265
|
|
|
|
|
|
|
# bless({...}, 'Venus::Config') |
2266
|
|
|
|
|
|
|
|
2267
|
|
|
|
|
|
|
=back |
2268
|
|
|
|
|
|
|
|
2269
|
|
|
|
|
|
|
=over 4 |
2270
|
|
|
|
|
|
|
|
2271
|
|
|
|
|
|
|
=item container example 2 |
2272
|
|
|
|
|
|
|
|
2273
|
|
|
|
|
|
|
package main; |
2274
|
|
|
|
|
|
|
|
2275
|
|
|
|
|
|
|
use Venus 'container'; |
2276
|
|
|
|
|
|
|
|
2277
|
|
|
|
|
|
|
my $data = { |
2278
|
|
|
|
|
|
|
'$metadata' => { |
2279
|
|
|
|
|
|
|
tmplog => "/tmp/log" |
2280
|
|
|
|
|
|
|
}, |
2281
|
|
|
|
|
|
|
'$services' => { |
2282
|
|
|
|
|
|
|
log => { |
2283
|
|
|
|
|
|
|
package => "Venus/Path", |
2284
|
|
|
|
|
|
|
argument => { |
2285
|
|
|
|
|
|
|
'$metadata' => "tmplog" |
2286
|
|
|
|
|
|
|
} |
2287
|
|
|
|
|
|
|
} |
2288
|
|
|
|
|
|
|
} |
2289
|
|
|
|
|
|
|
}; |
2290
|
|
|
|
|
|
|
|
2291
|
|
|
|
|
|
|
my $log = container $data, 'resolve', 'log'; |
2292
|
|
|
|
|
|
|
|
2293
|
|
|
|
|
|
|
# bless({value => '/tmp/log'}, 'Venus::Path') |
2294
|
|
|
|
|
|
|
|
2295
|
|
|
|
|
|
|
=back |
2296
|
|
|
|
|
|
|
|
2297
|
|
|
|
|
|
|
=cut |
2298
|
|
|
|
|
|
|
|
2299
|
|
|
|
|
|
|
=head2 cop |
2300
|
|
|
|
|
|
|
|
2301
|
|
|
|
|
|
|
cop(Str | Object | CodeRef $self, Str $name) (CodeRef) |
2302
|
|
|
|
|
|
|
|
2303
|
|
|
|
|
|
|
The cop function attempts to curry the given subroutine on the object or class |
2304
|
|
|
|
|
|
|
and if successful returns a closure. |
2305
|
|
|
|
|
|
|
|
2306
|
|
|
|
|
|
|
I> |
2307
|
|
|
|
|
|
|
|
2308
|
|
|
|
|
|
|
=over 4 |
2309
|
|
|
|
|
|
|
|
2310
|
|
|
|
|
|
|
=item cop example 1 |
2311
|
|
|
|
|
|
|
|
2312
|
|
|
|
|
|
|
package main; |
2313
|
|
|
|
|
|
|
|
2314
|
|
|
|
|
|
|
use Venus 'cop'; |
2315
|
|
|
|
|
|
|
|
2316
|
|
|
|
|
|
|
my $coderef = cop('Digest::SHA', 'sha1_hex'); |
2317
|
|
|
|
|
|
|
|
2318
|
|
|
|
|
|
|
# sub { ... } |
2319
|
|
|
|
|
|
|
|
2320
|
|
|
|
|
|
|
=back |
2321
|
|
|
|
|
|
|
|
2322
|
|
|
|
|
|
|
=over 4 |
2323
|
|
|
|
|
|
|
|
2324
|
|
|
|
|
|
|
=item cop example 2 |
2325
|
|
|
|
|
|
|
|
2326
|
|
|
|
|
|
|
package main; |
2327
|
|
|
|
|
|
|
|
2328
|
|
|
|
|
|
|
use Venus 'cop'; |
2329
|
|
|
|
|
|
|
|
2330
|
|
|
|
|
|
|
require Digest::SHA; |
2331
|
|
|
|
|
|
|
|
2332
|
|
|
|
|
|
|
my $coderef = cop(Digest::SHA->new, 'digest'); |
2333
|
|
|
|
|
|
|
|
2334
|
|
|
|
|
|
|
# sub { ... } |
2335
|
|
|
|
|
|
|
|
2336
|
|
|
|
|
|
|
=back |
2337
|
|
|
|
|
|
|
|
2338
|
|
|
|
|
|
|
=cut |
2339
|
|
|
|
|
|
|
|
2340
|
|
|
|
|
|
|
=head2 data |
2341
|
|
|
|
|
|
|
|
2342
|
|
|
|
|
|
|
data(Str $value, Str | CodeRef $code, Any @args) (Any) |
2343
|
|
|
|
|
|
|
|
2344
|
|
|
|
|
|
|
The data function builds and returns a L object, or dispatches |
2345
|
|
|
|
|
|
|
to the coderef or method provided. |
2346
|
|
|
|
|
|
|
|
2347
|
|
|
|
|
|
|
I> |
2348
|
|
|
|
|
|
|
|
2349
|
|
|
|
|
|
|
=over 4 |
2350
|
|
|
|
|
|
|
|
2351
|
|
|
|
|
|
|
=item data example 1 |
2352
|
|
|
|
|
|
|
|
2353
|
|
|
|
|
|
|
package main; |
2354
|
|
|
|
|
|
|
|
2355
|
|
|
|
|
|
|
use Venus 'data'; |
2356
|
|
|
|
|
|
|
|
2357
|
|
|
|
|
|
|
my $data = data 't/data/sections'; |
2358
|
|
|
|
|
|
|
|
2359
|
|
|
|
|
|
|
# bless({...}, 'Venus::Data') |
2360
|
|
|
|
|
|
|
|
2361
|
|
|
|
|
|
|
=back |
2362
|
|
|
|
|
|
|
|
2363
|
|
|
|
|
|
|
=over 4 |
2364
|
|
|
|
|
|
|
|
2365
|
|
|
|
|
|
|
=item data example 2 |
2366
|
|
|
|
|
|
|
|
2367
|
|
|
|
|
|
|
package main; |
2368
|
|
|
|
|
|
|
|
2369
|
|
|
|
|
|
|
use Venus 'data'; |
2370
|
|
|
|
|
|
|
|
2371
|
|
|
|
|
|
|
my $data = data 't/data/sections', 'string', undef, 'name'; |
2372
|
|
|
|
|
|
|
|
2373
|
|
|
|
|
|
|
# "Example #1\nExample #2" |
2374
|
|
|
|
|
|
|
|
2375
|
|
|
|
|
|
|
=back |
2376
|
|
|
|
|
|
|
|
2377
|
|
|
|
|
|
|
=cut |
2378
|
|
|
|
|
|
|
|
2379
|
|
|
|
|
|
|
=head2 date |
2380
|
|
|
|
|
|
|
|
2381
|
|
|
|
|
|
|
date(Int $value, Str | CodeRef $code, Any @args) (Any) |
2382
|
|
|
|
|
|
|
|
2383
|
|
|
|
|
|
|
The date function builds and returns a L object, or dispatches to |
2384
|
|
|
|
|
|
|
the coderef or method provided. |
2385
|
|
|
|
|
|
|
|
2386
|
|
|
|
|
|
|
I> |
2387
|
|
|
|
|
|
|
|
2388
|
|
|
|
|
|
|
=over 4 |
2389
|
|
|
|
|
|
|
|
2390
|
|
|
|
|
|
|
=item date example 1 |
2391
|
|
|
|
|
|
|
|
2392
|
|
|
|
|
|
|
package main; |
2393
|
|
|
|
|
|
|
|
2394
|
|
|
|
|
|
|
use Venus 'date'; |
2395
|
|
|
|
|
|
|
|
2396
|
|
|
|
|
|
|
my $date = date time, 'string'; |
2397
|
|
|
|
|
|
|
|
2398
|
|
|
|
|
|
|
# '0000-00-00T00:00:00Z' |
2399
|
|
|
|
|
|
|
|
2400
|
|
|
|
|
|
|
=back |
2401
|
|
|
|
|
|
|
|
2402
|
|
|
|
|
|
|
=over 4 |
2403
|
|
|
|
|
|
|
|
2404
|
|
|
|
|
|
|
=item date example 2 |
2405
|
|
|
|
|
|
|
|
2406
|
|
|
|
|
|
|
package main; |
2407
|
|
|
|
|
|
|
|
2408
|
|
|
|
|
|
|
use Venus 'date'; |
2409
|
|
|
|
|
|
|
|
2410
|
|
|
|
|
|
|
my $date = date time, 'reset', 570672000; |
2411
|
|
|
|
|
|
|
|
2412
|
|
|
|
|
|
|
# bless({...}, 'Venus::Date') |
2413
|
|
|
|
|
|
|
|
2414
|
|
|
|
|
|
|
# $date->string; |
2415
|
|
|
|
|
|
|
|
2416
|
|
|
|
|
|
|
# '1988-02-01T00:00:00Z' |
2417
|
|
|
|
|
|
|
|
2418
|
|
|
|
|
|
|
=back |
2419
|
|
|
|
|
|
|
|
2420
|
|
|
|
|
|
|
=over 4 |
2421
|
|
|
|
|
|
|
|
2422
|
|
|
|
|
|
|
=item date example 3 |
2423
|
|
|
|
|
|
|
|
2424
|
|
|
|
|
|
|
package main; |
2425
|
|
|
|
|
|
|
|
2426
|
|
|
|
|
|
|
use Venus 'date'; |
2427
|
|
|
|
|
|
|
|
2428
|
|
|
|
|
|
|
my $date = date time; |
2429
|
|
|
|
|
|
|
|
2430
|
|
|
|
|
|
|
# bless({...}, 'Venus::Date') |
2431
|
|
|
|
|
|
|
|
2432
|
|
|
|
|
|
|
=back |
2433
|
|
|
|
|
|
|
|
2434
|
|
|
|
|
|
|
=cut |
2435
|
|
|
|
|
|
|
|
2436
|
|
|
|
|
|
|
=head2 docs |
2437
|
|
|
|
|
|
|
|
2438
|
|
|
|
|
|
|
docs(Any @args) (Any) |
2439
|
|
|
|
|
|
|
|
2440
|
|
|
|
|
|
|
The docs function builds a L object using L for |
2441
|
|
|
|
|
|
|
the current file, i.e. L or script, i.e. C<$0>, and returns |
2442
|
|
|
|
|
|
|
the result of a L operation using the arguments provided. |
2443
|
|
|
|
|
|
|
|
2444
|
|
|
|
|
|
|
I> |
2445
|
|
|
|
|
|
|
|
2446
|
|
|
|
|
|
|
=over 4 |
2447
|
|
|
|
|
|
|
|
2448
|
|
|
|
|
|
|
=item docs example 1 |
2449
|
|
|
|
|
|
|
|
2450
|
|
|
|
|
|
|
package main; |
2451
|
|
|
|
|
|
|
|
2452
|
|
|
|
|
|
|
use Venus 'docs'; |
2453
|
|
|
|
|
|
|
|
2454
|
|
|
|
|
|
|
# =head1 ABSTRACT |
2455
|
|
|
|
|
|
|
# |
2456
|
|
|
|
|
|
|
# Example Abstract |
2457
|
|
|
|
|
|
|
# |
2458
|
|
|
|
|
|
|
# =cut |
2459
|
|
|
|
|
|
|
|
2460
|
|
|
|
|
|
|
my $docs = docs 'head1', 'ABSTRACT'; |
2461
|
|
|
|
|
|
|
|
2462
|
|
|
|
|
|
|
# "Example Abstract" |
2463
|
|
|
|
|
|
|
|
2464
|
|
|
|
|
|
|
=back |
2465
|
|
|
|
|
|
|
|
2466
|
|
|
|
|
|
|
=over 4 |
2467
|
|
|
|
|
|
|
|
2468
|
|
|
|
|
|
|
=item docs example 2 |
2469
|
|
|
|
|
|
|
|
2470
|
|
|
|
|
|
|
package main; |
2471
|
|
|
|
|
|
|
|
2472
|
|
|
|
|
|
|
use Venus 'docs'; |
2473
|
|
|
|
|
|
|
|
2474
|
|
|
|
|
|
|
# =head1 NAME |
2475
|
|
|
|
|
|
|
# |
2476
|
|
|
|
|
|
|
# Example #1 |
2477
|
|
|
|
|
|
|
# |
2478
|
|
|
|
|
|
|
# =cut |
2479
|
|
|
|
|
|
|
# |
2480
|
|
|
|
|
|
|
# =head1 NAME |
2481
|
|
|
|
|
|
|
# |
2482
|
|
|
|
|
|
|
# Example #2 |
2483
|
|
|
|
|
|
|
# |
2484
|
|
|
|
|
|
|
# =cut |
2485
|
|
|
|
|
|
|
|
2486
|
|
|
|
|
|
|
my $docs = docs 'head1', 'NAME'; |
2487
|
|
|
|
|
|
|
|
2488
|
|
|
|
|
|
|
# "Example #1\nExample #2" |
2489
|
|
|
|
|
|
|
|
2490
|
|
|
|
|
|
|
=back |
2491
|
|
|
|
|
|
|
|
2492
|
|
|
|
|
|
|
=cut |
2493
|
|
|
|
|
|
|
|
2494
|
|
|
|
|
|
|
=head2 error |
2495
|
|
|
|
|
|
|
|
2496
|
|
|
|
|
|
|
error(Maybe[HashRef] $args) (Error) |
2497
|
|
|
|
|
|
|
|
2498
|
|
|
|
|
|
|
The error function throws a L exception object using the |
2499
|
|
|
|
|
|
|
exception object arguments provided. |
2500
|
|
|
|
|
|
|
|
2501
|
|
|
|
|
|
|
I> |
2502
|
|
|
|
|
|
|
|
2503
|
|
|
|
|
|
|
=over 4 |
2504
|
|
|
|
|
|
|
|
2505
|
|
|
|
|
|
|
=item error example 1 |
2506
|
|
|
|
|
|
|
|
2507
|
|
|
|
|
|
|
package main; |
2508
|
|
|
|
|
|
|
|
2509
|
|
|
|
|
|
|
use Venus 'error'; |
2510
|
|
|
|
|
|
|
|
2511
|
|
|
|
|
|
|
my $error = error; |
2512
|
|
|
|
|
|
|
|
2513
|
|
|
|
|
|
|
# bless({...}, 'Venus::Error') |
2514
|
|
|
|
|
|
|
|
2515
|
|
|
|
|
|
|
=back |
2516
|
|
|
|
|
|
|
|
2517
|
|
|
|
|
|
|
=over 4 |
2518
|
|
|
|
|
|
|
|
2519
|
|
|
|
|
|
|
=item error example 2 |
2520
|
|
|
|
|
|
|
|
2521
|
|
|
|
|
|
|
package main; |
2522
|
|
|
|
|
|
|
|
2523
|
|
|
|
|
|
|
use Venus 'error'; |
2524
|
|
|
|
|
|
|
|
2525
|
|
|
|
|
|
|
my $error = error { |
2526
|
|
|
|
|
|
|
message => 'Something failed!', |
2527
|
|
|
|
|
|
|
}; |
2528
|
|
|
|
|
|
|
|
2529
|
|
|
|
|
|
|
# bless({message => 'Something failed!', ...}, 'Venus::Error') |
2530
|
|
|
|
|
|
|
|
2531
|
|
|
|
|
|
|
=back |
2532
|
|
|
|
|
|
|
|
2533
|
|
|
|
|
|
|
=cut |
2534
|
|
|
|
|
|
|
|
2535
|
|
|
|
|
|
|
=head2 false |
2536
|
|
|
|
|
|
|
|
2537
|
|
|
|
|
|
|
false() (Bool) |
2538
|
|
|
|
|
|
|
|
2539
|
|
|
|
|
|
|
The false function returns a falsy boolean value which is designed to be |
2540
|
|
|
|
|
|
|
practically indistinguishable from the conventional numerical C<0> value. |
2541
|
|
|
|
|
|
|
|
2542
|
|
|
|
|
|
|
I> |
2543
|
|
|
|
|
|
|
|
2544
|
|
|
|
|
|
|
=over 4 |
2545
|
|
|
|
|
|
|
|
2546
|
|
|
|
|
|
|
=item false example 1 |
2547
|
|
|
|
|
|
|
|
2548
|
|
|
|
|
|
|
package main; |
2549
|
|
|
|
|
|
|
|
2550
|
|
|
|
|
|
|
use Venus; |
2551
|
|
|
|
|
|
|
|
2552
|
|
|
|
|
|
|
my $false = false; |
2553
|
|
|
|
|
|
|
|
2554
|
|
|
|
|
|
|
# 0 |
2555
|
|
|
|
|
|
|
|
2556
|
|
|
|
|
|
|
=back |
2557
|
|
|
|
|
|
|
|
2558
|
|
|
|
|
|
|
=over 4 |
2559
|
|
|
|
|
|
|
|
2560
|
|
|
|
|
|
|
=item false example 2 |
2561
|
|
|
|
|
|
|
|
2562
|
|
|
|
|
|
|
package main; |
2563
|
|
|
|
|
|
|
|
2564
|
|
|
|
|
|
|
use Venus; |
2565
|
|
|
|
|
|
|
|
2566
|
|
|
|
|
|
|
my $true = !false; |
2567
|
|
|
|
|
|
|
|
2568
|
|
|
|
|
|
|
# 1 |
2569
|
|
|
|
|
|
|
|
2570
|
|
|
|
|
|
|
=back |
2571
|
|
|
|
|
|
|
|
2572
|
|
|
|
|
|
|
=cut |
2573
|
|
|
|
|
|
|
|
2574
|
|
|
|
|
|
|
=head2 fault |
2575
|
|
|
|
|
|
|
|
2576
|
|
|
|
|
|
|
fault(Str $args) (Fault) |
2577
|
|
|
|
|
|
|
|
2578
|
|
|
|
|
|
|
The fault function throws a L exception object and represents a |
2579
|
|
|
|
|
|
|
system failure, and isn't meant to be caught. |
2580
|
|
|
|
|
|
|
|
2581
|
|
|
|
|
|
|
I> |
2582
|
|
|
|
|
|
|
|
2583
|
|
|
|
|
|
|
=over 4 |
2584
|
|
|
|
|
|
|
|
2585
|
|
|
|
|
|
|
=item fault example 1 |
2586
|
|
|
|
|
|
|
|
2587
|
|
|
|
|
|
|
package main; |
2588
|
|
|
|
|
|
|
|
2589
|
|
|
|
|
|
|
use Venus 'fault'; |
2590
|
|
|
|
|
|
|
|
2591
|
|
|
|
|
|
|
my $fault = fault; |
2592
|
|
|
|
|
|
|
|
2593
|
|
|
|
|
|
|
# bless({message => 'Exception!'}, 'Venus::Fault') |
2594
|
|
|
|
|
|
|
|
2595
|
|
|
|
|
|
|
=back |
2596
|
|
|
|
|
|
|
|
2597
|
|
|
|
|
|
|
=over 4 |
2598
|
|
|
|
|
|
|
|
2599
|
|
|
|
|
|
|
=item fault example 2 |
2600
|
|
|
|
|
|
|
|
2601
|
|
|
|
|
|
|
package main; |
2602
|
|
|
|
|
|
|
|
2603
|
|
|
|
|
|
|
use Venus 'fault'; |
2604
|
|
|
|
|
|
|
|
2605
|
|
|
|
|
|
|
my $fault = fault 'Something failed!'; |
2606
|
|
|
|
|
|
|
|
2607
|
|
|
|
|
|
|
# bless({message => 'Something failed!'}, 'Venus::Fault') |
2608
|
|
|
|
|
|
|
|
2609
|
|
|
|
|
|
|
=back |
2610
|
|
|
|
|
|
|
|
2611
|
|
|
|
|
|
|
=cut |
2612
|
|
|
|
|
|
|
|
2613
|
|
|
|
|
|
|
=head2 float |
2614
|
|
|
|
|
|
|
|
2615
|
|
|
|
|
|
|
float(Str $value, Str | CodeRef $code, Any @args) (Any) |
2616
|
|
|
|
|
|
|
|
2617
|
|
|
|
|
|
|
The float function builds and returns a L object, or dispatches |
2618
|
|
|
|
|
|
|
to the coderef or method provided. |
2619
|
|
|
|
|
|
|
|
2620
|
|
|
|
|
|
|
I> |
2621
|
|
|
|
|
|
|
|
2622
|
|
|
|
|
|
|
=over 4 |
2623
|
|
|
|
|
|
|
|
2624
|
|
|
|
|
|
|
=item float example 1 |
2625
|
|
|
|
|
|
|
|
2626
|
|
|
|
|
|
|
package main; |
2627
|
|
|
|
|
|
|
|
2628
|
|
|
|
|
|
|
use Venus 'float'; |
2629
|
|
|
|
|
|
|
|
2630
|
|
|
|
|
|
|
my $float = float 1.23; |
2631
|
|
|
|
|
|
|
|
2632
|
|
|
|
|
|
|
# bless({...}, 'Venus::Float') |
2633
|
|
|
|
|
|
|
|
2634
|
|
|
|
|
|
|
=back |
2635
|
|
|
|
|
|
|
|
2636
|
|
|
|
|
|
|
=over 4 |
2637
|
|
|
|
|
|
|
|
2638
|
|
|
|
|
|
|
=item float example 2 |
2639
|
|
|
|
|
|
|
|
2640
|
|
|
|
|
|
|
package main; |
2641
|
|
|
|
|
|
|
|
2642
|
|
|
|
|
|
|
use Venus 'float'; |
2643
|
|
|
|
|
|
|
|
2644
|
|
|
|
|
|
|
my $float = float 1.23, 'int'; |
2645
|
|
|
|
|
|
|
|
2646
|
|
|
|
|
|
|
# 1 |
2647
|
|
|
|
|
|
|
|
2648
|
|
|
|
|
|
|
=back |
2649
|
|
|
|
|
|
|
|
2650
|
|
|
|
|
|
|
=cut |
2651
|
|
|
|
|
|
|
|
2652
|
|
|
|
|
|
|
=head2 gather |
2653
|
|
|
|
|
|
|
|
2654
|
|
|
|
|
|
|
gather(Any $value, CodeRef $callback) (Any) |
2655
|
|
|
|
|
|
|
|
2656
|
|
|
|
|
|
|
The gather function builds a L object, passing it and the value |
2657
|
|
|
|
|
|
|
provided to the callback provided, and returns the return value from |
2658
|
|
|
|
|
|
|
L. |
2659
|
|
|
|
|
|
|
|
2660
|
|
|
|
|
|
|
I> |
2661
|
|
|
|
|
|
|
|
2662
|
|
|
|
|
|
|
=over 4 |
2663
|
|
|
|
|
|
|
|
2664
|
|
|
|
|
|
|
=item gather example 1 |
2665
|
|
|
|
|
|
|
|
2666
|
|
|
|
|
|
|
package main; |
2667
|
|
|
|
|
|
|
|
2668
|
|
|
|
|
|
|
use Venus 'gather'; |
2669
|
|
|
|
|
|
|
|
2670
|
|
|
|
|
|
|
my $gather = gather ['a'..'d']; |
2671
|
|
|
|
|
|
|
|
2672
|
|
|
|
|
|
|
# bless({...}, 'Venus::Gather') |
2673
|
|
|
|
|
|
|
|
2674
|
|
|
|
|
|
|
# $gather->result; |
2675
|
|
|
|
|
|
|
|
2676
|
|
|
|
|
|
|
# undef |
2677
|
|
|
|
|
|
|
|
2678
|
|
|
|
|
|
|
=back |
2679
|
|
|
|
|
|
|
|
2680
|
|
|
|
|
|
|
=over 4 |
2681
|
|
|
|
|
|
|
|
2682
|
|
|
|
|
|
|
=item gather example 2 |
2683
|
|
|
|
|
|
|
|
2684
|
|
|
|
|
|
|
package main; |
2685
|
|
|
|
|
|
|
|
2686
|
|
|
|
|
|
|
use Venus 'gather'; |
2687
|
|
|
|
|
|
|
|
2688
|
|
|
|
|
|
|
my $gather = gather ['a'..'d'], sub {{ |
2689
|
|
|
|
|
|
|
a => 1, |
2690
|
|
|
|
|
|
|
b => 2, |
2691
|
|
|
|
|
|
|
c => 3, |
2692
|
|
|
|
|
|
|
}}; |
2693
|
|
|
|
|
|
|
|
2694
|
|
|
|
|
|
|
# [1..3] |
2695
|
|
|
|
|
|
|
|
2696
|
|
|
|
|
|
|
=back |
2697
|
|
|
|
|
|
|
|
2698
|
|
|
|
|
|
|
=over 4 |
2699
|
|
|
|
|
|
|
|
2700
|
|
|
|
|
|
|
=item gather example 3 |
2701
|
|
|
|
|
|
|
|
2702
|
|
|
|
|
|
|
package main; |
2703
|
|
|
|
|
|
|
|
2704
|
|
|
|
|
|
|
use Venus 'gather'; |
2705
|
|
|
|
|
|
|
|
2706
|
|
|
|
|
|
|
my $gather = gather ['e'..'h'], sub {{ |
2707
|
|
|
|
|
|
|
a => 1, |
2708
|
|
|
|
|
|
|
b => 2, |
2709
|
|
|
|
|
|
|
c => 3, |
2710
|
|
|
|
|
|
|
}}; |
2711
|
|
|
|
|
|
|
|
2712
|
|
|
|
|
|
|
# [] |
2713
|
|
|
|
|
|
|
|
2714
|
|
|
|
|
|
|
=back |
2715
|
|
|
|
|
|
|
|
2716
|
|
|
|
|
|
|
=over 4 |
2717
|
|
|
|
|
|
|
|
2718
|
|
|
|
|
|
|
=item gather example 4 |
2719
|
|
|
|
|
|
|
|
2720
|
|
|
|
|
|
|
package main; |
2721
|
|
|
|
|
|
|
|
2722
|
|
|
|
|
|
|
use Venus 'gather'; |
2723
|
|
|
|
|
|
|
|
2724
|
|
|
|
|
|
|
my $gather = gather ['a'..'d'], sub { |
2725
|
|
|
|
|
|
|
my ($case) = @_; |
2726
|
|
|
|
|
|
|
|
2727
|
|
|
|
|
|
|
$case->when(sub{lc($_) eq 'a'})->then('a -> A'); |
2728
|
|
|
|
|
|
|
$case->when(sub{lc($_) eq 'b'})->then('b -> B'); |
2729
|
|
|
|
|
|
|
}; |
2730
|
|
|
|
|
|
|
|
2731
|
|
|
|
|
|
|
# ['a -> A', 'b -> B'] |
2732
|
|
|
|
|
|
|
|
2733
|
|
|
|
|
|
|
=back |
2734
|
|
|
|
|
|
|
|
2735
|
|
|
|
|
|
|
=over 4 |
2736
|
|
|
|
|
|
|
|
2737
|
|
|
|
|
|
|
=item gather example 5 |
2738
|
|
|
|
|
|
|
|
2739
|
|
|
|
|
|
|
package main; |
2740
|
|
|
|
|
|
|
|
2741
|
|
|
|
|
|
|
use Venus 'gather'; |
2742
|
|
|
|
|
|
|
|
2743
|
|
|
|
|
|
|
my $gather = gather ['a'..'d'], sub { |
2744
|
|
|
|
|
|
|
|
2745
|
|
|
|
|
|
|
$_->when(sub{lc($_) eq 'a'})->then('a -> A'); |
2746
|
|
|
|
|
|
|
$_->when(sub{lc($_) eq 'b'})->then('b -> B'); |
2747
|
|
|
|
|
|
|
}; |
2748
|
|
|
|
|
|
|
|
2749
|
|
|
|
|
|
|
# ['a -> A', 'b -> B'] |
2750
|
|
|
|
|
|
|
|
2751
|
|
|
|
|
|
|
=back |
2752
|
|
|
|
|
|
|
|
2753
|
|
|
|
|
|
|
=cut |
2754
|
|
|
|
|
|
|
|
2755
|
|
|
|
|
|
|
=head2 hash |
2756
|
|
|
|
|
|
|
|
2757
|
|
|
|
|
|
|
hash(HashRef $value, Str | CodeRef $code, Any @args) (Any) |
2758
|
|
|
|
|
|
|
|
2759
|
|
|
|
|
|
|
The hash function builds and returns a L object, or dispatches |
2760
|
|
|
|
|
|
|
to the coderef or method provided. |
2761
|
|
|
|
|
|
|
|
2762
|
|
|
|
|
|
|
I> |
2763
|
|
|
|
|
|
|
|
2764
|
|
|
|
|
|
|
=over 4 |
2765
|
|
|
|
|
|
|
|
2766
|
|
|
|
|
|
|
=item hash example 1 |
2767
|
|
|
|
|
|
|
|
2768
|
|
|
|
|
|
|
package main; |
2769
|
|
|
|
|
|
|
|
2770
|
|
|
|
|
|
|
use Venus 'hash'; |
2771
|
|
|
|
|
|
|
|
2772
|
|
|
|
|
|
|
my $hash = hash {1..4}; |
2773
|
|
|
|
|
|
|
|
2774
|
|
|
|
|
|
|
# bless({...}, 'Venus::Hash') |
2775
|
|
|
|
|
|
|
|
2776
|
|
|
|
|
|
|
=back |
2777
|
|
|
|
|
|
|
|
2778
|
|
|
|
|
|
|
=over 4 |
2779
|
|
|
|
|
|
|
|
2780
|
|
|
|
|
|
|
=item hash example 2 |
2781
|
|
|
|
|
|
|
|
2782
|
|
|
|
|
|
|
package main; |
2783
|
|
|
|
|
|
|
|
2784
|
|
|
|
|
|
|
use Venus 'hash'; |
2785
|
|
|
|
|
|
|
|
2786
|
|
|
|
|
|
|
my $hash = hash {1..8}, 'pairs'; |
2787
|
|
|
|
|
|
|
|
2788
|
|
|
|
|
|
|
# [[1, 2], [3, 4], [5, 6], [7, 8]] |
2789
|
|
|
|
|
|
|
|
2790
|
|
|
|
|
|
|
=back |
2791
|
|
|
|
|
|
|
|
2792
|
|
|
|
|
|
|
=cut |
2793
|
|
|
|
|
|
|
|
2794
|
|
|
|
|
|
|
=head2 hashref |
2795
|
|
|
|
|
|
|
|
2796
|
|
|
|
|
|
|
hashref(Any @args) (HashRef) |
2797
|
|
|
|
|
|
|
|
2798
|
|
|
|
|
|
|
The hashref function takes a list of arguments and returns a hashref. |
2799
|
|
|
|
|
|
|
|
2800
|
|
|
|
|
|
|
I> |
2801
|
|
|
|
|
|
|
|
2802
|
|
|
|
|
|
|
=over 4 |
2803
|
|
|
|
|
|
|
|
2804
|
|
|
|
|
|
|
=item hashref example 1 |
2805
|
|
|
|
|
|
|
|
2806
|
|
|
|
|
|
|
package main; |
2807
|
|
|
|
|
|
|
|
2808
|
|
|
|
|
|
|
use Venus 'hashref'; |
2809
|
|
|
|
|
|
|
|
2810
|
|
|
|
|
|
|
my $hashref = hashref(content => 'example'); |
2811
|
|
|
|
|
|
|
|
2812
|
|
|
|
|
|
|
# {content => "example"} |
2813
|
|
|
|
|
|
|
|
2814
|
|
|
|
|
|
|
=back |
2815
|
|
|
|
|
|
|
|
2816
|
|
|
|
|
|
|
=over 4 |
2817
|
|
|
|
|
|
|
|
2818
|
|
|
|
|
|
|
=item hashref example 2 |
2819
|
|
|
|
|
|
|
|
2820
|
|
|
|
|
|
|
package main; |
2821
|
|
|
|
|
|
|
|
2822
|
|
|
|
|
|
|
use Venus 'hashref'; |
2823
|
|
|
|
|
|
|
|
2824
|
|
|
|
|
|
|
my $hashref = hashref({content => 'example'}); |
2825
|
|
|
|
|
|
|
|
2826
|
|
|
|
|
|
|
# {content => "example"} |
2827
|
|
|
|
|
|
|
|
2828
|
|
|
|
|
|
|
=back |
2829
|
|
|
|
|
|
|
|
2830
|
|
|
|
|
|
|
=over 4 |
2831
|
|
|
|
|
|
|
|
2832
|
|
|
|
|
|
|
=item hashref example 3 |
2833
|
|
|
|
|
|
|
|
2834
|
|
|
|
|
|
|
package main; |
2835
|
|
|
|
|
|
|
|
2836
|
|
|
|
|
|
|
use Venus 'hashref'; |
2837
|
|
|
|
|
|
|
|
2838
|
|
|
|
|
|
|
my $hashref = hashref('content'); |
2839
|
|
|
|
|
|
|
|
2840
|
|
|
|
|
|
|
# {content => undef} |
2841
|
|
|
|
|
|
|
|
2842
|
|
|
|
|
|
|
=back |
2843
|
|
|
|
|
|
|
|
2844
|
|
|
|
|
|
|
=over 4 |
2845
|
|
|
|
|
|
|
|
2846
|
|
|
|
|
|
|
=item hashref example 4 |
2847
|
|
|
|
|
|
|
|
2848
|
|
|
|
|
|
|
package main; |
2849
|
|
|
|
|
|
|
|
2850
|
|
|
|
|
|
|
use Venus 'hashref'; |
2851
|
|
|
|
|
|
|
|
2852
|
|
|
|
|
|
|
my $hashref = hashref('content', 'example', 'algorithm'); |
2853
|
|
|
|
|
|
|
|
2854
|
|
|
|
|
|
|
# {content => "example", algorithm => undef} |
2855
|
|
|
|
|
|
|
|
2856
|
|
|
|
|
|
|
=back |
2857
|
|
|
|
|
|
|
|
2858
|
|
|
|
|
|
|
=cut |
2859
|
|
|
|
|
|
|
|
2860
|
|
|
|
|
|
|
=head2 is_bool |
2861
|
|
|
|
|
|
|
|
2862
|
|
|
|
|
|
|
is_bool(Any $arg) (Bool) |
2863
|
|
|
|
|
|
|
|
2864
|
|
|
|
|
|
|
The is_bool function returns L if the value provided is a boolean value, |
2865
|
|
|
|
|
|
|
not merely truthy, and L otherwise. |
2866
|
|
|
|
|
|
|
|
2867
|
|
|
|
|
|
|
I> |
2868
|
|
|
|
|
|
|
|
2869
|
|
|
|
|
|
|
=over 4 |
2870
|
|
|
|
|
|
|
|
2871
|
|
|
|
|
|
|
=item is_bool example 1 |
2872
|
|
|
|
|
|
|
|
2873
|
|
|
|
|
|
|
package main; |
2874
|
|
|
|
|
|
|
|
2875
|
|
|
|
|
|
|
use Venus 'is_bool'; |
2876
|
|
|
|
|
|
|
|
2877
|
|
|
|
|
|
|
my $is_bool = is_bool true; |
2878
|
|
|
|
|
|
|
|
2879
|
|
|
|
|
|
|
# true |
2880
|
|
|
|
|
|
|
|
2881
|
|
|
|
|
|
|
=back |
2882
|
|
|
|
|
|
|
|
2883
|
|
|
|
|
|
|
=over 4 |
2884
|
|
|
|
|
|
|
|
2885
|
|
|
|
|
|
|
=item is_bool example 2 |
2886
|
|
|
|
|
|
|
|
2887
|
|
|
|
|
|
|
package main; |
2888
|
|
|
|
|
|
|
|
2889
|
|
|
|
|
|
|
use Venus 'is_bool'; |
2890
|
|
|
|
|
|
|
|
2891
|
|
|
|
|
|
|
my $is_bool = is_bool false; |
2892
|
|
|
|
|
|
|
|
2893
|
|
|
|
|
|
|
# true |
2894
|
|
|
|
|
|
|
|
2895
|
|
|
|
|
|
|
=back |
2896
|
|
|
|
|
|
|
|
2897
|
|
|
|
|
|
|
=over 4 |
2898
|
|
|
|
|
|
|
|
2899
|
|
|
|
|
|
|
=item is_bool example 3 |
2900
|
|
|
|
|
|
|
|
2901
|
|
|
|
|
|
|
package main; |
2902
|
|
|
|
|
|
|
|
2903
|
|
|
|
|
|
|
use Venus 'is_bool'; |
2904
|
|
|
|
|
|
|
|
2905
|
|
|
|
|
|
|
my $is_bool = is_bool 1; |
2906
|
|
|
|
|
|
|
|
2907
|
|
|
|
|
|
|
# false |
2908
|
|
|
|
|
|
|
|
2909
|
|
|
|
|
|
|
=back |
2910
|
|
|
|
|
|
|
|
2911
|
|
|
|
|
|
|
=over 4 |
2912
|
|
|
|
|
|
|
|
2913
|
|
|
|
|
|
|
=item is_bool example 4 |
2914
|
|
|
|
|
|
|
|
2915
|
|
|
|
|
|
|
package main; |
2916
|
|
|
|
|
|
|
|
2917
|
|
|
|
|
|
|
use Venus 'is_bool'; |
2918
|
|
|
|
|
|
|
|
2919
|
|
|
|
|
|
|
my $is_bool = is_bool 0; |
2920
|
|
|
|
|
|
|
|
2921
|
|
|
|
|
|
|
# false |
2922
|
|
|
|
|
|
|
|
2923
|
|
|
|
|
|
|
=back |
2924
|
|
|
|
|
|
|
|
2925
|
|
|
|
|
|
|
=cut |
2926
|
|
|
|
|
|
|
|
2927
|
|
|
|
|
|
|
=head2 is_false |
2928
|
|
|
|
|
|
|
|
2929
|
|
|
|
|
|
|
is_false(Any $data) (Bool) |
2930
|
|
|
|
|
|
|
|
2931
|
|
|
|
|
|
|
The is_false function accepts a scalar value and returns true if the value is |
2932
|
|
|
|
|
|
|
falsy. |
2933
|
|
|
|
|
|
|
|
2934
|
|
|
|
|
|
|
I> |
2935
|
|
|
|
|
|
|
|
2936
|
|
|
|
|
|
|
=over 4 |
2937
|
|
|
|
|
|
|
|
2938
|
|
|
|
|
|
|
=item is_false example 1 |
2939
|
|
|
|
|
|
|
|
2940
|
|
|
|
|
|
|
package main; |
2941
|
|
|
|
|
|
|
|
2942
|
|
|
|
|
|
|
use Venus 'is_false'; |
2943
|
|
|
|
|
|
|
|
2944
|
|
|
|
|
|
|
my $is_false = is_false 0; |
2945
|
|
|
|
|
|
|
|
2946
|
|
|
|
|
|
|
# true |
2947
|
|
|
|
|
|
|
|
2948
|
|
|
|
|
|
|
=back |
2949
|
|
|
|
|
|
|
|
2950
|
|
|
|
|
|
|
=over 4 |
2951
|
|
|
|
|
|
|
|
2952
|
|
|
|
|
|
|
=item is_false example 2 |
2953
|
|
|
|
|
|
|
|
2954
|
|
|
|
|
|
|
package main; |
2955
|
|
|
|
|
|
|
|
2956
|
|
|
|
|
|
|
use Venus 'is_false'; |
2957
|
|
|
|
|
|
|
|
2958
|
|
|
|
|
|
|
my $is_false = is_false 1; |
2959
|
|
|
|
|
|
|
|
2960
|
|
|
|
|
|
|
# false |
2961
|
|
|
|
|
|
|
|
2962
|
|
|
|
|
|
|
=back |
2963
|
|
|
|
|
|
|
|
2964
|
|
|
|
|
|
|
=cut |
2965
|
|
|
|
|
|
|
|
2966
|
|
|
|
|
|
|
=head2 is_true |
2967
|
|
|
|
|
|
|
|
2968
|
|
|
|
|
|
|
is_true(Any $data) (Bool) |
2969
|
|
|
|
|
|
|
|
2970
|
|
|
|
|
|
|
The is_true function accepts a scalar value and returns true if the value is |
2971
|
|
|
|
|
|
|
truthy. |
2972
|
|
|
|
|
|
|
|
2973
|
|
|
|
|
|
|
I> |
2974
|
|
|
|
|
|
|
|
2975
|
|
|
|
|
|
|
=over 4 |
2976
|
|
|
|
|
|
|
|
2977
|
|
|
|
|
|
|
=item is_true example 1 |
2978
|
|
|
|
|
|
|
|
2979
|
|
|
|
|
|
|
package main; |
2980
|
|
|
|
|
|
|
|
2981
|
|
|
|
|
|
|
use Venus 'is_true'; |
2982
|
|
|
|
|
|
|
|
2983
|
|
|
|
|
|
|
my $is_true = is_true 1; |
2984
|
|
|
|
|
|
|
|
2985
|
|
|
|
|
|
|
# true |
2986
|
|
|
|
|
|
|
|
2987
|
|
|
|
|
|
|
=back |
2988
|
|
|
|
|
|
|
|
2989
|
|
|
|
|
|
|
=over 4 |
2990
|
|
|
|
|
|
|
|
2991
|
|
|
|
|
|
|
=item is_true example 2 |
2992
|
|
|
|
|
|
|
|
2993
|
|
|
|
|
|
|
package main; |
2994
|
|
|
|
|
|
|
|
2995
|
|
|
|
|
|
|
use Venus 'is_true'; |
2996
|
|
|
|
|
|
|
|
2997
|
|
|
|
|
|
|
my $is_true = is_true 0; |
2998
|
|
|
|
|
|
|
|
2999
|
|
|
|
|
|
|
# false |
3000
|
|
|
|
|
|
|
|
3001
|
|
|
|
|
|
|
=back |
3002
|
|
|
|
|
|
|
|
3003
|
|
|
|
|
|
|
=cut |
3004
|
|
|
|
|
|
|
|
3005
|
|
|
|
|
|
|
=head2 json |
3006
|
|
|
|
|
|
|
|
3007
|
|
|
|
|
|
|
json(Str $call, Any $data) (Any) |
3008
|
|
|
|
|
|
|
|
3009
|
|
|
|
|
|
|
The json function builds a L object and will either |
3010
|
|
|
|
|
|
|
L or L based on the argument provided |
3011
|
|
|
|
|
|
|
and returns the result. |
3012
|
|
|
|
|
|
|
|
3013
|
|
|
|
|
|
|
I> |
3014
|
|
|
|
|
|
|
|
3015
|
|
|
|
|
|
|
=over 4 |
3016
|
|
|
|
|
|
|
|
3017
|
|
|
|
|
|
|
=item json example 1 |
3018
|
|
|
|
|
|
|
|
3019
|
|
|
|
|
|
|
package main; |
3020
|
|
|
|
|
|
|
|
3021
|
|
|
|
|
|
|
use Venus 'json'; |
3022
|
|
|
|
|
|
|
|
3023
|
|
|
|
|
|
|
my $decode = json 'decode', '{"codename":["Ready","Robot"],"stable":true}'; |
3024
|
|
|
|
|
|
|
|
3025
|
|
|
|
|
|
|
# { codename => ["Ready", "Robot"], stable => 1 } |
3026
|
|
|
|
|
|
|
|
3027
|
|
|
|
|
|
|
=back |
3028
|
|
|
|
|
|
|
|
3029
|
|
|
|
|
|
|
=over 4 |
3030
|
|
|
|
|
|
|
|
3031
|
|
|
|
|
|
|
=item json example 2 |
3032
|
|
|
|
|
|
|
|
3033
|
|
|
|
|
|
|
package main; |
3034
|
|
|
|
|
|
|
|
3035
|
|
|
|
|
|
|
use Venus 'json'; |
3036
|
|
|
|
|
|
|
|
3037
|
|
|
|
|
|
|
my $encode = json 'encode', { codename => ["Ready", "Robot"], stable => true }; |
3038
|
|
|
|
|
|
|
|
3039
|
|
|
|
|
|
|
# '{"codename":["Ready","Robot"],"stable":true}' |
3040
|
|
|
|
|
|
|
|
3041
|
|
|
|
|
|
|
=back |
3042
|
|
|
|
|
|
|
|
3043
|
|
|
|
|
|
|
=over 4 |
3044
|
|
|
|
|
|
|
|
3045
|
|
|
|
|
|
|
=item json example 3 |
3046
|
|
|
|
|
|
|
|
3047
|
|
|
|
|
|
|
package main; |
3048
|
|
|
|
|
|
|
|
3049
|
|
|
|
|
|
|
use Venus 'json'; |
3050
|
|
|
|
|
|
|
|
3051
|
|
|
|
|
|
|
my $json = json; |
3052
|
|
|
|
|
|
|
|
3053
|
|
|
|
|
|
|
# bless({...}, 'Venus::Json') |
3054
|
|
|
|
|
|
|
|
3055
|
|
|
|
|
|
|
=back |
3056
|
|
|
|
|
|
|
|
3057
|
|
|
|
|
|
|
=over 4 |
3058
|
|
|
|
|
|
|
|
3059
|
|
|
|
|
|
|
=item json example 4 |
3060
|
|
|
|
|
|
|
|
3061
|
|
|
|
|
|
|
package main; |
3062
|
|
|
|
|
|
|
|
3063
|
|
|
|
|
|
|
use Venus 'json'; |
3064
|
|
|
|
|
|
|
|
3065
|
|
|
|
|
|
|
my $json = json 'class', {data => "..."}; |
3066
|
|
|
|
|
|
|
|
3067
|
|
|
|
|
|
|
# Exception! (isa Venus::Fault) |
3068
|
|
|
|
|
|
|
|
3069
|
|
|
|
|
|
|
=back |
3070
|
|
|
|
|
|
|
|
3071
|
|
|
|
|
|
|
=cut |
3072
|
|
|
|
|
|
|
|
3073
|
|
|
|
|
|
|
=head2 list |
3074
|
|
|
|
|
|
|
|
3075
|
|
|
|
|
|
|
list(Any @args) (Any) |
3076
|
|
|
|
|
|
|
|
3077
|
|
|
|
|
|
|
The list function accepts a list of values and flattens any arrayrefs, |
3078
|
|
|
|
|
|
|
returning a list of scalars. |
3079
|
|
|
|
|
|
|
|
3080
|
|
|
|
|
|
|
I> |
3081
|
|
|
|
|
|
|
|
3082
|
|
|
|
|
|
|
=over 4 |
3083
|
|
|
|
|
|
|
|
3084
|
|
|
|
|
|
|
=item list example 1 |
3085
|
|
|
|
|
|
|
|
3086
|
|
|
|
|
|
|
package main; |
3087
|
|
|
|
|
|
|
|
3088
|
|
|
|
|
|
|
use Venus 'list'; |
3089
|
|
|
|
|
|
|
|
3090
|
|
|
|
|
|
|
my @list = list 1..4; |
3091
|
|
|
|
|
|
|
|
3092
|
|
|
|
|
|
|
# (1..4) |
3093
|
|
|
|
|
|
|
|
3094
|
|
|
|
|
|
|
=back |
3095
|
|
|
|
|
|
|
|
3096
|
|
|
|
|
|
|
=over 4 |
3097
|
|
|
|
|
|
|
|
3098
|
|
|
|
|
|
|
=item list example 2 |
3099
|
|
|
|
|
|
|
|
3100
|
|
|
|
|
|
|
package main; |
3101
|
|
|
|
|
|
|
|
3102
|
|
|
|
|
|
|
use Venus 'list'; |
3103
|
|
|
|
|
|
|
|
3104
|
|
|
|
|
|
|
my @list = list [1..4]; |
3105
|
|
|
|
|
|
|
|
3106
|
|
|
|
|
|
|
# (1..4) |
3107
|
|
|
|
|
|
|
|
3108
|
|
|
|
|
|
|
=back |
3109
|
|
|
|
|
|
|
|
3110
|
|
|
|
|
|
|
=over 4 |
3111
|
|
|
|
|
|
|
|
3112
|
|
|
|
|
|
|
=item list example 3 |
3113
|
|
|
|
|
|
|
|
3114
|
|
|
|
|
|
|
package main; |
3115
|
|
|
|
|
|
|
|
3116
|
|
|
|
|
|
|
use Venus 'list'; |
3117
|
|
|
|
|
|
|
|
3118
|
|
|
|
|
|
|
my @list = list [1..4], 5, [6..10]; |
3119
|
|
|
|
|
|
|
|
3120
|
|
|
|
|
|
|
# (1..10) |
3121
|
|
|
|
|
|
|
|
3122
|
|
|
|
|
|
|
=back |
3123
|
|
|
|
|
|
|
|
3124
|
|
|
|
|
|
|
=cut |
3125
|
|
|
|
|
|
|
|
3126
|
|
|
|
|
|
|
=head2 load |
3127
|
|
|
|
|
|
|
|
3128
|
|
|
|
|
|
|
load(Any $name) (Space) |
3129
|
|
|
|
|
|
|
|
3130
|
|
|
|
|
|
|
The load function loads the package provided and returns a L object. |
3131
|
|
|
|
|
|
|
|
3132
|
|
|
|
|
|
|
I> |
3133
|
|
|
|
|
|
|
|
3134
|
|
|
|
|
|
|
=over 4 |
3135
|
|
|
|
|
|
|
|
3136
|
|
|
|
|
|
|
=item load example 1 |
3137
|
|
|
|
|
|
|
|
3138
|
|
|
|
|
|
|
package main; |
3139
|
|
|
|
|
|
|
|
3140
|
|
|
|
|
|
|
use Venus 'load'; |
3141
|
|
|
|
|
|
|
|
3142
|
|
|
|
|
|
|
my $space = load 'Venus::Scalar'; |
3143
|
|
|
|
|
|
|
|
3144
|
|
|
|
|
|
|
# bless({value => 'Venus::Scalar'}, 'Venus::Space') |
3145
|
|
|
|
|
|
|
|
3146
|
|
|
|
|
|
|
=back |
3147
|
|
|
|
|
|
|
|
3148
|
|
|
|
|
|
|
=cut |
3149
|
|
|
|
|
|
|
|
3150
|
|
|
|
|
|
|
=head2 log |
3151
|
|
|
|
|
|
|
|
3152
|
|
|
|
|
|
|
log(Any @args) (Log) |
3153
|
|
|
|
|
|
|
|
3154
|
|
|
|
|
|
|
The log function prints the arguments provided to STDOUT, stringifying complex |
3155
|
|
|
|
|
|
|
values, and returns a L object. If the first argument is a log |
3156
|
|
|
|
|
|
|
level name, e.g. C, C, C, C, C, or C, |
3157
|
|
|
|
|
|
|
it will be used when emitting the event. The desired log level is specified by |
3158
|
|
|
|
|
|
|
the C environment variable and defaults to C. |
3159
|
|
|
|
|
|
|
|
3160
|
|
|
|
|
|
|
I> |
3161
|
|
|
|
|
|
|
|
3162
|
|
|
|
|
|
|
=over 4 |
3163
|
|
|
|
|
|
|
|
3164
|
|
|
|
|
|
|
=item log example 1 |
3165
|
|
|
|
|
|
|
|
3166
|
|
|
|
|
|
|
package main; |
3167
|
|
|
|
|
|
|
|
3168
|
|
|
|
|
|
|
use Venus 'log'; |
3169
|
|
|
|
|
|
|
|
3170
|
|
|
|
|
|
|
my $log = log; |
3171
|
|
|
|
|
|
|
|
3172
|
|
|
|
|
|
|
# bless({...}, 'Venus::Log') |
3173
|
|
|
|
|
|
|
|
3174
|
|
|
|
|
|
|
# log time, rand, 1..9; |
3175
|
|
|
|
|
|
|
|
3176
|
|
|
|
|
|
|
# 00000000 0.000000, 1..9 |
3177
|
|
|
|
|
|
|
|
3178
|
|
|
|
|
|
|
=back |
3179
|
|
|
|
|
|
|
|
3180
|
|
|
|
|
|
|
=cut |
3181
|
|
|
|
|
|
|
|
3182
|
|
|
|
|
|
|
=head2 make |
3183
|
|
|
|
|
|
|
|
3184
|
|
|
|
|
|
|
make(Str $package, Any @args) (Any) |
3185
|
|
|
|
|
|
|
|
3186
|
|
|
|
|
|
|
The make function L<"calls"|Venus/call> the C routine on the invocant and |
3187
|
|
|
|
|
|
|
returns the result which should be a package string or an object. |
3188
|
|
|
|
|
|
|
|
3189
|
|
|
|
|
|
|
I> |
3190
|
|
|
|
|
|
|
|
3191
|
|
|
|
|
|
|
=over 4 |
3192
|
|
|
|
|
|
|
|
3193
|
|
|
|
|
|
|
=item make example 1 |
3194
|
|
|
|
|
|
|
|
3195
|
|
|
|
|
|
|
package main; |
3196
|
|
|
|
|
|
|
|
3197
|
|
|
|
|
|
|
use Venus 'make'; |
3198
|
|
|
|
|
|
|
|
3199
|
|
|
|
|
|
|
my $made = make('Digest::SHA'); |
3200
|
|
|
|
|
|
|
|
3201
|
|
|
|
|
|
|
# bless(do{\(my $o = '...')}, 'Digest::SHA') |
3202
|
|
|
|
|
|
|
|
3203
|
|
|
|
|
|
|
=back |
3204
|
|
|
|
|
|
|
|
3205
|
|
|
|
|
|
|
=over 4 |
3206
|
|
|
|
|
|
|
|
3207
|
|
|
|
|
|
|
=item make example 2 |
3208
|
|
|
|
|
|
|
|
3209
|
|
|
|
|
|
|
package main; |
3210
|
|
|
|
|
|
|
|
3211
|
|
|
|
|
|
|
use Venus 'make'; |
3212
|
|
|
|
|
|
|
|
3213
|
|
|
|
|
|
|
my $made = make('Digest', 'SHA'); |
3214
|
|
|
|
|
|
|
|
3215
|
|
|
|
|
|
|
# bless(do{\(my $o = '...')}, 'Digest::SHA') |
3216
|
|
|
|
|
|
|
|
3217
|
|
|
|
|
|
|
=back |
3218
|
|
|
|
|
|
|
|
3219
|
|
|
|
|
|
|
=cut |
3220
|
|
|
|
|
|
|
|
3221
|
|
|
|
|
|
|
=head2 match |
3222
|
|
|
|
|
|
|
|
3223
|
|
|
|
|
|
|
match(Any $value, CodeRef $callback) (Any) |
3224
|
|
|
|
|
|
|
|
3225
|
|
|
|
|
|
|
The match function builds a L object, passing it and the value |
3226
|
|
|
|
|
|
|
provided to the callback provided, and returns the return value from |
3227
|
|
|
|
|
|
|
L. |
3228
|
|
|
|
|
|
|
|
3229
|
|
|
|
|
|
|
I> |
3230
|
|
|
|
|
|
|
|
3231
|
|
|
|
|
|
|
=over 4 |
3232
|
|
|
|
|
|
|
|
3233
|
|
|
|
|
|
|
=item match example 1 |
3234
|
|
|
|
|
|
|
|
3235
|
|
|
|
|
|
|
package main; |
3236
|
|
|
|
|
|
|
|
3237
|
|
|
|
|
|
|
use Venus 'match'; |
3238
|
|
|
|
|
|
|
|
3239
|
|
|
|
|
|
|
my $match = match 5; |
3240
|
|
|
|
|
|
|
|
3241
|
|
|
|
|
|
|
# bless({...}, 'Venus::Match') |
3242
|
|
|
|
|
|
|
|
3243
|
|
|
|
|
|
|
# $match->result; |
3244
|
|
|
|
|
|
|
|
3245
|
|
|
|
|
|
|
# undef |
3246
|
|
|
|
|
|
|
|
3247
|
|
|
|
|
|
|
=back |
3248
|
|
|
|
|
|
|
|
3249
|
|
|
|
|
|
|
=over 4 |
3250
|
|
|
|
|
|
|
|
3251
|
|
|
|
|
|
|
=item match example 2 |
3252
|
|
|
|
|
|
|
|
3253
|
|
|
|
|
|
|
package main; |
3254
|
|
|
|
|
|
|
|
3255
|
|
|
|
|
|
|
use Venus 'match'; |
3256
|
|
|
|
|
|
|
|
3257
|
|
|
|
|
|
|
my $match = match 5, sub {{ |
3258
|
|
|
|
|
|
|
1 => 'one', |
3259
|
|
|
|
|
|
|
2 => 'two', |
3260
|
|
|
|
|
|
|
5 => 'five', |
3261
|
|
|
|
|
|
|
}}; |
3262
|
|
|
|
|
|
|
|
3263
|
|
|
|
|
|
|
# 'five' |
3264
|
|
|
|
|
|
|
|
3265
|
|
|
|
|
|
|
=back |
3266
|
|
|
|
|
|
|
|
3267
|
|
|
|
|
|
|
=over 4 |
3268
|
|
|
|
|
|
|
|
3269
|
|
|
|
|
|
|
=item match example 3 |
3270
|
|
|
|
|
|
|
|
3271
|
|
|
|
|
|
|
package main; |
3272
|
|
|
|
|
|
|
|
3273
|
|
|
|
|
|
|
use Venus 'match'; |
3274
|
|
|
|
|
|
|
|
3275
|
|
|
|
|
|
|
my $match = match 5, sub {{ |
3276
|
|
|
|
|
|
|
1 => 'one', |
3277
|
|
|
|
|
|
|
2 => 'two', |
3278
|
|
|
|
|
|
|
3 => 'three', |
3279
|
|
|
|
|
|
|
}}; |
3280
|
|
|
|
|
|
|
|
3281
|
|
|
|
|
|
|
# undef |
3282
|
|
|
|
|
|
|
|
3283
|
|
|
|
|
|
|
=back |
3284
|
|
|
|
|
|
|
|
3285
|
|
|
|
|
|
|
=over 4 |
3286
|
|
|
|
|
|
|
|
3287
|
|
|
|
|
|
|
=item match example 4 |
3288
|
|
|
|
|
|
|
|
3289
|
|
|
|
|
|
|
package main; |
3290
|
|
|
|
|
|
|
|
3291
|
|
|
|
|
|
|
use Venus 'match'; |
3292
|
|
|
|
|
|
|
|
3293
|
|
|
|
|
|
|
my $match = match 5, sub { |
3294
|
|
|
|
|
|
|
my ($case) = @_; |
3295
|
|
|
|
|
|
|
|
3296
|
|
|
|
|
|
|
$case->when(sub{$_ < 5})->then('< 5'); |
3297
|
|
|
|
|
|
|
$case->when(sub{$_ > 5})->then('> 5'); |
3298
|
|
|
|
|
|
|
}; |
3299
|
|
|
|
|
|
|
|
3300
|
|
|
|
|
|
|
# undef |
3301
|
|
|
|
|
|
|
|
3302
|
|
|
|
|
|
|
=back |
3303
|
|
|
|
|
|
|
|
3304
|
|
|
|
|
|
|
=over 4 |
3305
|
|
|
|
|
|
|
|
3306
|
|
|
|
|
|
|
=item match example 5 |
3307
|
|
|
|
|
|
|
|
3308
|
|
|
|
|
|
|
package main; |
3309
|
|
|
|
|
|
|
|
3310
|
|
|
|
|
|
|
use Venus 'match'; |
3311
|
|
|
|
|
|
|
|
3312
|
|
|
|
|
|
|
my $match = match 6, sub { |
3313
|
|
|
|
|
|
|
my ($case, $data) = @_; |
3314
|
|
|
|
|
|
|
|
3315
|
|
|
|
|
|
|
$case->when(sub{$_ < 5})->then("$data < 5"); |
3316
|
|
|
|
|
|
|
$case->when(sub{$_ > 5})->then("$data > 5"); |
3317
|
|
|
|
|
|
|
}; |
3318
|
|
|
|
|
|
|
|
3319
|
|
|
|
|
|
|
# '6 > 5' |
3320
|
|
|
|
|
|
|
|
3321
|
|
|
|
|
|
|
=back |
3322
|
|
|
|
|
|
|
|
3323
|
|
|
|
|
|
|
=over 4 |
3324
|
|
|
|
|
|
|
|
3325
|
|
|
|
|
|
|
=item match example 6 |
3326
|
|
|
|
|
|
|
|
3327
|
|
|
|
|
|
|
package main; |
3328
|
|
|
|
|
|
|
|
3329
|
|
|
|
|
|
|
use Venus 'match'; |
3330
|
|
|
|
|
|
|
|
3331
|
|
|
|
|
|
|
my $match = match 4, sub { |
3332
|
|
|
|
|
|
|
|
3333
|
|
|
|
|
|
|
$_->when(sub{$_ < 5})->then("$_[1] < 5"); |
3334
|
|
|
|
|
|
|
$_->when(sub{$_ > 5})->then("$_[1] > 5"); |
3335
|
|
|
|
|
|
|
}; |
3336
|
|
|
|
|
|
|
|
3337
|
|
|
|
|
|
|
# '4 < 5' |
3338
|
|
|
|
|
|
|
|
3339
|
|
|
|
|
|
|
=back |
3340
|
|
|
|
|
|
|
|
3341
|
|
|
|
|
|
|
=cut |
3342
|
|
|
|
|
|
|
|
3343
|
|
|
|
|
|
|
=head2 merge |
3344
|
|
|
|
|
|
|
|
3345
|
|
|
|
|
|
|
merge(Any @args) (Any) |
3346
|
|
|
|
|
|
|
|
3347
|
|
|
|
|
|
|
The merge function returns a value which is a merger of all of the arguments |
3348
|
|
|
|
|
|
|
provided. |
3349
|
|
|
|
|
|
|
|
3350
|
|
|
|
|
|
|
I> |
3351
|
|
|
|
|
|
|
|
3352
|
|
|
|
|
|
|
=over 4 |
3353
|
|
|
|
|
|
|
|
3354
|
|
|
|
|
|
|
=item merge example 1 |
3355
|
|
|
|
|
|
|
|
3356
|
|
|
|
|
|
|
package main; |
3357
|
|
|
|
|
|
|
|
3358
|
|
|
|
|
|
|
use Venus 'merge'; |
3359
|
|
|
|
|
|
|
|
3360
|
|
|
|
|
|
|
my $merged = merge({1..4}, {5, 6}); |
3361
|
|
|
|
|
|
|
|
3362
|
|
|
|
|
|
|
# {1..6} |
3363
|
|
|
|
|
|
|
|
3364
|
|
|
|
|
|
|
=back |
3365
|
|
|
|
|
|
|
|
3366
|
|
|
|
|
|
|
=over 4 |
3367
|
|
|
|
|
|
|
|
3368
|
|
|
|
|
|
|
=item merge example 2 |
3369
|
|
|
|
|
|
|
|
3370
|
|
|
|
|
|
|
package main; |
3371
|
|
|
|
|
|
|
|
3372
|
|
|
|
|
|
|
use Venus 'merge'; |
3373
|
|
|
|
|
|
|
|
3374
|
|
|
|
|
|
|
my $merged = merge({1..4}, {5, 6}, {7, 8, 9, 0}); |
3375
|
|
|
|
|
|
|
|
3376
|
|
|
|
|
|
|
# {1..9, 0} |
3377
|
|
|
|
|
|
|
|
3378
|
|
|
|
|
|
|
=back |
3379
|
|
|
|
|
|
|
|
3380
|
|
|
|
|
|
|
=cut |
3381
|
|
|
|
|
|
|
|
3382
|
|
|
|
|
|
|
=head2 meta |
3383
|
|
|
|
|
|
|
|
3384
|
|
|
|
|
|
|
meta(Str $value, Str | CodeRef $code, Any @args) (Any) |
3385
|
|
|
|
|
|
|
|
3386
|
|
|
|
|
|
|
The meta function builds and returns a L object, or dispatches to |
3387
|
|
|
|
|
|
|
the coderef or method provided. |
3388
|
|
|
|
|
|
|
|
3389
|
|
|
|
|
|
|
I> |
3390
|
|
|
|
|
|
|
|
3391
|
|
|
|
|
|
|
=over 4 |
3392
|
|
|
|
|
|
|
|
3393
|
|
|
|
|
|
|
=item meta example 1 |
3394
|
|
|
|
|
|
|
|
3395
|
|
|
|
|
|
|
package main; |
3396
|
|
|
|
|
|
|
|
3397
|
|
|
|
|
|
|
use Venus 'meta'; |
3398
|
|
|
|
|
|
|
|
3399
|
|
|
|
|
|
|
my $meta = meta 'Venus'; |
3400
|
|
|
|
|
|
|
|
3401
|
|
|
|
|
|
|
# bless({...}, 'Venus::Meta') |
3402
|
|
|
|
|
|
|
|
3403
|
|
|
|
|
|
|
=back |
3404
|
|
|
|
|
|
|
|
3405
|
|
|
|
|
|
|
=over 4 |
3406
|
|
|
|
|
|
|
|
3407
|
|
|
|
|
|
|
=item meta example 2 |
3408
|
|
|
|
|
|
|
|
3409
|
|
|
|
|
|
|
package main; |
3410
|
|
|
|
|
|
|
|
3411
|
|
|
|
|
|
|
use Venus 'meta'; |
3412
|
|
|
|
|
|
|
|
3413
|
|
|
|
|
|
|
my $result = meta 'Venus', 'sub', 'meta'; |
3414
|
|
|
|
|
|
|
|
3415
|
|
|
|
|
|
|
# 1 |
3416
|
|
|
|
|
|
|
|
3417
|
|
|
|
|
|
|
=back |
3418
|
|
|
|
|
|
|
|
3419
|
|
|
|
|
|
|
=cut |
3420
|
|
|
|
|
|
|
|
3421
|
|
|
|
|
|
|
=head2 name |
3422
|
|
|
|
|
|
|
|
3423
|
|
|
|
|
|
|
name(Str $value, Str | CodeRef $code, Any @args) (Any) |
3424
|
|
|
|
|
|
|
|
3425
|
|
|
|
|
|
|
The name function builds and returns a L object, or dispatches to |
3426
|
|
|
|
|
|
|
the coderef or method provided. |
3427
|
|
|
|
|
|
|
|
3428
|
|
|
|
|
|
|
I> |
3429
|
|
|
|
|
|
|
|
3430
|
|
|
|
|
|
|
=over 4 |
3431
|
|
|
|
|
|
|
|
3432
|
|
|
|
|
|
|
=item name example 1 |
3433
|
|
|
|
|
|
|
|
3434
|
|
|
|
|
|
|
package main; |
3435
|
|
|
|
|
|
|
|
3436
|
|
|
|
|
|
|
use Venus 'name'; |
3437
|
|
|
|
|
|
|
|
3438
|
|
|
|
|
|
|
my $name = name 'Foo/Bar'; |
3439
|
|
|
|
|
|
|
|
3440
|
|
|
|
|
|
|
# bless({...}, 'Venus::Name') |
3441
|
|
|
|
|
|
|
|
3442
|
|
|
|
|
|
|
=back |
3443
|
|
|
|
|
|
|
|
3444
|
|
|
|
|
|
|
=over 4 |
3445
|
|
|
|
|
|
|
|
3446
|
|
|
|
|
|
|
=item name example 2 |
3447
|
|
|
|
|
|
|
|
3448
|
|
|
|
|
|
|
package main; |
3449
|
|
|
|
|
|
|
|
3450
|
|
|
|
|
|
|
use Venus 'name'; |
3451
|
|
|
|
|
|
|
|
3452
|
|
|
|
|
|
|
my $name = name 'Foo/Bar', 'package'; |
3453
|
|
|
|
|
|
|
|
3454
|
|
|
|
|
|
|
# "Foo::Bar" |
3455
|
|
|
|
|
|
|
|
3456
|
|
|
|
|
|
|
=back |
3457
|
|
|
|
|
|
|
|
3458
|
|
|
|
|
|
|
=cut |
3459
|
|
|
|
|
|
|
|
3460
|
|
|
|
|
|
|
=head2 number |
3461
|
|
|
|
|
|
|
|
3462
|
|
|
|
|
|
|
number(Num $value, Str | CodeRef $code, Any @args) (Any) |
3463
|
|
|
|
|
|
|
|
3464
|
|
|
|
|
|
|
The number function builds and returns a L object, or dispatches |
3465
|
|
|
|
|
|
|
to the coderef or method provided. |
3466
|
|
|
|
|
|
|
|
3467
|
|
|
|
|
|
|
I> |
3468
|
|
|
|
|
|
|
|
3469
|
|
|
|
|
|
|
=over 4 |
3470
|
|
|
|
|
|
|
|
3471
|
|
|
|
|
|
|
=item number example 1 |
3472
|
|
|
|
|
|
|
|
3473
|
|
|
|
|
|
|
package main; |
3474
|
|
|
|
|
|
|
|
3475
|
|
|
|
|
|
|
use Venus 'number'; |
3476
|
|
|
|
|
|
|
|
3477
|
|
|
|
|
|
|
my $number = number 1_000; |
3478
|
|
|
|
|
|
|
|
3479
|
|
|
|
|
|
|
# bless({...}, 'Venus::Number') |
3480
|
|
|
|
|
|
|
|
3481
|
|
|
|
|
|
|
=back |
3482
|
|
|
|
|
|
|
|
3483
|
|
|
|
|
|
|
=over 4 |
3484
|
|
|
|
|
|
|
|
3485
|
|
|
|
|
|
|
=item number example 2 |
3486
|
|
|
|
|
|
|
|
3487
|
|
|
|
|
|
|
package main; |
3488
|
|
|
|
|
|
|
|
3489
|
|
|
|
|
|
|
use Venus 'number'; |
3490
|
|
|
|
|
|
|
|
3491
|
|
|
|
|
|
|
my $number = number 1_000, 'prepend', 1; |
3492
|
|
|
|
|
|
|
|
3493
|
|
|
|
|
|
|
# 11_000 |
3494
|
|
|
|
|
|
|
|
3495
|
|
|
|
|
|
|
=back |
3496
|
|
|
|
|
|
|
|
3497
|
|
|
|
|
|
|
=cut |
3498
|
|
|
|
|
|
|
|
3499
|
|
|
|
|
|
|
=head2 opts |
3500
|
|
|
|
|
|
|
|
3501
|
|
|
|
|
|
|
opts(ArrayRef $value, Str | CodeRef $code, Any @args) (Any) |
3502
|
|
|
|
|
|
|
|
3503
|
|
|
|
|
|
|
The opts function builds and returns a L object, or dispatches to |
3504
|
|
|
|
|
|
|
the coderef or method provided. |
3505
|
|
|
|
|
|
|
|
3506
|
|
|
|
|
|
|
I> |
3507
|
|
|
|
|
|
|
|
3508
|
|
|
|
|
|
|
=over 4 |
3509
|
|
|
|
|
|
|
|
3510
|
|
|
|
|
|
|
=item opts example 1 |
3511
|
|
|
|
|
|
|
|
3512
|
|
|
|
|
|
|
package main; |
3513
|
|
|
|
|
|
|
|
3514
|
|
|
|
|
|
|
use Venus 'opts'; |
3515
|
|
|
|
|
|
|
|
3516
|
|
|
|
|
|
|
my $opts = opts ['--resource', 'users']; |
3517
|
|
|
|
|
|
|
|
3518
|
|
|
|
|
|
|
# bless({...}, 'Venus::Opts') |
3519
|
|
|
|
|
|
|
|
3520
|
|
|
|
|
|
|
=back |
3521
|
|
|
|
|
|
|
|
3522
|
|
|
|
|
|
|
=over 4 |
3523
|
|
|
|
|
|
|
|
3524
|
|
|
|
|
|
|
=item opts example 2 |
3525
|
|
|
|
|
|
|
|
3526
|
|
|
|
|
|
|
package main; |
3527
|
|
|
|
|
|
|
|
3528
|
|
|
|
|
|
|
use Venus 'opts'; |
3529
|
|
|
|
|
|
|
|
3530
|
|
|
|
|
|
|
my $opts = opts ['--resource', 'users'], 'reparse', ['resource|r=s', 'help|h']; |
3531
|
|
|
|
|
|
|
|
3532
|
|
|
|
|
|
|
# bless({...}, 'Venus::Opts') |
3533
|
|
|
|
|
|
|
|
3534
|
|
|
|
|
|
|
# my $resource = $opts->get('resource'); |
3535
|
|
|
|
|
|
|
|
3536
|
|
|
|
|
|
|
# "users" |
3537
|
|
|
|
|
|
|
|
3538
|
|
|
|
|
|
|
=back |
3539
|
|
|
|
|
|
|
|
3540
|
|
|
|
|
|
|
=cut |
3541
|
|
|
|
|
|
|
|
3542
|
|
|
|
|
|
|
=head2 pairs |
3543
|
|
|
|
|
|
|
|
3544
|
|
|
|
|
|
|
pairs(Any $data) (ArrayRef) |
3545
|
|
|
|
|
|
|
|
3546
|
|
|
|
|
|
|
The pairs function accepts an arrayref or hashref and returns an arrayref of |
3547
|
|
|
|
|
|
|
arrayrefs holding keys (or indices) and values. The function returns an empty |
3548
|
|
|
|
|
|
|
arrayref for all other values provided. Returns a list in list context. |
3549
|
|
|
|
|
|
|
|
3550
|
|
|
|
|
|
|
I> |
3551
|
|
|
|
|
|
|
|
3552
|
|
|
|
|
|
|
=over 4 |
3553
|
|
|
|
|
|
|
|
3554
|
|
|
|
|
|
|
=item pairs example 1 |
3555
|
|
|
|
|
|
|
|
3556
|
|
|
|
|
|
|
package main; |
3557
|
|
|
|
|
|
|
|
3558
|
|
|
|
|
|
|
use Venus 'pairs'; |
3559
|
|
|
|
|
|
|
|
3560
|
|
|
|
|
|
|
my $pairs = pairs [1..4]; |
3561
|
|
|
|
|
|
|
|
3562
|
|
|
|
|
|
|
# [[0,1], [1,2], [2,3], [3,4]] |
3563
|
|
|
|
|
|
|
|
3564
|
|
|
|
|
|
|
=back |
3565
|
|
|
|
|
|
|
|
3566
|
|
|
|
|
|
|
=over 4 |
3567
|
|
|
|
|
|
|
|
3568
|
|
|
|
|
|
|
=item pairs example 2 |
3569
|
|
|
|
|
|
|
|
3570
|
|
|
|
|
|
|
package main; |
3571
|
|
|
|
|
|
|
|
3572
|
|
|
|
|
|
|
use Venus 'pairs'; |
3573
|
|
|
|
|
|
|
|
3574
|
|
|
|
|
|
|
my $pairs = pairs {'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4}; |
3575
|
|
|
|
|
|
|
|
3576
|
|
|
|
|
|
|
# [['a',1], ['b',2], ['c',3], ['d',4]] |
3577
|
|
|
|
|
|
|
|
3578
|
|
|
|
|
|
|
=back |
3579
|
|
|
|
|
|
|
|
3580
|
|
|
|
|
|
|
=over 4 |
3581
|
|
|
|
|
|
|
|
3582
|
|
|
|
|
|
|
=item pairs example 3 |
3583
|
|
|
|
|
|
|
|
3584
|
|
|
|
|
|
|
package main; |
3585
|
|
|
|
|
|
|
|
3586
|
|
|
|
|
|
|
use Venus 'pairs'; |
3587
|
|
|
|
|
|
|
|
3588
|
|
|
|
|
|
|
my @pairs = pairs [1..4]; |
3589
|
|
|
|
|
|
|
|
3590
|
|
|
|
|
|
|
# ([0,1], [1,2], [2,3], [3,4]) |
3591
|
|
|
|
|
|
|
|
3592
|
|
|
|
|
|
|
=back |
3593
|
|
|
|
|
|
|
|
3594
|
|
|
|
|
|
|
=over 4 |
3595
|
|
|
|
|
|
|
|
3596
|
|
|
|
|
|
|
=item pairs example 4 |
3597
|
|
|
|
|
|
|
|
3598
|
|
|
|
|
|
|
package main; |
3599
|
|
|
|
|
|
|
|
3600
|
|
|
|
|
|
|
use Venus 'pairs'; |
3601
|
|
|
|
|
|
|
|
3602
|
|
|
|
|
|
|
my @pairs = pairs {'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4}; |
3603
|
|
|
|
|
|
|
|
3604
|
|
|
|
|
|
|
# (['a',1], ['b',2], ['c',3], ['d',4]) |
3605
|
|
|
|
|
|
|
|
3606
|
|
|
|
|
|
|
=back |
3607
|
|
|
|
|
|
|
|
3608
|
|
|
|
|
|
|
=cut |
3609
|
|
|
|
|
|
|
|
3610
|
|
|
|
|
|
|
=head2 path |
3611
|
|
|
|
|
|
|
|
3612
|
|
|
|
|
|
|
path(Str $value, Str | CodeRef $code, Any @args) (Any) |
3613
|
|
|
|
|
|
|
|
3614
|
|
|
|
|
|
|
The path function builds and returns a L object, or dispatches |
3615
|
|
|
|
|
|
|
to the coderef or method provided. |
3616
|
|
|
|
|
|
|
|
3617
|
|
|
|
|
|
|
I> |
3618
|
|
|
|
|
|
|
|
3619
|
|
|
|
|
|
|
=over 4 |
3620
|
|
|
|
|
|
|
|
3621
|
|
|
|
|
|
|
=item path example 1 |
3622
|
|
|
|
|
|
|
|
3623
|
|
|
|
|
|
|
package main; |
3624
|
|
|
|
|
|
|
|
3625
|
|
|
|
|
|
|
use Venus 'path'; |
3626
|
|
|
|
|
|
|
|
3627
|
|
|
|
|
|
|
my $path = path 't/data/planets'; |
3628
|
|
|
|
|
|
|
|
3629
|
|
|
|
|
|
|
# bless({...}, 'Venus::Path') |
3630
|
|
|
|
|
|
|
|
3631
|
|
|
|
|
|
|
=back |
3632
|
|
|
|
|
|
|
|
3633
|
|
|
|
|
|
|
=over 4 |
3634
|
|
|
|
|
|
|
|
3635
|
|
|
|
|
|
|
=item path example 2 |
3636
|
|
|
|
|
|
|
|
3637
|
|
|
|
|
|
|
package main; |
3638
|
|
|
|
|
|
|
|
3639
|
|
|
|
|
|
|
use Venus 'path'; |
3640
|
|
|
|
|
|
|
|
3641
|
|
|
|
|
|
|
my $path = path 't/data/planets', 'absolute'; |
3642
|
|
|
|
|
|
|
|
3643
|
|
|
|
|
|
|
# bless({...}, 'Venus::Path') |
3644
|
|
|
|
|
|
|
|
3645
|
|
|
|
|
|
|
=back |
3646
|
|
|
|
|
|
|
|
3647
|
|
|
|
|
|
|
=cut |
3648
|
|
|
|
|
|
|
|
3649
|
|
|
|
|
|
|
=head2 perl |
3650
|
|
|
|
|
|
|
|
3651
|
|
|
|
|
|
|
perl(Str $call, Any $data) (Any) |
3652
|
|
|
|
|
|
|
|
3653
|
|
|
|
|
|
|
The perl function builds a L object and will either |
3654
|
|
|
|
|
|
|
L or L based on the argument provided |
3655
|
|
|
|
|
|
|
and returns the result. |
3656
|
|
|
|
|
|
|
|
3657
|
|
|
|
|
|
|
I> |
3658
|
|
|
|
|
|
|
|
3659
|
|
|
|
|
|
|
=over 4 |
3660
|
|
|
|
|
|
|
|
3661
|
|
|
|
|
|
|
=item perl example 1 |
3662
|
|
|
|
|
|
|
|
3663
|
|
|
|
|
|
|
package main; |
3664
|
|
|
|
|
|
|
|
3665
|
|
|
|
|
|
|
use Venus 'perl'; |
3666
|
|
|
|
|
|
|
|
3667
|
|
|
|
|
|
|
my $decode = perl 'decode', '{stable=>bless({},\'Venus::True\')}'; |
3668
|
|
|
|
|
|
|
|
3669
|
|
|
|
|
|
|
# { stable => 1 } |
3670
|
|
|
|
|
|
|
|
3671
|
|
|
|
|
|
|
=back |
3672
|
|
|
|
|
|
|
|
3673
|
|
|
|
|
|
|
=over 4 |
3674
|
|
|
|
|
|
|
|
3675
|
|
|
|
|
|
|
=item perl example 2 |
3676
|
|
|
|
|
|
|
|
3677
|
|
|
|
|
|
|
package main; |
3678
|
|
|
|
|
|
|
|
3679
|
|
|
|
|
|
|
use Venus 'perl'; |
3680
|
|
|
|
|
|
|
|
3681
|
|
|
|
|
|
|
my $encode = perl 'encode', { stable => true }; |
3682
|
|
|
|
|
|
|
|
3683
|
|
|
|
|
|
|
# '{stable=>bless({},\'Venus::True\')}' |
3684
|
|
|
|
|
|
|
|
3685
|
|
|
|
|
|
|
=back |
3686
|
|
|
|
|
|
|
|
3687
|
|
|
|
|
|
|
=over 4 |
3688
|
|
|
|
|
|
|
|
3689
|
|
|
|
|
|
|
=item perl example 3 |
3690
|
|
|
|
|
|
|
|
3691
|
|
|
|
|
|
|
package main; |
3692
|
|
|
|
|
|
|
|
3693
|
|
|
|
|
|
|
use Venus 'perl'; |
3694
|
|
|
|
|
|
|
|
3695
|
|
|
|
|
|
|
my $perl = perl; |
3696
|
|
|
|
|
|
|
|
3697
|
|
|
|
|
|
|
# bless({...}, 'Venus::Dump') |
3698
|
|
|
|
|
|
|
|
3699
|
|
|
|
|
|
|
=back |
3700
|
|
|
|
|
|
|
|
3701
|
|
|
|
|
|
|
=over 4 |
3702
|
|
|
|
|
|
|
|
3703
|
|
|
|
|
|
|
=item perl example 4 |
3704
|
|
|
|
|
|
|
|
3705
|
|
|
|
|
|
|
package main; |
3706
|
|
|
|
|
|
|
|
3707
|
|
|
|
|
|
|
use Venus 'perl'; |
3708
|
|
|
|
|
|
|
|
3709
|
|
|
|
|
|
|
my $perl = perl 'class', {data => "..."}; |
3710
|
|
|
|
|
|
|
|
3711
|
|
|
|
|
|
|
# Exception! (isa Venus::Fault) |
3712
|
|
|
|
|
|
|
|
3713
|
|
|
|
|
|
|
=back |
3714
|
|
|
|
|
|
|
|
3715
|
|
|
|
|
|
|
=cut |
3716
|
|
|
|
|
|
|
|
3717
|
|
|
|
|
|
|
=head2 process |
3718
|
|
|
|
|
|
|
|
3719
|
|
|
|
|
|
|
process(Str | CodeRef $code, Any @args) (Any) |
3720
|
|
|
|
|
|
|
|
3721
|
|
|
|
|
|
|
The process function builds and returns a L object, or |
3722
|
|
|
|
|
|
|
dispatches to the coderef or method provided. |
3723
|
|
|
|
|
|
|
|
3724
|
|
|
|
|
|
|
I> |
3725
|
|
|
|
|
|
|
|
3726
|
|
|
|
|
|
|
=over 4 |
3727
|
|
|
|
|
|
|
|
3728
|
|
|
|
|
|
|
=item process example 1 |
3729
|
|
|
|
|
|
|
|
3730
|
|
|
|
|
|
|
package main; |
3731
|
|
|
|
|
|
|
|
3732
|
|
|
|
|
|
|
use Venus 'process'; |
3733
|
|
|
|
|
|
|
|
3734
|
|
|
|
|
|
|
my $process = process; |
3735
|
|
|
|
|
|
|
|
3736
|
|
|
|
|
|
|
# bless({...}, 'Venus::Process') |
3737
|
|
|
|
|
|
|
|
3738
|
|
|
|
|
|
|
=back |
3739
|
|
|
|
|
|
|
|
3740
|
|
|
|
|
|
|
=over 4 |
3741
|
|
|
|
|
|
|
|
3742
|
|
|
|
|
|
|
=item process example 2 |
3743
|
|
|
|
|
|
|
|
3744
|
|
|
|
|
|
|
package main; |
3745
|
|
|
|
|
|
|
|
3746
|
|
|
|
|
|
|
use Venus 'process'; |
3747
|
|
|
|
|
|
|
|
3748
|
|
|
|
|
|
|
my $process = process 'do', 'alarm', 10; |
3749
|
|
|
|
|
|
|
|
3750
|
|
|
|
|
|
|
# bless({...}, 'Venus::Process') |
3751
|
|
|
|
|
|
|
|
3752
|
|
|
|
|
|
|
=back |
3753
|
|
|
|
|
|
|
|
3754
|
|
|
|
|
|
|
=cut |
3755
|
|
|
|
|
|
|
|
3756
|
|
|
|
|
|
|
=head2 proto |
3757
|
|
|
|
|
|
|
|
3758
|
|
|
|
|
|
|
proto(HashRef $value, Str | CodeRef $code, Any @args) (Any) |
3759
|
|
|
|
|
|
|
|
3760
|
|
|
|
|
|
|
The proto function builds and returns a L object, or |
3761
|
|
|
|
|
|
|
dispatches to the coderef or method provided. |
3762
|
|
|
|
|
|
|
|
3763
|
|
|
|
|
|
|
I> |
3764
|
|
|
|
|
|
|
|
3765
|
|
|
|
|
|
|
=over 4 |
3766
|
|
|
|
|
|
|
|
3767
|
|
|
|
|
|
|
=item proto example 1 |
3768
|
|
|
|
|
|
|
|
3769
|
|
|
|
|
|
|
package main; |
3770
|
|
|
|
|
|
|
|
3771
|
|
|
|
|
|
|
use Venus 'proto'; |
3772
|
|
|
|
|
|
|
|
3773
|
|
|
|
|
|
|
my $proto = proto { |
3774
|
|
|
|
|
|
|
'$counter' => 0, |
3775
|
|
|
|
|
|
|
}; |
3776
|
|
|
|
|
|
|
|
3777
|
|
|
|
|
|
|
# bless({...}, 'Venus::Prototype') |
3778
|
|
|
|
|
|
|
|
3779
|
|
|
|
|
|
|
=back |
3780
|
|
|
|
|
|
|
|
3781
|
|
|
|
|
|
|
=over 4 |
3782
|
|
|
|
|
|
|
|
3783
|
|
|
|
|
|
|
=item proto example 2 |
3784
|
|
|
|
|
|
|
|
3785
|
|
|
|
|
|
|
package main; |
3786
|
|
|
|
|
|
|
|
3787
|
|
|
|
|
|
|
use Venus 'proto'; |
3788
|
|
|
|
|
|
|
|
3789
|
|
|
|
|
|
|
my $proto = proto { '$counter' => 0 }, 'apply', { |
3790
|
|
|
|
|
|
|
'&decrement' => sub { $_[0]->counter($_[0]->counter - 1) }, |
3791
|
|
|
|
|
|
|
'&increment' => sub { $_[0]->counter($_[0]->counter + 1) }, |
3792
|
|
|
|
|
|
|
}; |
3793
|
|
|
|
|
|
|
|
3794
|
|
|
|
|
|
|
# bless({...}, 'Venus::Prototype') |
3795
|
|
|
|
|
|
|
|
3796
|
|
|
|
|
|
|
=back |
3797
|
|
|
|
|
|
|
|
3798
|
|
|
|
|
|
|
=cut |
3799
|
|
|
|
|
|
|
|
3800
|
|
|
|
|
|
|
=head2 puts |
3801
|
|
|
|
|
|
|
|
3802
|
|
|
|
|
|
|
puts(Any @args) (ArrayRef) |
3803
|
|
|
|
|
|
|
|
3804
|
|
|
|
|
|
|
The puts function select values from within the underlying data structure using |
3805
|
|
|
|
|
|
|
L or L, optionally assigning the value to |
3806
|
|
|
|
|
|
|
the preceeding scalar reference and returns all the values selected. |
3807
|
|
|
|
|
|
|
|
3808
|
|
|
|
|
|
|
I> |
3809
|
|
|
|
|
|
|
|
3810
|
|
|
|
|
|
|
=over 4 |
3811
|
|
|
|
|
|
|
|
3812
|
|
|
|
|
|
|
=item puts example 1 |
3813
|
|
|
|
|
|
|
|
3814
|
|
|
|
|
|
|
package main; |
3815
|
|
|
|
|
|
|
|
3816
|
|
|
|
|
|
|
use Venus 'puts'; |
3817
|
|
|
|
|
|
|
|
3818
|
|
|
|
|
|
|
my $data = { |
3819
|
|
|
|
|
|
|
size => "small", |
3820
|
|
|
|
|
|
|
fruit => "apple", |
3821
|
|
|
|
|
|
|
meta => { |
3822
|
|
|
|
|
|
|
expiry => '5d', |
3823
|
|
|
|
|
|
|
}, |
3824
|
|
|
|
|
|
|
color => "red", |
3825
|
|
|
|
|
|
|
}; |
3826
|
|
|
|
|
|
|
|
3827
|
|
|
|
|
|
|
puts $data, ( |
3828
|
|
|
|
|
|
|
\my $fruit, 'fruit', |
3829
|
|
|
|
|
|
|
\my $expiry, 'meta.expiry' |
3830
|
|
|
|
|
|
|
); |
3831
|
|
|
|
|
|
|
|
3832
|
|
|
|
|
|
|
my $puts = [$fruit, $expiry]; |
3833
|
|
|
|
|
|
|
|
3834
|
|
|
|
|
|
|
# ["apple", "5d"] |
3835
|
|
|
|
|
|
|
|
3836
|
|
|
|
|
|
|
=back |
3837
|
|
|
|
|
|
|
|
3838
|
|
|
|
|
|
|
=cut |
3839
|
|
|
|
|
|
|
|
3840
|
|
|
|
|
|
|
=head2 raise |
3841
|
|
|
|
|
|
|
|
3842
|
|
|
|
|
|
|
raise(Str $class | Tuple[Str, Str] $class, Maybe[HashRef] $args) (Error) |
3843
|
|
|
|
|
|
|
|
3844
|
|
|
|
|
|
|
The raise function generates and throws a named exception object derived from |
3845
|
|
|
|
|
|
|
L, or provided base class, using the exception object arguments |
3846
|
|
|
|
|
|
|
provided. |
3847
|
|
|
|
|
|
|
|
3848
|
|
|
|
|
|
|
I> |
3849
|
|
|
|
|
|
|
|
3850
|
|
|
|
|
|
|
=over 4 |
3851
|
|
|
|
|
|
|
|
3852
|
|
|
|
|
|
|
=item raise example 1 |
3853
|
|
|
|
|
|
|
|
3854
|
|
|
|
|
|
|
package main; |
3855
|
|
|
|
|
|
|
|
3856
|
|
|
|
|
|
|
use Venus 'raise'; |
3857
|
|
|
|
|
|
|
|
3858
|
|
|
|
|
|
|
my $error = raise 'MyApp::Error'; |
3859
|
|
|
|
|
|
|
|
3860
|
|
|
|
|
|
|
# bless({...}, 'MyApp::Error') |
3861
|
|
|
|
|
|
|
|
3862
|
|
|
|
|
|
|
=back |
3863
|
|
|
|
|
|
|
|
3864
|
|
|
|
|
|
|
=over 4 |
3865
|
|
|
|
|
|
|
|
3866
|
|
|
|
|
|
|
=item raise example 2 |
3867
|
|
|
|
|
|
|
|
3868
|
|
|
|
|
|
|
package main; |
3869
|
|
|
|
|
|
|
|
3870
|
|
|
|
|
|
|
use Venus 'raise'; |
3871
|
|
|
|
|
|
|
|
3872
|
|
|
|
|
|
|
my $error = raise ['MyApp::Error', 'Venus::Error']; |
3873
|
|
|
|
|
|
|
|
3874
|
|
|
|
|
|
|
# bless({...}, 'MyApp::Error') |
3875
|
|
|
|
|
|
|
|
3876
|
|
|
|
|
|
|
=back |
3877
|
|
|
|
|
|
|
|
3878
|
|
|
|
|
|
|
=over 4 |
3879
|
|
|
|
|
|
|
|
3880
|
|
|
|
|
|
|
=item raise example 3 |
3881
|
|
|
|
|
|
|
|
3882
|
|
|
|
|
|
|
package main; |
3883
|
|
|
|
|
|
|
|
3884
|
|
|
|
|
|
|
use Venus 'raise'; |
3885
|
|
|
|
|
|
|
|
3886
|
|
|
|
|
|
|
my $error = raise ['MyApp::Error', 'Venus::Error'], { |
3887
|
|
|
|
|
|
|
message => 'Something failed!', |
3888
|
|
|
|
|
|
|
}; |
3889
|
|
|
|
|
|
|
|
3890
|
|
|
|
|
|
|
# bless({message => 'Something failed!', ...}, 'MyApp::Error') |
3891
|
|
|
|
|
|
|
|
3892
|
|
|
|
|
|
|
=back |
3893
|
|
|
|
|
|
|
|
3894
|
|
|
|
|
|
|
=cut |
3895
|
|
|
|
|
|
|
|
3896
|
|
|
|
|
|
|
=head2 random |
3897
|
|
|
|
|
|
|
|
3898
|
|
|
|
|
|
|
random(Str | CodeRef $code, Any @args) (Any) |
3899
|
|
|
|
|
|
|
|
3900
|
|
|
|
|
|
|
The random function builds and returns a L object, or dispatches |
3901
|
|
|
|
|
|
|
to the coderef or method provided. |
3902
|
|
|
|
|
|
|
|
3903
|
|
|
|
|
|
|
I> |
3904
|
|
|
|
|
|
|
|
3905
|
|
|
|
|
|
|
=over 4 |
3906
|
|
|
|
|
|
|
|
3907
|
|
|
|
|
|
|
=item random example 1 |
3908
|
|
|
|
|
|
|
|
3909
|
|
|
|
|
|
|
package main; |
3910
|
|
|
|
|
|
|
|
3911
|
|
|
|
|
|
|
use Venus 'random'; |
3912
|
|
|
|
|
|
|
|
3913
|
|
|
|
|
|
|
my $random = random; |
3914
|
|
|
|
|
|
|
|
3915
|
|
|
|
|
|
|
# bless({...}, 'Venus::Random') |
3916
|
|
|
|
|
|
|
|
3917
|
|
|
|
|
|
|
=back |
3918
|
|
|
|
|
|
|
|
3919
|
|
|
|
|
|
|
=over 4 |
3920
|
|
|
|
|
|
|
|
3921
|
|
|
|
|
|
|
=item random example 2 |
3922
|
|
|
|
|
|
|
|
3923
|
|
|
|
|
|
|
package main; |
3924
|
|
|
|
|
|
|
|
3925
|
|
|
|
|
|
|
use Venus 'random'; |
3926
|
|
|
|
|
|
|
|
3927
|
|
|
|
|
|
|
my $random = random 'collect', 10, 'letter'; |
3928
|
|
|
|
|
|
|
|
3929
|
|
|
|
|
|
|
# "ryKUPbJHYT" |
3930
|
|
|
|
|
|
|
|
3931
|
|
|
|
|
|
|
=back |
3932
|
|
|
|
|
|
|
|
3933
|
|
|
|
|
|
|
=cut |
3934
|
|
|
|
|
|
|
|
3935
|
|
|
|
|
|
|
=head2 range |
3936
|
|
|
|
|
|
|
|
3937
|
|
|
|
|
|
|
range(Int | Str @args) (ArrayRef) |
3938
|
|
|
|
|
|
|
|
3939
|
|
|
|
|
|
|
The range function returns the result of a L operation. |
3940
|
|
|
|
|
|
|
|
3941
|
|
|
|
|
|
|
I> |
3942
|
|
|
|
|
|
|
|
3943
|
|
|
|
|
|
|
=over 4 |
3944
|
|
|
|
|
|
|
|
3945
|
|
|
|
|
|
|
=item range example 1 |
3946
|
|
|
|
|
|
|
|
3947
|
|
|
|
|
|
|
package main; |
3948
|
|
|
|
|
|
|
|
3949
|
|
|
|
|
|
|
use Venus 'range'; |
3950
|
|
|
|
|
|
|
|
3951
|
|
|
|
|
|
|
my $range = range [1..9], ':4'; |
3952
|
|
|
|
|
|
|
|
3953
|
|
|
|
|
|
|
# [1..5] |
3954
|
|
|
|
|
|
|
|
3955
|
|
|
|
|
|
|
=back |
3956
|
|
|
|
|
|
|
|
3957
|
|
|
|
|
|
|
=over 4 |
3958
|
|
|
|
|
|
|
|
3959
|
|
|
|
|
|
|
=item range example 2 |
3960
|
|
|
|
|
|
|
|
3961
|
|
|
|
|
|
|
package main; |
3962
|
|
|
|
|
|
|
|
3963
|
|
|
|
|
|
|
use Venus 'range'; |
3964
|
|
|
|
|
|
|
|
3965
|
|
|
|
|
|
|
my $range = range [1..9], '-4:-1'; |
3966
|
|
|
|
|
|
|
|
3967
|
|
|
|
|
|
|
# [6..9] |
3968
|
|
|
|
|
|
|
|
3969
|
|
|
|
|
|
|
=back |
3970
|
|
|
|
|
|
|
|
3971
|
|
|
|
|
|
|
=cut |
3972
|
|
|
|
|
|
|
|
3973
|
|
|
|
|
|
|
=head2 regexp |
3974
|
|
|
|
|
|
|
|
3975
|
|
|
|
|
|
|
regexp(Str $value, Str | CodeRef $code, Any @args) (Any) |
3976
|
|
|
|
|
|
|
|
3977
|
|
|
|
|
|
|
The regexp function builds and returns a L object, or dispatches |
3978
|
|
|
|
|
|
|
to the coderef or method provided. |
3979
|
|
|
|
|
|
|
|
3980
|
|
|
|
|
|
|
I> |
3981
|
|
|
|
|
|
|
|
3982
|
|
|
|
|
|
|
=over 4 |
3983
|
|
|
|
|
|
|
|
3984
|
|
|
|
|
|
|
=item regexp example 1 |
3985
|
|
|
|
|
|
|
|
3986
|
|
|
|
|
|
|
package main; |
3987
|
|
|
|
|
|
|
|
3988
|
|
|
|
|
|
|
use Venus 'regexp'; |
3989
|
|
|
|
|
|
|
|
3990
|
|
|
|
|
|
|
my $regexp = regexp '[0-9]'; |
3991
|
|
|
|
|
|
|
|
3992
|
|
|
|
|
|
|
# bless({...}, 'Venus::Regexp') |
3993
|
|
|
|
|
|
|
|
3994
|
|
|
|
|
|
|
=back |
3995
|
|
|
|
|
|
|
|
3996
|
|
|
|
|
|
|
=over 4 |
3997
|
|
|
|
|
|
|
|
3998
|
|
|
|
|
|
|
=item regexp example 2 |
3999
|
|
|
|
|
|
|
|
4000
|
|
|
|
|
|
|
package main; |
4001
|
|
|
|
|
|
|
|
4002
|
|
|
|
|
|
|
use Venus 'regexp'; |
4003
|
|
|
|
|
|
|
|
4004
|
|
|
|
|
|
|
my $replace = regexp '[0-9]', 'replace', 'ID 12345', '0', 'g'; |
4005
|
|
|
|
|
|
|
|
4006
|
|
|
|
|
|
|
# bless({...}, 'Venus::Replace') |
4007
|
|
|
|
|
|
|
|
4008
|
|
|
|
|
|
|
# $replace->get; |
4009
|
|
|
|
|
|
|
|
4010
|
|
|
|
|
|
|
# "ID 00000" |
4011
|
|
|
|
|
|
|
|
4012
|
|
|
|
|
|
|
=back |
4013
|
|
|
|
|
|
|
|
4014
|
|
|
|
|
|
|
=cut |
4015
|
|
|
|
|
|
|
|
4016
|
|
|
|
|
|
|
=head2 render |
4017
|
|
|
|
|
|
|
|
4018
|
|
|
|
|
|
|
render(Str $data, HashRef $args) (Str) |
4019
|
|
|
|
|
|
|
|
4020
|
|
|
|
|
|
|
The render function accepts a string as a template and renders it using |
4021
|
|
|
|
|
|
|
L, and returns the result. |
4022
|
|
|
|
|
|
|
|
4023
|
|
|
|
|
|
|
I> |
4024
|
|
|
|
|
|
|
|
4025
|
|
|
|
|
|
|
=over 4 |
4026
|
|
|
|
|
|
|
|
4027
|
|
|
|
|
|
|
=item render example 1 |
4028
|
|
|
|
|
|
|
|
4029
|
|
|
|
|
|
|
package main; |
4030
|
|
|
|
|
|
|
|
4031
|
|
|
|
|
|
|
use Venus 'render'; |
4032
|
|
|
|
|
|
|
|
4033
|
|
|
|
|
|
|
my $render = render 'hello {{name}}', { |
4034
|
|
|
|
|
|
|
name => 'user', |
4035
|
|
|
|
|
|
|
}; |
4036
|
|
|
|
|
|
|
|
4037
|
|
|
|
|
|
|
# "hello user" |
4038
|
|
|
|
|
|
|
|
4039
|
|
|
|
|
|
|
=back |
4040
|
|
|
|
|
|
|
|
4041
|
|
|
|
|
|
|
=cut |
4042
|
|
|
|
|
|
|
|
4043
|
|
|
|
|
|
|
=head2 replace |
4044
|
|
|
|
|
|
|
|
4045
|
|
|
|
|
|
|
replace(ArrayRef $value, Str | CodeRef $code, Any @args) (Any) |
4046
|
|
|
|
|
|
|
|
4047
|
|
|
|
|
|
|
The replace function builds and returns a L object, or |
4048
|
|
|
|
|
|
|
dispatches to the coderef or method provided. |
4049
|
|
|
|
|
|
|
|
4050
|
|
|
|
|
|
|
I> |
4051
|
|
|
|
|
|
|
|
4052
|
|
|
|
|
|
|
=over 4 |
4053
|
|
|
|
|
|
|
|
4054
|
|
|
|
|
|
|
=item replace example 1 |
4055
|
|
|
|
|
|
|
|
4056
|
|
|
|
|
|
|
package main; |
4057
|
|
|
|
|
|
|
|
4058
|
|
|
|
|
|
|
use Venus 'replace'; |
4059
|
|
|
|
|
|
|
|
4060
|
|
|
|
|
|
|
my $replace = replace ['hello world', 'world', 'universe']; |
4061
|
|
|
|
|
|
|
|
4062
|
|
|
|
|
|
|
# bless({...}, 'Venus::Replace') |
4063
|
|
|
|
|
|
|
|
4064
|
|
|
|
|
|
|
=back |
4065
|
|
|
|
|
|
|
|
4066
|
|
|
|
|
|
|
=over 4 |
4067
|
|
|
|
|
|
|
|
4068
|
|
|
|
|
|
|
=item replace example 2 |
4069
|
|
|
|
|
|
|
|
4070
|
|
|
|
|
|
|
package main; |
4071
|
|
|
|
|
|
|
|
4072
|
|
|
|
|
|
|
use Venus 'replace'; |
4073
|
|
|
|
|
|
|
|
4074
|
|
|
|
|
|
|
my $replace = replace ['hello world', 'world', 'universe'], 'get'; |
4075
|
|
|
|
|
|
|
|
4076
|
|
|
|
|
|
|
# "hello universe" |
4077
|
|
|
|
|
|
|
|
4078
|
|
|
|
|
|
|
=back |
4079
|
|
|
|
|
|
|
|
4080
|
|
|
|
|
|
|
=cut |
4081
|
|
|
|
|
|
|
|
4082
|
|
|
|
|
|
|
=head2 resolve |
4083
|
|
|
|
|
|
|
|
4084
|
|
|
|
|
|
|
resolve(HashRef $value, Any @args) (Any) |
4085
|
|
|
|
|
|
|
|
4086
|
|
|
|
|
|
|
The resolve function builds and returns an object via L. |
4087
|
|
|
|
|
|
|
|
4088
|
|
|
|
|
|
|
I> |
4089
|
|
|
|
|
|
|
|
4090
|
|
|
|
|
|
|
=over 4 |
4091
|
|
|
|
|
|
|
|
4092
|
|
|
|
|
|
|
=item resolve example 1 |
4093
|
|
|
|
|
|
|
|
4094
|
|
|
|
|
|
|
package main; |
4095
|
|
|
|
|
|
|
|
4096
|
|
|
|
|
|
|
use Venus 'resolve'; |
4097
|
|
|
|
|
|
|
|
4098
|
|
|
|
|
|
|
my $resolve = resolve {}; |
4099
|
|
|
|
|
|
|
|
4100
|
|
|
|
|
|
|
# undef |
4101
|
|
|
|
|
|
|
|
4102
|
|
|
|
|
|
|
=back |
4103
|
|
|
|
|
|
|
|
4104
|
|
|
|
|
|
|
=over 4 |
4105
|
|
|
|
|
|
|
|
4106
|
|
|
|
|
|
|
=item resolve example 2 |
4107
|
|
|
|
|
|
|
|
4108
|
|
|
|
|
|
|
package main; |
4109
|
|
|
|
|
|
|
|
4110
|
|
|
|
|
|
|
use Venus 'resolve'; |
4111
|
|
|
|
|
|
|
|
4112
|
|
|
|
|
|
|
my $data = { |
4113
|
|
|
|
|
|
|
'$services' => { |
4114
|
|
|
|
|
|
|
log => { |
4115
|
|
|
|
|
|
|
package => "Venus/Path", |
4116
|
|
|
|
|
|
|
} |
4117
|
|
|
|
|
|
|
} |
4118
|
|
|
|
|
|
|
}; |
4119
|
|
|
|
|
|
|
|
4120
|
|
|
|
|
|
|
my $log = resolve $data, 'log'; |
4121
|
|
|
|
|
|
|
|
4122
|
|
|
|
|
|
|
# bless({...}, 'Venus::Path') |
4123
|
|
|
|
|
|
|
|
4124
|
|
|
|
|
|
|
=back |
4125
|
|
|
|
|
|
|
|
4126
|
|
|
|
|
|
|
=cut |
4127
|
|
|
|
|
|
|
|
4128
|
|
|
|
|
|
|
=head2 roll |
4129
|
|
|
|
|
|
|
|
4130
|
|
|
|
|
|
|
roll(Str $name, Any @args) (Any) |
4131
|
|
|
|
|
|
|
|
4132
|
|
|
|
|
|
|
The roll function takes a list of arguments, assuming the first argument is |
4133
|
|
|
|
|
|
|
invokable, and reorders the list such that the routine name provided comes |
4134
|
|
|
|
|
|
|
after the invocant (i.e. the 1st argument), creating a list acceptable to the |
4135
|
|
|
|
|
|
|
L function. |
4136
|
|
|
|
|
|
|
|
4137
|
|
|
|
|
|
|
I> |
4138
|
|
|
|
|
|
|
|
4139
|
|
|
|
|
|
|
=over 4 |
4140
|
|
|
|
|
|
|
|
4141
|
|
|
|
|
|
|
=item roll example 1 |
4142
|
|
|
|
|
|
|
|
4143
|
|
|
|
|
|
|
package main; |
4144
|
|
|
|
|
|
|
|
4145
|
|
|
|
|
|
|
use Venus 'roll'; |
4146
|
|
|
|
|
|
|
|
4147
|
|
|
|
|
|
|
my @list = roll('sha1_hex', 'Digest::SHA'); |
4148
|
|
|
|
|
|
|
|
4149
|
|
|
|
|
|
|
# ('Digest::SHA', 'sha1_hex'); |
4150
|
|
|
|
|
|
|
|
4151
|
|
|
|
|
|
|
=back |
4152
|
|
|
|
|
|
|
|
4153
|
|
|
|
|
|
|
=over 4 |
4154
|
|
|
|
|
|
|
|
4155
|
|
|
|
|
|
|
=item roll example 2 |
4156
|
|
|
|
|
|
|
|
4157
|
|
|
|
|
|
|
package main; |
4158
|
|
|
|
|
|
|
|
4159
|
|
|
|
|
|
|
use Venus 'roll'; |
4160
|
|
|
|
|
|
|
|
4161
|
|
|
|
|
|
|
my @list = roll('sha1_hex', call(\'Digest::SHA', 'new')); |
4162
|
|
|
|
|
|
|
|
4163
|
|
|
|
|
|
|
# (bless(do{\(my $o = '...')}, 'Digest::SHA'), 'sha1_hex'); |
4164
|
|
|
|
|
|
|
|
4165
|
|
|
|
|
|
|
=back |
4166
|
|
|
|
|
|
|
|
4167
|
|
|
|
|
|
|
=cut |
4168
|
|
|
|
|
|
|
|
4169
|
|
|
|
|
|
|
=head2 schema |
4170
|
|
|
|
|
|
|
|
4171
|
|
|
|
|
|
|
schema(Str $value, Str | CodeRef $code, Any @args) (Any) |
4172
|
|
|
|
|
|
|
|
4173
|
|
|
|
|
|
|
The schema function builds and returns a L object, or dispatches |
4174
|
|
|
|
|
|
|
to the coderef or method provided. |
4175
|
|
|
|
|
|
|
|
4176
|
|
|
|
|
|
|
I> |
4177
|
|
|
|
|
|
|
|
4178
|
|
|
|
|
|
|
=over 4 |
4179
|
|
|
|
|
|
|
|
4180
|
|
|
|
|
|
|
=item schema example 1 |
4181
|
|
|
|
|
|
|
|
4182
|
|
|
|
|
|
|
package main; |
4183
|
|
|
|
|
|
|
|
4184
|
|
|
|
|
|
|
use Venus 'schema'; |
4185
|
|
|
|
|
|
|
|
4186
|
|
|
|
|
|
|
my $schema = schema { name => 'string' }; |
4187
|
|
|
|
|
|
|
|
4188
|
|
|
|
|
|
|
# bless({...}, "Venus::Schema") |
4189
|
|
|
|
|
|
|
|
4190
|
|
|
|
|
|
|
=back |
4191
|
|
|
|
|
|
|
|
4192
|
|
|
|
|
|
|
=over 4 |
4193
|
|
|
|
|
|
|
|
4194
|
|
|
|
|
|
|
=item schema example 2 |
4195
|
|
|
|
|
|
|
|
4196
|
|
|
|
|
|
|
package main; |
4197
|
|
|
|
|
|
|
|
4198
|
|
|
|
|
|
|
use Venus 'schema'; |
4199
|
|
|
|
|
|
|
|
4200
|
|
|
|
|
|
|
my $result = schema { name => 'string' }, 'validate', { name => 'example' }; |
4201
|
|
|
|
|
|
|
|
4202
|
|
|
|
|
|
|
# { name => 'example' } |
4203
|
|
|
|
|
|
|
|
4204
|
|
|
|
|
|
|
=back |
4205
|
|
|
|
|
|
|
|
4206
|
|
|
|
|
|
|
=cut |
4207
|
|
|
|
|
|
|
|
4208
|
|
|
|
|
|
|
=head2 search |
4209
|
|
|
|
|
|
|
|
4210
|
|
|
|
|
|
|
search(ArrayRef $value, Str | CodeRef $code, Any @args) (Any) |
4211
|
|
|
|
|
|
|
|
4212
|
|
|
|
|
|
|
The search function builds and returns a L object, or dispatches |
4213
|
|
|
|
|
|
|
to the coderef or method provided. |
4214
|
|
|
|
|
|
|
|
4215
|
|
|
|
|
|
|
I> |
4216
|
|
|
|
|
|
|
|
4217
|
|
|
|
|
|
|
=over 4 |
4218
|
|
|
|
|
|
|
|
4219
|
|
|
|
|
|
|
=item search example 1 |
4220
|
|
|
|
|
|
|
|
4221
|
|
|
|
|
|
|
package main; |
4222
|
|
|
|
|
|
|
|
4223
|
|
|
|
|
|
|
use Venus 'search'; |
4224
|
|
|
|
|
|
|
|
4225
|
|
|
|
|
|
|
my $search = search ['hello world', 'world']; |
4226
|
|
|
|
|
|
|
|
4227
|
|
|
|
|
|
|
# bless({...}, 'Venus::Search') |
4228
|
|
|
|
|
|
|
|
4229
|
|
|
|
|
|
|
=back |
4230
|
|
|
|
|
|
|
|
4231
|
|
|
|
|
|
|
=over 4 |
4232
|
|
|
|
|
|
|
|
4233
|
|
|
|
|
|
|
=item search example 2 |
4234
|
|
|
|
|
|
|
|
4235
|
|
|
|
|
|
|
package main; |
4236
|
|
|
|
|
|
|
|
4237
|
|
|
|
|
|
|
use Venus 'search'; |
4238
|
|
|
|
|
|
|
|
4239
|
|
|
|
|
|
|
my $search = search ['hello world', 'world'], 'count'; |
4240
|
|
|
|
|
|
|
|
4241
|
|
|
|
|
|
|
# 1 |
4242
|
|
|
|
|
|
|
|
4243
|
|
|
|
|
|
|
=back |
4244
|
|
|
|
|
|
|
|
4245
|
|
|
|
|
|
|
=cut |
4246
|
|
|
|
|
|
|
|
4247
|
|
|
|
|
|
|
=head2 space |
4248
|
|
|
|
|
|
|
|
4249
|
|
|
|
|
|
|
space(Any $name) (Space) |
4250
|
|
|
|
|
|
|
|
4251
|
|
|
|
|
|
|
The space function returns a L object for the package provided. |
4252
|
|
|
|
|
|
|
|
4253
|
|
|
|
|
|
|
I> |
4254
|
|
|
|
|
|
|
|
4255
|
|
|
|
|
|
|
=over 4 |
4256
|
|
|
|
|
|
|
|
4257
|
|
|
|
|
|
|
=item space example 1 |
4258
|
|
|
|
|
|
|
|
4259
|
|
|
|
|
|
|
package main; |
4260
|
|
|
|
|
|
|
|
4261
|
|
|
|
|
|
|
use Venus 'space'; |
4262
|
|
|
|
|
|
|
|
4263
|
|
|
|
|
|
|
my $space = space 'Venus::Scalar'; |
4264
|
|
|
|
|
|
|
|
4265
|
|
|
|
|
|
|
# bless({value => 'Venus::Scalar'}, 'Venus::Space') |
4266
|
|
|
|
|
|
|
|
4267
|
|
|
|
|
|
|
=back |
4268
|
|
|
|
|
|
|
|
4269
|
|
|
|
|
|
|
=cut |
4270
|
|
|
|
|
|
|
|
4271
|
|
|
|
|
|
|
=head2 string |
4272
|
|
|
|
|
|
|
|
4273
|
|
|
|
|
|
|
string(Str $value, Str | CodeRef $code, Any @args) (Any) |
4274
|
|
|
|
|
|
|
|
4275
|
|
|
|
|
|
|
The string function builds and returns a L object, or dispatches |
4276
|
|
|
|
|
|
|
to the coderef or method provided. |
4277
|
|
|
|
|
|
|
|
4278
|
|
|
|
|
|
|
I> |
4279
|
|
|
|
|
|
|
|
4280
|
|
|
|
|
|
|
=over 4 |
4281
|
|
|
|
|
|
|
|
4282
|
|
|
|
|
|
|
=item string example 1 |
4283
|
|
|
|
|
|
|
|
4284
|
|
|
|
|
|
|
package main; |
4285
|
|
|
|
|
|
|
|
4286
|
|
|
|
|
|
|
use Venus 'string'; |
4287
|
|
|
|
|
|
|
|
4288
|
|
|
|
|
|
|
my $string = string 'hello world'; |
4289
|
|
|
|
|
|
|
|
4290
|
|
|
|
|
|
|
# bless({...}, 'Venus::String') |
4291
|
|
|
|
|
|
|
|
4292
|
|
|
|
|
|
|
=back |
4293
|
|
|
|
|
|
|
|
4294
|
|
|
|
|
|
|
=over 4 |
4295
|
|
|
|
|
|
|
|
4296
|
|
|
|
|
|
|
=item string example 2 |
4297
|
|
|
|
|
|
|
|
4298
|
|
|
|
|
|
|
package main; |
4299
|
|
|
|
|
|
|
|
4300
|
|
|
|
|
|
|
use Venus 'string'; |
4301
|
|
|
|
|
|
|
|
4302
|
|
|
|
|
|
|
my $string = string 'hello world', 'camelcase'; |
4303
|
|
|
|
|
|
|
|
4304
|
|
|
|
|
|
|
# "helloWorld" |
4305
|
|
|
|
|
|
|
|
4306
|
|
|
|
|
|
|
=back |
4307
|
|
|
|
|
|
|
|
4308
|
|
|
|
|
|
|
=cut |
4309
|
|
|
|
|
|
|
|
4310
|
|
|
|
|
|
|
=head2 syscall |
4311
|
|
|
|
|
|
|
|
4312
|
|
|
|
|
|
|
syscall(Int | Str @args) (Any) |
4313
|
|
|
|
|
|
|
|
4314
|
|
|
|
|
|
|
The syscall function perlforms system call, i.e. a L operation, |
4315
|
|
|
|
|
|
|
and returns C if the command succeeds, otherwise returns C. In |
4316
|
|
|
|
|
|
|
list context, returns the output of the operation and the exit code. |
4317
|
|
|
|
|
|
|
|
4318
|
|
|
|
|
|
|
I> |
4319
|
|
|
|
|
|
|
|
4320
|
|
|
|
|
|
|
=over 4 |
4321
|
|
|
|
|
|
|
|
4322
|
|
|
|
|
|
|
=item syscall example 1 |
4323
|
|
|
|
|
|
|
|
4324
|
|
|
|
|
|
|
package main; |
4325
|
|
|
|
|
|
|
|
4326
|
|
|
|
|
|
|
use Venus 'syscall'; |
4327
|
|
|
|
|
|
|
|
4328
|
|
|
|
|
|
|
my $syscall = syscall 'perl', '-v'; |
4329
|
|
|
|
|
|
|
|
4330
|
|
|
|
|
|
|
# true |
4331
|
|
|
|
|
|
|
|
4332
|
|
|
|
|
|
|
=back |
4333
|
|
|
|
|
|
|
|
4334
|
|
|
|
|
|
|
=over 4 |
4335
|
|
|
|
|
|
|
|
4336
|
|
|
|
|
|
|
=item syscall example 2 |
4337
|
|
|
|
|
|
|
|
4338
|
|
|
|
|
|
|
package main; |
4339
|
|
|
|
|
|
|
|
4340
|
|
|
|
|
|
|
use Venus 'syscall'; |
4341
|
|
|
|
|
|
|
|
4342
|
|
|
|
|
|
|
my $syscall = syscall 'perl', '-z'; |
4343
|
|
|
|
|
|
|
|
4344
|
|
|
|
|
|
|
# false |
4345
|
|
|
|
|
|
|
|
4346
|
|
|
|
|
|
|
=back |
4347
|
|
|
|
|
|
|
|
4348
|
|
|
|
|
|
|
=over 4 |
4349
|
|
|
|
|
|
|
|
4350
|
|
|
|
|
|
|
=item syscall example 3 |
4351
|
|
|
|
|
|
|
|
4352
|
|
|
|
|
|
|
package main; |
4353
|
|
|
|
|
|
|
|
4354
|
|
|
|
|
|
|
use Venus 'syscall'; |
4355
|
|
|
|
|
|
|
|
4356
|
|
|
|
|
|
|
my ($data, $code) = syscall 'sun', '--heat-death'; |
4357
|
|
|
|
|
|
|
|
4358
|
|
|
|
|
|
|
# ('done', 0) |
4359
|
|
|
|
|
|
|
|
4360
|
|
|
|
|
|
|
=back |
4361
|
|
|
|
|
|
|
|
4362
|
|
|
|
|
|
|
=over 4 |
4363
|
|
|
|
|
|
|
|
4364
|
|
|
|
|
|
|
=item syscall example 4 |
4365
|
|
|
|
|
|
|
|
4366
|
|
|
|
|
|
|
package main; |
4367
|
|
|
|
|
|
|
|
4368
|
|
|
|
|
|
|
use Venus 'syscall'; |
4369
|
|
|
|
|
|
|
|
4370
|
|
|
|
|
|
|
my ($data, $code) = syscall 'earth', '--melt-icecaps'; |
4371
|
|
|
|
|
|
|
|
4372
|
|
|
|
|
|
|
# ('', 127) |
4373
|
|
|
|
|
|
|
|
4374
|
|
|
|
|
|
|
=back |
4375
|
|
|
|
|
|
|
|
4376
|
|
|
|
|
|
|
=cut |
4377
|
|
|
|
|
|
|
|
4378
|
|
|
|
|
|
|
=head2 template |
4379
|
|
|
|
|
|
|
|
4380
|
|
|
|
|
|
|
template(Str $value, Str | CodeRef $code, Any @args) (Any) |
4381
|
|
|
|
|
|
|
|
4382
|
|
|
|
|
|
|
The template function builds and returns a L object, or |
4383
|
|
|
|
|
|
|
dispatches to the coderef or method provided. |
4384
|
|
|
|
|
|
|
|
4385
|
|
|
|
|
|
|
I> |
4386
|
|
|
|
|
|
|
|
4387
|
|
|
|
|
|
|
=over 4 |
4388
|
|
|
|
|
|
|
|
4389
|
|
|
|
|
|
|
=item template example 1 |
4390
|
|
|
|
|
|
|
|
4391
|
|
|
|
|
|
|
package main; |
4392
|
|
|
|
|
|
|
|
4393
|
|
|
|
|
|
|
use Venus 'template'; |
4394
|
|
|
|
|
|
|
|
4395
|
|
|
|
|
|
|
my $template = template 'Hi {{name}}'; |
4396
|
|
|
|
|
|
|
|
4397
|
|
|
|
|
|
|
# bless({...}, 'Venus::Template') |
4398
|
|
|
|
|
|
|
|
4399
|
|
|
|
|
|
|
=back |
4400
|
|
|
|
|
|
|
|
4401
|
|
|
|
|
|
|
=over 4 |
4402
|
|
|
|
|
|
|
|
4403
|
|
|
|
|
|
|
=item template example 2 |
4404
|
|
|
|
|
|
|
|
4405
|
|
|
|
|
|
|
package main; |
4406
|
|
|
|
|
|
|
|
4407
|
|
|
|
|
|
|
use Venus 'template'; |
4408
|
|
|
|
|
|
|
|
4409
|
|
|
|
|
|
|
my $template = template 'Hi {{name}}', 'render', undef, { |
4410
|
|
|
|
|
|
|
name => 'stranger', |
4411
|
|
|
|
|
|
|
}; |
4412
|
|
|
|
|
|
|
|
4413
|
|
|
|
|
|
|
# "Hi stranger" |
4414
|
|
|
|
|
|
|
|
4415
|
|
|
|
|
|
|
=back |
4416
|
|
|
|
|
|
|
|
4417
|
|
|
|
|
|
|
=cut |
4418
|
|
|
|
|
|
|
|
4419
|
|
|
|
|
|
|
=head2 test |
4420
|
|
|
|
|
|
|
|
4421
|
|
|
|
|
|
|
test(Str $value, Str | CodeRef $code, Any @args) (Any) |
4422
|
|
|
|
|
|
|
|
4423
|
|
|
|
|
|
|
The test function builds and returns a L object, or dispatches to |
4424
|
|
|
|
|
|
|
the coderef or method provided. |
4425
|
|
|
|
|
|
|
|
4426
|
|
|
|
|
|
|
I> |
4427
|
|
|
|
|
|
|
|
4428
|
|
|
|
|
|
|
=over 4 |
4429
|
|
|
|
|
|
|
|
4430
|
|
|
|
|
|
|
=item test example 1 |
4431
|
|
|
|
|
|
|
|
4432
|
|
|
|
|
|
|
package main; |
4433
|
|
|
|
|
|
|
|
4434
|
|
|
|
|
|
|
use Venus 'test'; |
4435
|
|
|
|
|
|
|
|
4436
|
|
|
|
|
|
|
my $test = test 't/Venus.t'; |
4437
|
|
|
|
|
|
|
|
4438
|
|
|
|
|
|
|
# bless({...}, 'Venus::Test') |
4439
|
|
|
|
|
|
|
|
4440
|
|
|
|
|
|
|
=back |
4441
|
|
|
|
|
|
|
|
4442
|
|
|
|
|
|
|
=over 4 |
4443
|
|
|
|
|
|
|
|
4444
|
|
|
|
|
|
|
=item test example 2 |
4445
|
|
|
|
|
|
|
|
4446
|
|
|
|
|
|
|
package main; |
4447
|
|
|
|
|
|
|
|
4448
|
|
|
|
|
|
|
use Venus 'test'; |
4449
|
|
|
|
|
|
|
|
4450
|
|
|
|
|
|
|
my $test = test 't/Venus.t', 'for', 'synopsis'; |
4451
|
|
|
|
|
|
|
|
4452
|
|
|
|
|
|
|
# bless({...}, 'Venus::Test') |
4453
|
|
|
|
|
|
|
|
4454
|
|
|
|
|
|
|
=back |
4455
|
|
|
|
|
|
|
|
4456
|
|
|
|
|
|
|
=cut |
4457
|
|
|
|
|
|
|
|
4458
|
|
|
|
|
|
|
=head2 text |
4459
|
|
|
|
|
|
|
|
4460
|
|
|
|
|
|
|
text(Any @args) (Any) |
4461
|
|
|
|
|
|
|
|
4462
|
|
|
|
|
|
|
The text function builds a L object using L for |
4463
|
|
|
|
|
|
|
the current file, i.e. L or script, i.e. C<$0>, and returns |
4464
|
|
|
|
|
|
|
the result of a L operation using the arguments provided. |
4465
|
|
|
|
|
|
|
|
4466
|
|
|
|
|
|
|
I> |
4467
|
|
|
|
|
|
|
|
4468
|
|
|
|
|
|
|
=over 4 |
4469
|
|
|
|
|
|
|
|
4470
|
|
|
|
|
|
|
=item text example 1 |
4471
|
|
|
|
|
|
|
|
4472
|
|
|
|
|
|
|
package main; |
4473
|
|
|
|
|
|
|
|
4474
|
|
|
|
|
|
|
use Venus 'text'; |
4475
|
|
|
|
|
|
|
|
4476
|
|
|
|
|
|
|
# @@ name |
4477
|
|
|
|
|
|
|
# |
4478
|
|
|
|
|
|
|
# Example Name |
4479
|
|
|
|
|
|
|
# |
4480
|
|
|
|
|
|
|
# @@ end |
4481
|
|
|
|
|
|
|
# |
4482
|
|
|
|
|
|
|
# @@ titles #1 |
4483
|
|
|
|
|
|
|
# |
4484
|
|
|
|
|
|
|
# Example Title #1 |
4485
|
|
|
|
|
|
|
# |
4486
|
|
|
|
|
|
|
# @@ end |
4487
|
|
|
|
|
|
|
# |
4488
|
|
|
|
|
|
|
# @@ titles #2 |
4489
|
|
|
|
|
|
|
# |
4490
|
|
|
|
|
|
|
# Example Title #2 |
4491
|
|
|
|
|
|
|
# |
4492
|
|
|
|
|
|
|
# @@ end |
4493
|
|
|
|
|
|
|
|
4494
|
|
|
|
|
|
|
my $text = text 'name'; |
4495
|
|
|
|
|
|
|
|
4496
|
|
|
|
|
|
|
# "Example Name" |
4497
|
|
|
|
|
|
|
|
4498
|
|
|
|
|
|
|
=back |
4499
|
|
|
|
|
|
|
|
4500
|
|
|
|
|
|
|
=over 4 |
4501
|
|
|
|
|
|
|
|
4502
|
|
|
|
|
|
|
=item text example 2 |
4503
|
|
|
|
|
|
|
|
4504
|
|
|
|
|
|
|
package main; |
4505
|
|
|
|
|
|
|
|
4506
|
|
|
|
|
|
|
use Venus 'text'; |
4507
|
|
|
|
|
|
|
|
4508
|
|
|
|
|
|
|
# @@ name |
4509
|
|
|
|
|
|
|
# |
4510
|
|
|
|
|
|
|
# Example Name |
4511
|
|
|
|
|
|
|
# |
4512
|
|
|
|
|
|
|
# @@ end |
4513
|
|
|
|
|
|
|
# |
4514
|
|
|
|
|
|
|
# @@ titles #1 |
4515
|
|
|
|
|
|
|
# |
4516
|
|
|
|
|
|
|
# Example Title #1 |
4517
|
|
|
|
|
|
|
# |
4518
|
|
|
|
|
|
|
# @@ end |
4519
|
|
|
|
|
|
|
# |
4520
|
|
|
|
|
|
|
# @@ titles #2 |
4521
|
|
|
|
|
|
|
# |
4522
|
|
|
|
|
|
|
# Example Title #2 |
4523
|
|
|
|
|
|
|
# |
4524
|
|
|
|
|
|
|
# @@ end |
4525
|
|
|
|
|
|
|
|
4526
|
|
|
|
|
|
|
my $text = text 'titles', '#1'; |
4527
|
|
|
|
|
|
|
|
4528
|
|
|
|
|
|
|
# "Example Title #1" |
4529
|
|
|
|
|
|
|
|
4530
|
|
|
|
|
|
|
=back |
4531
|
|
|
|
|
|
|
|
4532
|
|
|
|
|
|
|
=over 4 |
4533
|
|
|
|
|
|
|
|
4534
|
|
|
|
|
|
|
=item text example 3 |
4535
|
|
|
|
|
|
|
|
4536
|
|
|
|
|
|
|
package main; |
4537
|
|
|
|
|
|
|
|
4538
|
|
|
|
|
|
|
use Venus 'text'; |
4539
|
|
|
|
|
|
|
|
4540
|
|
|
|
|
|
|
# @@ name |
4541
|
|
|
|
|
|
|
# |
4542
|
|
|
|
|
|
|
# Example Name |
4543
|
|
|
|
|
|
|
# |
4544
|
|
|
|
|
|
|
# @@ end |
4545
|
|
|
|
|
|
|
# |
4546
|
|
|
|
|
|
|
# @@ titles #1 |
4547
|
|
|
|
|
|
|
# |
4548
|
|
|
|
|
|
|
# Example Title #1 |
4549
|
|
|
|
|
|
|
# |
4550
|
|
|
|
|
|
|
# @@ end |
4551
|
|
|
|
|
|
|
# |
4552
|
|
|
|
|
|
|
# @@ titles #2 |
4553
|
|
|
|
|
|
|
# |
4554
|
|
|
|
|
|
|
# Example Title #2 |
4555
|
|
|
|
|
|
|
# |
4556
|
|
|
|
|
|
|
# @@ end |
4557
|
|
|
|
|
|
|
|
4558
|
|
|
|
|
|
|
my $text = text undef, 'name'; |
4559
|
|
|
|
|
|
|
|
4560
|
|
|
|
|
|
|
# "Example Name" |
4561
|
|
|
|
|
|
|
|
4562
|
|
|
|
|
|
|
=back |
4563
|
|
|
|
|
|
|
|
4564
|
|
|
|
|
|
|
=cut |
4565
|
|
|
|
|
|
|
|
4566
|
|
|
|
|
|
|
=head2 then |
4567
|
|
|
|
|
|
|
|
4568
|
|
|
|
|
|
|
then(Str | Object | CodeRef $self, Any @args) (Any) |
4569
|
|
|
|
|
|
|
|
4570
|
|
|
|
|
|
|
The then function proxies the call request to the L function and returns |
4571
|
|
|
|
|
|
|
the result as a list, prepended with the invocant. |
4572
|
|
|
|
|
|
|
|
4573
|
|
|
|
|
|
|
I> |
4574
|
|
|
|
|
|
|
|
4575
|
|
|
|
|
|
|
=over 4 |
4576
|
|
|
|
|
|
|
|
4577
|
|
|
|
|
|
|
=item then example 1 |
4578
|
|
|
|
|
|
|
|
4579
|
|
|
|
|
|
|
package main; |
4580
|
|
|
|
|
|
|
|
4581
|
|
|
|
|
|
|
use Venus 'then'; |
4582
|
|
|
|
|
|
|
|
4583
|
|
|
|
|
|
|
my @list = then('Digest::SHA', 'sha1_hex'); |
4584
|
|
|
|
|
|
|
|
4585
|
|
|
|
|
|
|
# ("Digest::SHA", "da39a3ee5e6b4b0d3255bfef95601890afd80709") |
4586
|
|
|
|
|
|
|
|
4587
|
|
|
|
|
|
|
=back |
4588
|
|
|
|
|
|
|
|
4589
|
|
|
|
|
|
|
=cut |
4590
|
|
|
|
|
|
|
|
4591
|
|
|
|
|
|
|
=head2 throw |
4592
|
|
|
|
|
|
|
|
4593
|
|
|
|
|
|
|
throw(Str | HashRef $value, Str | CodeRef $code, Any @args) (Any) |
4594
|
|
|
|
|
|
|
|
4595
|
|
|
|
|
|
|
The throw function builds and returns a L object, or dispatches |
4596
|
|
|
|
|
|
|
to the coderef or method provided. |
4597
|
|
|
|
|
|
|
|
4598
|
|
|
|
|
|
|
I> |
4599
|
|
|
|
|
|
|
|
4600
|
|
|
|
|
|
|
=over 4 |
4601
|
|
|
|
|
|
|
|
4602
|
|
|
|
|
|
|
=item throw example 1 |
4603
|
|
|
|
|
|
|
|
4604
|
|
|
|
|
|
|
package main; |
4605
|
|
|
|
|
|
|
|
4606
|
|
|
|
|
|
|
use Venus 'throw'; |
4607
|
|
|
|
|
|
|
|
4608
|
|
|
|
|
|
|
my $throw = throw 'Example::Error'; |
4609
|
|
|
|
|
|
|
|
4610
|
|
|
|
|
|
|
# bless({...}, 'Venus::Throw') |
4611
|
|
|
|
|
|
|
|
4612
|
|
|
|
|
|
|
=back |
4613
|
|
|
|
|
|
|
|
4614
|
|
|
|
|
|
|
=over 4 |
4615
|
|
|
|
|
|
|
|
4616
|
|
|
|
|
|
|
=item throw example 2 |
4617
|
|
|
|
|
|
|
|
4618
|
|
|
|
|
|
|
package main; |
4619
|
|
|
|
|
|
|
|
4620
|
|
|
|
|
|
|
use Venus 'throw'; |
4621
|
|
|
|
|
|
|
|
4622
|
|
|
|
|
|
|
my $throw = throw 'Example::Error', 'catch', 'error'; |
4623
|
|
|
|
|
|
|
|
4624
|
|
|
|
|
|
|
# bless({...}, 'Example::Error') |
4625
|
|
|
|
|
|
|
|
4626
|
|
|
|
|
|
|
=back |
4627
|
|
|
|
|
|
|
|
4628
|
|
|
|
|
|
|
=over 4 |
4629
|
|
|
|
|
|
|
|
4630
|
|
|
|
|
|
|
=item throw example 3 |
4631
|
|
|
|
|
|
|
|
4632
|
|
|
|
|
|
|
package main; |
4633
|
|
|
|
|
|
|
|
4634
|
|
|
|
|
|
|
use Venus 'throw'; |
4635
|
|
|
|
|
|
|
|
4636
|
|
|
|
|
|
|
my $throw = throw { |
4637
|
|
|
|
|
|
|
name => 'on.execute', |
4638
|
|
|
|
|
|
|
package => 'Example::Error', |
4639
|
|
|
|
|
|
|
capture => ['...'], |
4640
|
|
|
|
|
|
|
stash => { |
4641
|
|
|
|
|
|
|
time => time, |
4642
|
|
|
|
|
|
|
}, |
4643
|
|
|
|
|
|
|
}; |
4644
|
|
|
|
|
|
|
|
4645
|
|
|
|
|
|
|
# bless({...}, 'Venus::Throw') |
4646
|
|
|
|
|
|
|
|
4647
|
|
|
|
|
|
|
=back |
4648
|
|
|
|
|
|
|
|
4649
|
|
|
|
|
|
|
=cut |
4650
|
|
|
|
|
|
|
|
4651
|
|
|
|
|
|
|
=head2 true |
4652
|
|
|
|
|
|
|
|
4653
|
|
|
|
|
|
|
true() (Bool) |
4654
|
|
|
|
|
|
|
|
4655
|
|
|
|
|
|
|
The true function returns a truthy boolean value which is designed to be |
4656
|
|
|
|
|
|
|
practically indistinguishable from the conventional numerical C<1> value. |
4657
|
|
|
|
|
|
|
|
4658
|
|
|
|
|
|
|
I> |
4659
|
|
|
|
|
|
|
|
4660
|
|
|
|
|
|
|
=over 4 |
4661
|
|
|
|
|
|
|
|
4662
|
|
|
|
|
|
|
=item true example 1 |
4663
|
|
|
|
|
|
|
|
4664
|
|
|
|
|
|
|
package main; |
4665
|
|
|
|
|
|
|
|
4666
|
|
|
|
|
|
|
use Venus; |
4667
|
|
|
|
|
|
|
|
4668
|
|
|
|
|
|
|
my $true = true; |
4669
|
|
|
|
|
|
|
|
4670
|
|
|
|
|
|
|
# 1 |
4671
|
|
|
|
|
|
|
|
4672
|
|
|
|
|
|
|
=back |
4673
|
|
|
|
|
|
|
|
4674
|
|
|
|
|
|
|
=over 4 |
4675
|
|
|
|
|
|
|
|
4676
|
|
|
|
|
|
|
=item true example 2 |
4677
|
|
|
|
|
|
|
|
4678
|
|
|
|
|
|
|
package main; |
4679
|
|
|
|
|
|
|
|
4680
|
|
|
|
|
|
|
use Venus; |
4681
|
|
|
|
|
|
|
|
4682
|
|
|
|
|
|
|
my $false = !true; |
4683
|
|
|
|
|
|
|
|
4684
|
|
|
|
|
|
|
# 0 |
4685
|
|
|
|
|
|
|
|
4686
|
|
|
|
|
|
|
=back |
4687
|
|
|
|
|
|
|
|
4688
|
|
|
|
|
|
|
=cut |
4689
|
|
|
|
|
|
|
|
4690
|
|
|
|
|
|
|
=head2 try |
4691
|
|
|
|
|
|
|
|
4692
|
|
|
|
|
|
|
try(Any $data, Str | CodeRef $code, Any @args) (Any) |
4693
|
|
|
|
|
|
|
|
4694
|
|
|
|
|
|
|
The try function builds and returns a L object, or dispatches to |
4695
|
|
|
|
|
|
|
the coderef or method provided. |
4696
|
|
|
|
|
|
|
|
4697
|
|
|
|
|
|
|
I> |
4698
|
|
|
|
|
|
|
|
4699
|
|
|
|
|
|
|
=over 4 |
4700
|
|
|
|
|
|
|
|
4701
|
|
|
|
|
|
|
=item try example 1 |
4702
|
|
|
|
|
|
|
|
4703
|
|
|
|
|
|
|
package main; |
4704
|
|
|
|
|
|
|
|
4705
|
|
|
|
|
|
|
use Venus 'try'; |
4706
|
|
|
|
|
|
|
|
4707
|
|
|
|
|
|
|
my $try = try sub {}; |
4708
|
|
|
|
|
|
|
|
4709
|
|
|
|
|
|
|
# bless({...}, 'Venus::Try') |
4710
|
|
|
|
|
|
|
|
4711
|
|
|
|
|
|
|
# my $result = $try->result; |
4712
|
|
|
|
|
|
|
|
4713
|
|
|
|
|
|
|
# () |
4714
|
|
|
|
|
|
|
|
4715
|
|
|
|
|
|
|
=back |
4716
|
|
|
|
|
|
|
|
4717
|
|
|
|
|
|
|
=over 4 |
4718
|
|
|
|
|
|
|
|
4719
|
|
|
|
|
|
|
=item try example 2 |
4720
|
|
|
|
|
|
|
|
4721
|
|
|
|
|
|
|
package main; |
4722
|
|
|
|
|
|
|
|
4723
|
|
|
|
|
|
|
use Venus 'try'; |
4724
|
|
|
|
|
|
|
|
4725
|
|
|
|
|
|
|
my $try = try sub { die }; |
4726
|
|
|
|
|
|
|
|
4727
|
|
|
|
|
|
|
# bless({...}, 'Venus::Try') |
4728
|
|
|
|
|
|
|
|
4729
|
|
|
|
|
|
|
# my $result = $try->result; |
4730
|
|
|
|
|
|
|
|
4731
|
|
|
|
|
|
|
# Exception! (isa Venus::Error) |
4732
|
|
|
|
|
|
|
|
4733
|
|
|
|
|
|
|
=back |
4734
|
|
|
|
|
|
|
|
4735
|
|
|
|
|
|
|
=over 4 |
4736
|
|
|
|
|
|
|
|
4737
|
|
|
|
|
|
|
=item try example 3 |
4738
|
|
|
|
|
|
|
|
4739
|
|
|
|
|
|
|
package main; |
4740
|
|
|
|
|
|
|
|
4741
|
|
|
|
|
|
|
use Venus 'try'; |
4742
|
|
|
|
|
|
|
|
4743
|
|
|
|
|
|
|
my $try = try sub { die }, 'maybe'; |
4744
|
|
|
|
|
|
|
|
4745
|
|
|
|
|
|
|
# bless({...}, 'Venus::Try') |
4746
|
|
|
|
|
|
|
|
4747
|
|
|
|
|
|
|
# my $result = $try->result; |
4748
|
|
|
|
|
|
|
|
4749
|
|
|
|
|
|
|
# undef |
4750
|
|
|
|
|
|
|
|
4751
|
|
|
|
|
|
|
=back |
4752
|
|
|
|
|
|
|
|
4753
|
|
|
|
|
|
|
=cut |
4754
|
|
|
|
|
|
|
|
4755
|
|
|
|
|
|
|
=head2 type |
4756
|
|
|
|
|
|
|
|
4757
|
|
|
|
|
|
|
type(Any $data, Str | CodeRef $code, Any @args) (Any) |
4758
|
|
|
|
|
|
|
|
4759
|
|
|
|
|
|
|
The type function builds and returns a L object, or dispatches to |
4760
|
|
|
|
|
|
|
the coderef or method provided. |
4761
|
|
|
|
|
|
|
|
4762
|
|
|
|
|
|
|
I> |
4763
|
|
|
|
|
|
|
|
4764
|
|
|
|
|
|
|
=over 4 |
4765
|
|
|
|
|
|
|
|
4766
|
|
|
|
|
|
|
=item type example 1 |
4767
|
|
|
|
|
|
|
|
4768
|
|
|
|
|
|
|
package main; |
4769
|
|
|
|
|
|
|
|
4770
|
|
|
|
|
|
|
use Venus 'type'; |
4771
|
|
|
|
|
|
|
|
4772
|
|
|
|
|
|
|
my $type = type [1..4]; |
4773
|
|
|
|
|
|
|
|
4774
|
|
|
|
|
|
|
# bless({...}, 'Venus::Type') |
4775
|
|
|
|
|
|
|
|
4776
|
|
|
|
|
|
|
# $type->deduce; |
4777
|
|
|
|
|
|
|
|
4778
|
|
|
|
|
|
|
# bless({...}, 'Venus::Array') |
4779
|
|
|
|
|
|
|
|
4780
|
|
|
|
|
|
|
=back |
4781
|
|
|
|
|
|
|
|
4782
|
|
|
|
|
|
|
=over 4 |
4783
|
|
|
|
|
|
|
|
4784
|
|
|
|
|
|
|
=item type example 2 |
4785
|
|
|
|
|
|
|
|
4786
|
|
|
|
|
|
|
package main; |
4787
|
|
|
|
|
|
|
|
4788
|
|
|
|
|
|
|
use Venus 'type'; |
4789
|
|
|
|
|
|
|
|
4790
|
|
|
|
|
|
|
my $type = type [1..4], 'deduce'; |
4791
|
|
|
|
|
|
|
|
4792
|
|
|
|
|
|
|
# bless({...}, 'Venus::Array') |
4793
|
|
|
|
|
|
|
|
4794
|
|
|
|
|
|
|
=back |
4795
|
|
|
|
|
|
|
|
4796
|
|
|
|
|
|
|
=cut |
4797
|
|
|
|
|
|
|
|
4798
|
|
|
|
|
|
|
=head2 unpack |
4799
|
|
|
|
|
|
|
|
4800
|
|
|
|
|
|
|
unpack(Any @args) (Unpack) |
4801
|
|
|
|
|
|
|
|
4802
|
|
|
|
|
|
|
The unpack function builds and returns a L object. |
4803
|
|
|
|
|
|
|
|
4804
|
|
|
|
|
|
|
I> |
4805
|
|
|
|
|
|
|
|
4806
|
|
|
|
|
|
|
=over 4 |
4807
|
|
|
|
|
|
|
|
4808
|
|
|
|
|
|
|
=item unpack example 1 |
4809
|
|
|
|
|
|
|
|
4810
|
|
|
|
|
|
|
package main; |
4811
|
|
|
|
|
|
|
|
4812
|
|
|
|
|
|
|
use Venus 'unpack'; |
4813
|
|
|
|
|
|
|
|
4814
|
|
|
|
|
|
|
my $unpack = unpack; |
4815
|
|
|
|
|
|
|
|
4816
|
|
|
|
|
|
|
# bless({...}, 'Venus::Unpack') |
4817
|
|
|
|
|
|
|
|
4818
|
|
|
|
|
|
|
# $unpack->checks('string'); |
4819
|
|
|
|
|
|
|
|
4820
|
|
|
|
|
|
|
# false |
4821
|
|
|
|
|
|
|
|
4822
|
|
|
|
|
|
|
# $unpack->checks('undef'); |
4823
|
|
|
|
|
|
|
|
4824
|
|
|
|
|
|
|
# false |
4825
|
|
|
|
|
|
|
|
4826
|
|
|
|
|
|
|
=back |
4827
|
|
|
|
|
|
|
|
4828
|
|
|
|
|
|
|
=over 4 |
4829
|
|
|
|
|
|
|
|
4830
|
|
|
|
|
|
|
=item unpack example 2 |
4831
|
|
|
|
|
|
|
|
4832
|
|
|
|
|
|
|
package main; |
4833
|
|
|
|
|
|
|
|
4834
|
|
|
|
|
|
|
use Venus 'unpack'; |
4835
|
|
|
|
|
|
|
|
4836
|
|
|
|
|
|
|
my $unpack = unpack rand; |
4837
|
|
|
|
|
|
|
|
4838
|
|
|
|
|
|
|
# bless({...}, 'Venus::Unpack') |
4839
|
|
|
|
|
|
|
|
4840
|
|
|
|
|
|
|
# $unpack->check('number'); |
4841
|
|
|
|
|
|
|
|
4842
|
|
|
|
|
|
|
# false |
4843
|
|
|
|
|
|
|
|
4844
|
|
|
|
|
|
|
# $unpack->check('float'); |
4845
|
|
|
|
|
|
|
|
4846
|
|
|
|
|
|
|
# true |
4847
|
|
|
|
|
|
|
|
4848
|
|
|
|
|
|
|
=back |
4849
|
|
|
|
|
|
|
|
4850
|
|
|
|
|
|
|
=cut |
4851
|
|
|
|
|
|
|
|
4852
|
|
|
|
|
|
|
=head2 vars |
4853
|
|
|
|
|
|
|
|
4854
|
|
|
|
|
|
|
vars(HashRef $value, Str | CodeRef $code, Any @args) (Any) |
4855
|
|
|
|
|
|
|
|
4856
|
|
|
|
|
|
|
The vars function builds and returns a L object, or dispatches to |
4857
|
|
|
|
|
|
|
the coderef or method provided. |
4858
|
|
|
|
|
|
|
|
4859
|
|
|
|
|
|
|
I> |
4860
|
|
|
|
|
|
|
|
4861
|
|
|
|
|
|
|
=over 4 |
4862
|
|
|
|
|
|
|
|
4863
|
|
|
|
|
|
|
=item vars example 1 |
4864
|
|
|
|
|
|
|
|
4865
|
|
|
|
|
|
|
package main; |
4866
|
|
|
|
|
|
|
|
4867
|
|
|
|
|
|
|
use Venus 'vars'; |
4868
|
|
|
|
|
|
|
|
4869
|
|
|
|
|
|
|
my $vars = vars {}; |
4870
|
|
|
|
|
|
|
|
4871
|
|
|
|
|
|
|
# bless({...}, 'Venus::Vars') |
4872
|
|
|
|
|
|
|
|
4873
|
|
|
|
|
|
|
=back |
4874
|
|
|
|
|
|
|
|
4875
|
|
|
|
|
|
|
=over 4 |
4876
|
|
|
|
|
|
|
|
4877
|
|
|
|
|
|
|
=item vars example 2 |
4878
|
|
|
|
|
|
|
|
4879
|
|
|
|
|
|
|
package main; |
4880
|
|
|
|
|
|
|
|
4881
|
|
|
|
|
|
|
use Venus 'vars'; |
4882
|
|
|
|
|
|
|
|
4883
|
|
|
|
|
|
|
my $path = vars {}, 'exists', 'path'; |
4884
|
|
|
|
|
|
|
|
4885
|
|
|
|
|
|
|
# "..." |
4886
|
|
|
|
|
|
|
|
4887
|
|
|
|
|
|
|
=back |
4888
|
|
|
|
|
|
|
|
4889
|
|
|
|
|
|
|
=cut |
4890
|
|
|
|
|
|
|
|
4891
|
|
|
|
|
|
|
=head2 venus |
4892
|
|
|
|
|
|
|
|
4893
|
|
|
|
|
|
|
venus(Str $name, Any @args) (Any) |
4894
|
|
|
|
|
|
|
|
4895
|
|
|
|
|
|
|
The venus function build a L package via the L function based on |
4896
|
|
|
|
|
|
|
the name provided and returns an instance of that package. |
4897
|
|
|
|
|
|
|
|
4898
|
|
|
|
|
|
|
I> |
4899
|
|
|
|
|
|
|
|
4900
|
|
|
|
|
|
|
=over 4 |
4901
|
|
|
|
|
|
|
|
4902
|
|
|
|
|
|
|
=item venus example 1 |
4903
|
|
|
|
|
|
|
|
4904
|
|
|
|
|
|
|
package main; |
4905
|
|
|
|
|
|
|
|
4906
|
|
|
|
|
|
|
use Venus 'venus'; |
4907
|
|
|
|
|
|
|
|
4908
|
|
|
|
|
|
|
my $space = venus 'space'; |
4909
|
|
|
|
|
|
|
|
4910
|
|
|
|
|
|
|
# bless({value => 'Venus'}, 'Venus::Space') |
4911
|
|
|
|
|
|
|
|
4912
|
|
|
|
|
|
|
=back |
4913
|
|
|
|
|
|
|
|
4914
|
|
|
|
|
|
|
=over 4 |
4915
|
|
|
|
|
|
|
|
4916
|
|
|
|
|
|
|
=item venus example 2 |
4917
|
|
|
|
|
|
|
|
4918
|
|
|
|
|
|
|
package main; |
4919
|
|
|
|
|
|
|
|
4920
|
|
|
|
|
|
|
use Venus 'venus'; |
4921
|
|
|
|
|
|
|
|
4922
|
|
|
|
|
|
|
my $space = venus 'space', ['new', 'venus/string']; |
4923
|
|
|
|
|
|
|
|
4924
|
|
|
|
|
|
|
# bless({value => 'Venus::String'}, 'Venus::Space') |
4925
|
|
|
|
|
|
|
|
4926
|
|
|
|
|
|
|
=back |
4927
|
|
|
|
|
|
|
|
4928
|
|
|
|
|
|
|
=over 4 |
4929
|
|
|
|
|
|
|
|
4930
|
|
|
|
|
|
|
=item venus example 3 |
4931
|
|
|
|
|
|
|
|
4932
|
|
|
|
|
|
|
package main; |
4933
|
|
|
|
|
|
|
|
4934
|
|
|
|
|
|
|
use Venus 'venus'; |
4935
|
|
|
|
|
|
|
|
4936
|
|
|
|
|
|
|
my $space = venus 'code'; |
4937
|
|
|
|
|
|
|
|
4938
|
|
|
|
|
|
|
# bless({value => sub{...}}, 'Venus::Code') |
4939
|
|
|
|
|
|
|
|
4940
|
|
|
|
|
|
|
=back |
4941
|
|
|
|
|
|
|
|
4942
|
|
|
|
|
|
|
=cut |
4943
|
|
|
|
|
|
|
|
4944
|
|
|
|
|
|
|
=head2 work |
4945
|
|
|
|
|
|
|
|
4946
|
|
|
|
|
|
|
work(CodeRef $callback) (Process) |
4947
|
|
|
|
|
|
|
|
4948
|
|
|
|
|
|
|
The work function builds a L object, forks the current process |
4949
|
|
|
|
|
|
|
using the callback provided via the L operation, and |
4950
|
|
|
|
|
|
|
returns an instance of L representing the current process. |
4951
|
|
|
|
|
|
|
|
4952
|
|
|
|
|
|
|
I> |
4953
|
|
|
|
|
|
|
|
4954
|
|
|
|
|
|
|
=over 4 |
4955
|
|
|
|
|
|
|
|
4956
|
|
|
|
|
|
|
=item work example 1 |
4957
|
|
|
|
|
|
|
|
4958
|
|
|
|
|
|
|
package main; |
4959
|
|
|
|
|
|
|
|
4960
|
|
|
|
|
|
|
use Venus 'work'; |
4961
|
|
|
|
|
|
|
|
4962
|
|
|
|
|
|
|
my $parent = work sub { |
4963
|
|
|
|
|
|
|
my ($process) = @_; |
4964
|
|
|
|
|
|
|
# in forked process ... |
4965
|
|
|
|
|
|
|
$process->exit; |
4966
|
|
|
|
|
|
|
}; |
4967
|
|
|
|
|
|
|
|
4968
|
|
|
|
|
|
|
# bless({...}, 'Venus::Process') |
4969
|
|
|
|
|
|
|
|
4970
|
|
|
|
|
|
|
=back |
4971
|
|
|
|
|
|
|
|
4972
|
|
|
|
|
|
|
=cut |
4973
|
|
|
|
|
|
|
|
4974
|
|
|
|
|
|
|
=head2 wrap |
4975
|
|
|
|
|
|
|
|
4976
|
|
|
|
|
|
|
wrap(Str $data, Str $name) (CodeRef) |
4977
|
|
|
|
|
|
|
|
4978
|
|
|
|
|
|
|
The wrap function installs a wrapper function in the calling package which when |
4979
|
|
|
|
|
|
|
called either returns the package string if no arguments are provided, or calls |
4980
|
|
|
|
|
|
|
L on the package with whatever arguments are provided and returns the |
4981
|
|
|
|
|
|
|
result. Unless an alias is provided as a second argument, special characters |
4982
|
|
|
|
|
|
|
are stripped from the package to create the function name. |
4983
|
|
|
|
|
|
|
|
4984
|
|
|
|
|
|
|
I> |
4985
|
|
|
|
|
|
|
|
4986
|
|
|
|
|
|
|
=over 4 |
4987
|
|
|
|
|
|
|
|
4988
|
|
|
|
|
|
|
=item wrap example 1 |
4989
|
|
|
|
|
|
|
|
4990
|
|
|
|
|
|
|
package main; |
4991
|
|
|
|
|
|
|
|
4992
|
|
|
|
|
|
|
use Venus 'wrap'; |
4993
|
|
|
|
|
|
|
|
4994
|
|
|
|
|
|
|
my $coderef = wrap('Digest::SHA'); |
4995
|
|
|
|
|
|
|
|
4996
|
|
|
|
|
|
|
# sub { ... } |
4997
|
|
|
|
|
|
|
|
4998
|
|
|
|
|
|
|
# my $digest = DigestSHA(); |
4999
|
|
|
|
|
|
|
|
5000
|
|
|
|
|
|
|
# "Digest::SHA" |
5001
|
|
|
|
|
|
|
|
5002
|
|
|
|
|
|
|
# my $digest = DigestSHA(1); |
5003
|
|
|
|
|
|
|
|
5004
|
|
|
|
|
|
|
# bless(do{\(my $o = '...')}, 'Digest::SHA') |
5005
|
|
|
|
|
|
|
|
5006
|
|
|
|
|
|
|
=back |
5007
|
|
|
|
|
|
|
|
5008
|
|
|
|
|
|
|
=over 4 |
5009
|
|
|
|
|
|
|
|
5010
|
|
|
|
|
|
|
=item wrap example 2 |
5011
|
|
|
|
|
|
|
|
5012
|
|
|
|
|
|
|
package main; |
5013
|
|
|
|
|
|
|
|
5014
|
|
|
|
|
|
|
use Venus 'wrap'; |
5015
|
|
|
|
|
|
|
|
5016
|
|
|
|
|
|
|
my $coderef = wrap('Digest::SHA', 'SHA'); |
5017
|
|
|
|
|
|
|
|
5018
|
|
|
|
|
|
|
# sub { ... } |
5019
|
|
|
|
|
|
|
|
5020
|
|
|
|
|
|
|
# my $digest = SHA(); |
5021
|
|
|
|
|
|
|
|
5022
|
|
|
|
|
|
|
# "Digest::SHA" |
5023
|
|
|
|
|
|
|
|
5024
|
|
|
|
|
|
|
# my $digest = SHA(1); |
5025
|
|
|
|
|
|
|
|
5026
|
|
|
|
|
|
|
# bless(do{\(my $o = '...')}, 'Digest::SHA') |
5027
|
|
|
|
|
|
|
|
5028
|
|
|
|
|
|
|
=back |
5029
|
|
|
|
|
|
|
|
5030
|
|
|
|
|
|
|
=cut |
5031
|
|
|
|
|
|
|
|
5032
|
|
|
|
|
|
|
=head2 yaml |
5033
|
|
|
|
|
|
|
|
5034
|
|
|
|
|
|
|
yaml(Str $call, Any $data) (Any) |
5035
|
|
|
|
|
|
|
|
5036
|
|
|
|
|
|
|
The yaml function builds a L object and will either |
5037
|
|
|
|
|
|
|
L or L based on the argument provided |
5038
|
|
|
|
|
|
|
and returns the result. |
5039
|
|
|
|
|
|
|
|
5040
|
|
|
|
|
|
|
I> |
5041
|
|
|
|
|
|
|
|
5042
|
|
|
|
|
|
|
=over 4 |
5043
|
|
|
|
|
|
|
|
5044
|
|
|
|
|
|
|
=item yaml example 1 |
5045
|
|
|
|
|
|
|
|
5046
|
|
|
|
|
|
|
package main; |
5047
|
|
|
|
|
|
|
|
5048
|
|
|
|
|
|
|
use Venus 'yaml'; |
5049
|
|
|
|
|
|
|
|
5050
|
|
|
|
|
|
|
my $decode = yaml 'decode', "---\nname:\n- Ready\n- Robot\nstable: true\n"; |
5051
|
|
|
|
|
|
|
|
5052
|
|
|
|
|
|
|
# { name => ["Ready", "Robot"], stable => 1 } |
5053
|
|
|
|
|
|
|
|
5054
|
|
|
|
|
|
|
=back |
5055
|
|
|
|
|
|
|
|
5056
|
|
|
|
|
|
|
=over 4 |
5057
|
|
|
|
|
|
|
|
5058
|
|
|
|
|
|
|
=item yaml example 2 |
5059
|
|
|
|
|
|
|
|
5060
|
|
|
|
|
|
|
package main; |
5061
|
|
|
|
|
|
|
|
5062
|
|
|
|
|
|
|
use Venus 'yaml'; |
5063
|
|
|
|
|
|
|
|
5064
|
|
|
|
|
|
|
my $encode = yaml 'encode', { name => ["Ready", "Robot"], stable => true }; |
5065
|
|
|
|
|
|
|
|
5066
|
|
|
|
|
|
|
# '---\nname:\n- Ready\n- Robot\nstable: true\n' |
5067
|
|
|
|
|
|
|
|
5068
|
|
|
|
|
|
|
=back |
5069
|
|
|
|
|
|
|
|
5070
|
|
|
|
|
|
|
=over 4 |
5071
|
|
|
|
|
|
|
|
5072
|
|
|
|
|
|
|
=item yaml example 3 |
5073
|
|
|
|
|
|
|
|
5074
|
|
|
|
|
|
|
package main; |
5075
|
|
|
|
|
|
|
|
5076
|
|
|
|
|
|
|
use Venus 'yaml'; |
5077
|
|
|
|
|
|
|
|
5078
|
|
|
|
|
|
|
my $yaml = yaml; |
5079
|
|
|
|
|
|
|
|
5080
|
|
|
|
|
|
|
# bless({...}, 'Venus::Yaml') |
5081
|
|
|
|
|
|
|
|
5082
|
|
|
|
|
|
|
=back |
5083
|
|
|
|
|
|
|
|
5084
|
|
|
|
|
|
|
=over 4 |
5085
|
|
|
|
|
|
|
|
5086
|
|
|
|
|
|
|
=item yaml example 4 |
5087
|
|
|
|
|
|
|
|
5088
|
|
|
|
|
|
|
package main; |
5089
|
|
|
|
|
|
|
|
5090
|
|
|
|
|
|
|
use Venus 'yaml'; |
5091
|
|
|
|
|
|
|
|
5092
|
|
|
|
|
|
|
my $yaml = yaml 'class', {data => "..."}; |
5093
|
|
|
|
|
|
|
|
5094
|
|
|
|
|
|
|
# Exception! (isa Venus::Fault) |
5095
|
|
|
|
|
|
|
|
5096
|
|
|
|
|
|
|
=back |
5097
|
|
|
|
|
|
|
|
5098
|
|
|
|
|
|
|
=cut |
5099
|
|
|
|
|
|
|
|
5100
|
|
|
|
|
|
|
=head1 FEATURES |
5101
|
|
|
|
|
|
|
|
5102
|
|
|
|
|
|
|
This package provides the following features: |
5103
|
|
|
|
|
|
|
|
5104
|
|
|
|
|
|
|
=cut |
5105
|
|
|
|
|
|
|
|
5106
|
|
|
|
|
|
|
=over 4 |
5107
|
|
|
|
|
|
|
|
5108
|
|
|
|
|
|
|
=item venus-args |
5109
|
|
|
|
|
|
|
|
5110
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5111
|
|
|
|
|
|
|
accessing C<@ARGS> items. |
5112
|
|
|
|
|
|
|
|
5113
|
|
|
|
|
|
|
=back |
5114
|
|
|
|
|
|
|
|
5115
|
|
|
|
|
|
|
=over 4 |
5116
|
|
|
|
|
|
|
|
5117
|
|
|
|
|
|
|
=item venus-array |
5118
|
|
|
|
|
|
|
|
5119
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5120
|
|
|
|
|
|
|
manipulating array data. |
5121
|
|
|
|
|
|
|
|
5122
|
|
|
|
|
|
|
=back |
5123
|
|
|
|
|
|
|
|
5124
|
|
|
|
|
|
|
=over 4 |
5125
|
|
|
|
|
|
|
|
5126
|
|
|
|
|
|
|
=item venus-assert |
5127
|
|
|
|
|
|
|
|
5128
|
|
|
|
|
|
|
This library contains a L class which provides a mechanism for |
5129
|
|
|
|
|
|
|
asserting type constraints and coercion. |
5130
|
|
|
|
|
|
|
|
5131
|
|
|
|
|
|
|
=back |
5132
|
|
|
|
|
|
|
|
5133
|
|
|
|
|
|
|
=over 4 |
5134
|
|
|
|
|
|
|
|
5135
|
|
|
|
|
|
|
=item venus-boolean |
5136
|
|
|
|
|
|
|
|
5137
|
|
|
|
|
|
|
This library contains a L class which provides a representation |
5138
|
|
|
|
|
|
|
for boolean values. |
5139
|
|
|
|
|
|
|
|
5140
|
|
|
|
|
|
|
=back |
5141
|
|
|
|
|
|
|
|
5142
|
|
|
|
|
|
|
=over 4 |
5143
|
|
|
|
|
|
|
|
5144
|
|
|
|
|
|
|
=item venus-box |
5145
|
|
|
|
|
|
|
|
5146
|
|
|
|
|
|
|
This library contains a L class which provides a pure Perl boxing |
5147
|
|
|
|
|
|
|
mechanism. |
5148
|
|
|
|
|
|
|
|
5149
|
|
|
|
|
|
|
=back |
5150
|
|
|
|
|
|
|
|
5151
|
|
|
|
|
|
|
=over 4 |
5152
|
|
|
|
|
|
|
|
5153
|
|
|
|
|
|
|
=item venus-class |
5154
|
|
|
|
|
|
|
|
5155
|
|
|
|
|
|
|
This library contains a L class which provides a class builder. |
5156
|
|
|
|
|
|
|
|
5157
|
|
|
|
|
|
|
=back |
5158
|
|
|
|
|
|
|
|
5159
|
|
|
|
|
|
|
=over 4 |
5160
|
|
|
|
|
|
|
|
5161
|
|
|
|
|
|
|
=item venus-cli |
5162
|
|
|
|
|
|
|
|
5163
|
|
|
|
|
|
|
This library contains a L class which provides a superclass for |
5164
|
|
|
|
|
|
|
creating CLIs. |
5165
|
|
|
|
|
|
|
|
5166
|
|
|
|
|
|
|
=back |
5167
|
|
|
|
|
|
|
|
5168
|
|
|
|
|
|
|
=over 4 |
5169
|
|
|
|
|
|
|
|
5170
|
|
|
|
|
|
|
=item venus-code |
5171
|
|
|
|
|
|
|
|
5172
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5173
|
|
|
|
|
|
|
manipulating subroutines. |
5174
|
|
|
|
|
|
|
|
5175
|
|
|
|
|
|
|
=back |
5176
|
|
|
|
|
|
|
|
5177
|
|
|
|
|
|
|
=over 4 |
5178
|
|
|
|
|
|
|
|
5179
|
|
|
|
|
|
|
=item venus-config |
5180
|
|
|
|
|
|
|
|
5181
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5182
|
|
|
|
|
|
|
loading Perl, YAML, and JSON configuration data. |
5183
|
|
|
|
|
|
|
|
5184
|
|
|
|
|
|
|
=back |
5185
|
|
|
|
|
|
|
|
5186
|
|
|
|
|
|
|
=over 4 |
5187
|
|
|
|
|
|
|
|
5188
|
|
|
|
|
|
|
=item venus-data |
5189
|
|
|
|
|
|
|
|
5190
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5191
|
|
|
|
|
|
|
extracting C sections and POD block. |
5192
|
|
|
|
|
|
|
|
5193
|
|
|
|
|
|
|
=back |
5194
|
|
|
|
|
|
|
|
5195
|
|
|
|
|
|
|
=over 4 |
5196
|
|
|
|
|
|
|
|
5197
|
|
|
|
|
|
|
=item venus-date |
5198
|
|
|
|
|
|
|
|
5199
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5200
|
|
|
|
|
|
|
formatting, parsing, and manipulating dates. |
5201
|
|
|
|
|
|
|
|
5202
|
|
|
|
|
|
|
=back |
5203
|
|
|
|
|
|
|
|
5204
|
|
|
|
|
|
|
=over 4 |
5205
|
|
|
|
|
|
|
|
5206
|
|
|
|
|
|
|
=item venus-dump |
5207
|
|
|
|
|
|
|
|
5208
|
|
|
|
|
|
|
This library contains a L class which provides methods for reading |
5209
|
|
|
|
|
|
|
and writing dumped Perl data. |
5210
|
|
|
|
|
|
|
|
5211
|
|
|
|
|
|
|
=back |
5212
|
|
|
|
|
|
|
|
5213
|
|
|
|
|
|
|
=over 4 |
5214
|
|
|
|
|
|
|
|
5215
|
|
|
|
|
|
|
=item venus-error |
5216
|
|
|
|
|
|
|
|
5217
|
|
|
|
|
|
|
This library contains a L class which represents a context-aware |
5218
|
|
|
|
|
|
|
error (exception object). |
5219
|
|
|
|
|
|
|
|
5220
|
|
|
|
|
|
|
=back |
5221
|
|
|
|
|
|
|
|
5222
|
|
|
|
|
|
|
=over 4 |
5223
|
|
|
|
|
|
|
|
5224
|
|
|
|
|
|
|
=item venus-false |
5225
|
|
|
|
|
|
|
|
5226
|
|
|
|
|
|
|
This library contains a L class which provides the global |
5227
|
|
|
|
|
|
|
C value. |
5228
|
|
|
|
|
|
|
|
5229
|
|
|
|
|
|
|
=back |
5230
|
|
|
|
|
|
|
|
5231
|
|
|
|
|
|
|
=over 4 |
5232
|
|
|
|
|
|
|
|
5233
|
|
|
|
|
|
|
=item venus-fault |
5234
|
|
|
|
|
|
|
|
5235
|
|
|
|
|
|
|
This library contains a L class which represents a generic system |
5236
|
|
|
|
|
|
|
error (exception object). |
5237
|
|
|
|
|
|
|
|
5238
|
|
|
|
|
|
|
=back |
5239
|
|
|
|
|
|
|
|
5240
|
|
|
|
|
|
|
=over 4 |
5241
|
|
|
|
|
|
|
|
5242
|
|
|
|
|
|
|
=item venus-float |
5243
|
|
|
|
|
|
|
|
5244
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5245
|
|
|
|
|
|
|
manipulating float data. |
5246
|
|
|
|
|
|
|
|
5247
|
|
|
|
|
|
|
=back |
5248
|
|
|
|
|
|
|
|
5249
|
|
|
|
|
|
|
=over 4 |
5250
|
|
|
|
|
|
|
|
5251
|
|
|
|
|
|
|
=item venus-gather |
5252
|
|
|
|
|
|
|
|
5253
|
|
|
|
|
|
|
This library contains a L class which provides an |
5254
|
|
|
|
|
|
|
object-oriented interface for complex pattern matching operations on |
5255
|
|
|
|
|
|
|
collections of data, e.g. array references. |
5256
|
|
|
|
|
|
|
|
5257
|
|
|
|
|
|
|
=back |
5258
|
|
|
|
|
|
|
|
5259
|
|
|
|
|
|
|
=over 4 |
5260
|
|
|
|
|
|
|
|
5261
|
|
|
|
|
|
|
=item venus-hash |
5262
|
|
|
|
|
|
|
|
5263
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5264
|
|
|
|
|
|
|
manipulating hash data. |
5265
|
|
|
|
|
|
|
|
5266
|
|
|
|
|
|
|
=back |
5267
|
|
|
|
|
|
|
|
5268
|
|
|
|
|
|
|
=over 4 |
5269
|
|
|
|
|
|
|
|
5270
|
|
|
|
|
|
|
=item venus-json |
5271
|
|
|
|
|
|
|
|
5272
|
|
|
|
|
|
|
This library contains a L class which provides methods for reading |
5273
|
|
|
|
|
|
|
and writing JSON data. |
5274
|
|
|
|
|
|
|
|
5275
|
|
|
|
|
|
|
=back |
5276
|
|
|
|
|
|
|
|
5277
|
|
|
|
|
|
|
=over 4 |
5278
|
|
|
|
|
|
|
|
5279
|
|
|
|
|
|
|
=item venus-log |
5280
|
|
|
|
|
|
|
|
5281
|
|
|
|
|
|
|
This library contains a L class which provides methods for logging |
5282
|
|
|
|
|
|
|
information using various log levels. |
5283
|
|
|
|
|
|
|
|
5284
|
|
|
|
|
|
|
=back |
5285
|
|
|
|
|
|
|
|
5286
|
|
|
|
|
|
|
=over 4 |
5287
|
|
|
|
|
|
|
|
5288
|
|
|
|
|
|
|
=item venus-match |
5289
|
|
|
|
|
|
|
|
5290
|
|
|
|
|
|
|
This library contains a L class which provides an object-oriented |
5291
|
|
|
|
|
|
|
interface for complex pattern matching operations on scalar values. |
5292
|
|
|
|
|
|
|
|
5293
|
|
|
|
|
|
|
=back |
5294
|
|
|
|
|
|
|
|
5295
|
|
|
|
|
|
|
=over 4 |
5296
|
|
|
|
|
|
|
|
5297
|
|
|
|
|
|
|
=item venus-meta |
5298
|
|
|
|
|
|
|
|
5299
|
|
|
|
|
|
|
This library contains a L class which provides configuration |
5300
|
|
|
|
|
|
|
information for L derived classes. |
5301
|
|
|
|
|
|
|
|
5302
|
|
|
|
|
|
|
=back |
5303
|
|
|
|
|
|
|
|
5304
|
|
|
|
|
|
|
=over 4 |
5305
|
|
|
|
|
|
|
|
5306
|
|
|
|
|
|
|
=item venus-mixin |
5307
|
|
|
|
|
|
|
|
5308
|
|
|
|
|
|
|
This library contains a L class which provides a mixin builder. |
5309
|
|
|
|
|
|
|
|
5310
|
|
|
|
|
|
|
=back |
5311
|
|
|
|
|
|
|
|
5312
|
|
|
|
|
|
|
=over 4 |
5313
|
|
|
|
|
|
|
|
5314
|
|
|
|
|
|
|
=item venus-name |
5315
|
|
|
|
|
|
|
|
5316
|
|
|
|
|
|
|
This library contains a L class which provides methods for parsing |
5317
|
|
|
|
|
|
|
and formatting package namespaces. |
5318
|
|
|
|
|
|
|
|
5319
|
|
|
|
|
|
|
=back |
5320
|
|
|
|
|
|
|
|
5321
|
|
|
|
|
|
|
=over 4 |
5322
|
|
|
|
|
|
|
|
5323
|
|
|
|
|
|
|
=item venus-number |
5324
|
|
|
|
|
|
|
|
5325
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5326
|
|
|
|
|
|
|
manipulating number data. |
5327
|
|
|
|
|
|
|
|
5328
|
|
|
|
|
|
|
=back |
5329
|
|
|
|
|
|
|
|
5330
|
|
|
|
|
|
|
=over 4 |
5331
|
|
|
|
|
|
|
|
5332
|
|
|
|
|
|
|
=item venus-opts |
5333
|
|
|
|
|
|
|
|
5334
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5335
|
|
|
|
|
|
|
handling command-line arguments. |
5336
|
|
|
|
|
|
|
|
5337
|
|
|
|
|
|
|
=back |
5338
|
|
|
|
|
|
|
|
5339
|
|
|
|
|
|
|
=over 4 |
5340
|
|
|
|
|
|
|
|
5341
|
|
|
|
|
|
|
=item venus-path |
5342
|
|
|
|
|
|
|
|
5343
|
|
|
|
|
|
|
This library contains a L class which provides methods for working |
5344
|
|
|
|
|
|
|
with file system paths. |
5345
|
|
|
|
|
|
|
|
5346
|
|
|
|
|
|
|
=back |
5347
|
|
|
|
|
|
|
|
5348
|
|
|
|
|
|
|
=over 4 |
5349
|
|
|
|
|
|
|
|
5350
|
|
|
|
|
|
|
=item venus-process |
5351
|
|
|
|
|
|
|
|
5352
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5353
|
|
|
|
|
|
|
handling and forking processes. |
5354
|
|
|
|
|
|
|
|
5355
|
|
|
|
|
|
|
=back |
5356
|
|
|
|
|
|
|
|
5357
|
|
|
|
|
|
|
=over 4 |
5358
|
|
|
|
|
|
|
|
5359
|
|
|
|
|
|
|
=item venus-prototype |
5360
|
|
|
|
|
|
|
|
5361
|
|
|
|
|
|
|
This library contains a L class which provides a simple |
5362
|
|
|
|
|
|
|
construct for enabling prototype-base programming. |
5363
|
|
|
|
|
|
|
|
5364
|
|
|
|
|
|
|
=back |
5365
|
|
|
|
|
|
|
|
5366
|
|
|
|
|
|
|
=over 4 |
5367
|
|
|
|
|
|
|
|
5368
|
|
|
|
|
|
|
=item venus-random |
5369
|
|
|
|
|
|
|
|
5370
|
|
|
|
|
|
|
This library contains a L class which provides an |
5371
|
|
|
|
|
|
|
object-oriented interface for Perl's pseudo-random number generator. |
5372
|
|
|
|
|
|
|
|
5373
|
|
|
|
|
|
|
=back |
5374
|
|
|
|
|
|
|
|
5375
|
|
|
|
|
|
|
=over 4 |
5376
|
|
|
|
|
|
|
|
5377
|
|
|
|
|
|
|
=item venus-regexp |
5378
|
|
|
|
|
|
|
|
5379
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5380
|
|
|
|
|
|
|
manipulating regexp data. |
5381
|
|
|
|
|
|
|
|
5382
|
|
|
|
|
|
|
=back |
5383
|
|
|
|
|
|
|
|
5384
|
|
|
|
|
|
|
=over 4 |
5385
|
|
|
|
|
|
|
|
5386
|
|
|
|
|
|
|
=item venus-replace |
5387
|
|
|
|
|
|
|
|
5388
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5389
|
|
|
|
|
|
|
manipulating regexp replacement data. |
5390
|
|
|
|
|
|
|
|
5391
|
|
|
|
|
|
|
=back |
5392
|
|
|
|
|
|
|
|
5393
|
|
|
|
|
|
|
=over 4 |
5394
|
|
|
|
|
|
|
|
5395
|
|
|
|
|
|
|
=item venus-run |
5396
|
|
|
|
|
|
|
|
5397
|
|
|
|
|
|
|
This library contains a L class which provides a base class for |
5398
|
|
|
|
|
|
|
providing a command execution system for creating CLIs (command-line |
5399
|
|
|
|
|
|
|
interfaces). |
5400
|
|
|
|
|
|
|
|
5401
|
|
|
|
|
|
|
=back |
5402
|
|
|
|
|
|
|
|
5403
|
|
|
|
|
|
|
=over 4 |
5404
|
|
|
|
|
|
|
|
5405
|
|
|
|
|
|
|
=item venus-scalar |
5406
|
|
|
|
|
|
|
|
5407
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5408
|
|
|
|
|
|
|
manipulating scalar data. |
5409
|
|
|
|
|
|
|
|
5410
|
|
|
|
|
|
|
=back |
5411
|
|
|
|
|
|
|
|
5412
|
|
|
|
|
|
|
=over 4 |
5413
|
|
|
|
|
|
|
|
5414
|
|
|
|
|
|
|
=item venus-search |
5415
|
|
|
|
|
|
|
|
5416
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5417
|
|
|
|
|
|
|
manipulating regexp search data. |
5418
|
|
|
|
|
|
|
|
5419
|
|
|
|
|
|
|
=back |
5420
|
|
|
|
|
|
|
|
5421
|
|
|
|
|
|
|
=over 4 |
5422
|
|
|
|
|
|
|
|
5423
|
|
|
|
|
|
|
=item venus-space |
5424
|
|
|
|
|
|
|
|
5425
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5426
|
|
|
|
|
|
|
parsing and manipulating package namespaces. |
5427
|
|
|
|
|
|
|
|
5428
|
|
|
|
|
|
|
=back |
5429
|
|
|
|
|
|
|
|
5430
|
|
|
|
|
|
|
=over 4 |
5431
|
|
|
|
|
|
|
|
5432
|
|
|
|
|
|
|
=item venus-string |
5433
|
|
|
|
|
|
|
|
5434
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5435
|
|
|
|
|
|
|
manipulating string data. |
5436
|
|
|
|
|
|
|
|
5437
|
|
|
|
|
|
|
=back |
5438
|
|
|
|
|
|
|
|
5439
|
|
|
|
|
|
|
=over 4 |
5440
|
|
|
|
|
|
|
|
5441
|
|
|
|
|
|
|
=item venus-task |
5442
|
|
|
|
|
|
|
|
5443
|
|
|
|
|
|
|
This library contains a L class which provides a base class for |
5444
|
|
|
|
|
|
|
creating CLIs (command-line interfaces). |
5445
|
|
|
|
|
|
|
|
5446
|
|
|
|
|
|
|
=back |
5447
|
|
|
|
|
|
|
|
5448
|
|
|
|
|
|
|
=over 4 |
5449
|
|
|
|
|
|
|
|
5450
|
|
|
|
|
|
|
=item venus-template |
5451
|
|
|
|
|
|
|
|
5452
|
|
|
|
|
|
|
This library contains a L class which provides a templating |
5453
|
|
|
|
|
|
|
system, and methods for rendering template. |
5454
|
|
|
|
|
|
|
|
5455
|
|
|
|
|
|
|
=back |
5456
|
|
|
|
|
|
|
|
5457
|
|
|
|
|
|
|
=over 4 |
5458
|
|
|
|
|
|
|
|
5459
|
|
|
|
|
|
|
=item venus-test |
5460
|
|
|
|
|
|
|
|
5461
|
|
|
|
|
|
|
This library contains a L class which aims to provide a standard |
5462
|
|
|
|
|
|
|
for documenting L derived software projects. |
5463
|
|
|
|
|
|
|
|
5464
|
|
|
|
|
|
|
=back |
5465
|
|
|
|
|
|
|
|
5466
|
|
|
|
|
|
|
=over 4 |
5467
|
|
|
|
|
|
|
|
5468
|
|
|
|
|
|
|
=item venus-throw |
5469
|
|
|
|
|
|
|
|
5470
|
|
|
|
|
|
|
This library contains a L class which provides a mechanism for |
5471
|
|
|
|
|
|
|
generating and raising error objects. |
5472
|
|
|
|
|
|
|
|
5473
|
|
|
|
|
|
|
=back |
5474
|
|
|
|
|
|
|
|
5475
|
|
|
|
|
|
|
=over 4 |
5476
|
|
|
|
|
|
|
|
5477
|
|
|
|
|
|
|
=item venus-true |
5478
|
|
|
|
|
|
|
|
5479
|
|
|
|
|
|
|
This library contains a L class which provides the global C |
5480
|
|
|
|
|
|
|
value. |
5481
|
|
|
|
|
|
|
|
5482
|
|
|
|
|
|
|
=back |
5483
|
|
|
|
|
|
|
|
5484
|
|
|
|
|
|
|
=over 4 |
5485
|
|
|
|
|
|
|
|
5486
|
|
|
|
|
|
|
=item venus-try |
5487
|
|
|
|
|
|
|
|
5488
|
|
|
|
|
|
|
This library contains a L class which provides an object-oriented |
5489
|
|
|
|
|
|
|
interface for performing complex try/catch operations. |
5490
|
|
|
|
|
|
|
|
5491
|
|
|
|
|
|
|
=back |
5492
|
|
|
|
|
|
|
|
5493
|
|
|
|
|
|
|
=over 4 |
5494
|
|
|
|
|
|
|
|
5495
|
|
|
|
|
|
|
=item venus-type |
5496
|
|
|
|
|
|
|
|
5497
|
|
|
|
|
|
|
This library contains a L class which provides methods for casting |
5498
|
|
|
|
|
|
|
native data types to objects. |
5499
|
|
|
|
|
|
|
|
5500
|
|
|
|
|
|
|
=back |
5501
|
|
|
|
|
|
|
|
5502
|
|
|
|
|
|
|
=over 4 |
5503
|
|
|
|
|
|
|
|
5504
|
|
|
|
|
|
|
=item venus-undef |
5505
|
|
|
|
|
|
|
|
5506
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5507
|
|
|
|
|
|
|
manipulating undef data. |
5508
|
|
|
|
|
|
|
|
5509
|
|
|
|
|
|
|
=back |
5510
|
|
|
|
|
|
|
|
5511
|
|
|
|
|
|
|
=over 4 |
5512
|
|
|
|
|
|
|
|
5513
|
|
|
|
|
|
|
=item venus-unpack |
5514
|
|
|
|
|
|
|
|
5515
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5516
|
|
|
|
|
|
|
validating, coercing, and otherwise operating on lists of arguments. |
5517
|
|
|
|
|
|
|
|
5518
|
|
|
|
|
|
|
=back |
5519
|
|
|
|
|
|
|
|
5520
|
|
|
|
|
|
|
=over 4 |
5521
|
|
|
|
|
|
|
|
5522
|
|
|
|
|
|
|
=item venus-vars |
5523
|
|
|
|
|
|
|
|
5524
|
|
|
|
|
|
|
This library contains a L class which provides methods for |
5525
|
|
|
|
|
|
|
accessing C<%ENV> items. |
5526
|
|
|
|
|
|
|
|
5527
|
|
|
|
|
|
|
=back |
5528
|
|
|
|
|
|
|
|
5529
|
|
|
|
|
|
|
=over 4 |
5530
|
|
|
|
|
|
|
|
5531
|
|
|
|
|
|
|
=item venus-yaml |
5532
|
|
|
|
|
|
|
|
5533
|
|
|
|
|
|
|
This library contains a L class which provides methods for reading |
5534
|
|
|
|
|
|
|
and writing YAML data. |
5535
|
|
|
|
|
|
|
|
5536
|
|
|
|
|
|
|
=back |
5537
|
|
|
|
|
|
|
|
5538
|
|
|
|
|
|
|
=head1 AUTHORS |
5539
|
|
|
|
|
|
|
|
5540
|
|
|
|
|
|
|
Awncorp, C |
5541
|
|
|
|
|
|
|
|
5542
|
|
|
|
|
|
|
=cut |
5543
|
|
|
|
|
|
|
|
5544
|
|
|
|
|
|
|
=head1 LICENSE |
5545
|
|
|
|
|
|
|
|
5546
|
|
|
|
|
|
|
Copyright (C) 2000, Al Newkirk. |
5547
|
|
|
|
|
|
|
|
5548
|
|
|
|
|
|
|
This program is free software, you can redistribute it and/or modify it under |
5549
|
|
|
|
|
|
|
the terms of the Apache license version 2.0. |
5550
|
|
|
|
|
|
|
|
5551
|
|
|
|
|
|
|
=cut |