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