blib/lib/Venus.pm

filter: Statementstmt 92.6% 849 / 916 Branchbran 82.8% 426 / 514 Conditioncond 70.7% 232 / 328 MC/DCmcdc 55.4% 112 / 202 Subroutinesub 98.1% 161 / 164 Podpod 99.3% 148 / 149 totaltotal 84.8% 1928 / 2273 CC 396 SCAR 29.8
CC
396
Cov
86%
tv
142.0
merge_swap_mutate
24.9
call
24.6
CRAP 19.7
« blib/lib/Venus/Text.pm ↑ Summary blib/lib/Venus/Boolean.pm »
1 package Venus;
2  
3 120 ▶use 5.018;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 120 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 120 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # VERSION
9  
10 120 our $VERSION = '5.01';
11  
12 # AUTHORITY
13  
14 120 our $AUTHORITY = 'cpan:AWNCORP';
15  
16 # FILES
17  
18 120 our $FILES = {
19 'lib/Venus.pm' => {
20 help => 'lib/Venus.pod',
21 main => 1,
22 name => 'Venus',
23 skip => 0,
24 test => 't/Venus.t',
25 type => 'dsl',
26 },
27 'lib/Venus/Args.pm' => {
28 help => 'lib/Venus/Args.pod',
29 name => 'Venus::Args',
30 skip => 0,
31 test => 't/Venus_Args.t',
32 type => 'class',
33 },
34 'lib/Venus/Array.pm' => {
35 help => 'lib/Venus/Array.pod',
36 name => 'Venus::Array',
37 skip => 0,
38 test => 't/Venus_Array.t',
39 type => 'class',
40 },
41 'lib/Venus/Assert.pm' => {
42 help => 'lib/Venus/Assert.pod',
43 name => 'Venus::Assert',
44 skip => 0,
45 test => 't/Venus_Assert.t',
46 type => 'class',
47 },
48 'lib/Venus/Atom.pm' => {
49 help => 'lib/Venus/Atom.pod',
50 name => 'Venus::Atom',
51 skip => 0,
52 test => 't/Venus_Atom.t',
53 type => 'class',
54 },
55 'lib/Venus/Boolean.pm' => {
56 help => 'lib/Venus/Boolean.pod',
57 name => 'Venus::Boolean',
58 skip => 0,
59 test => 't/Venus_Boolean.t',
60 type => 'class',
61 },
62 'lib/Venus/Box.pm' => {
63 help => 'lib/Venus/Box.pod',
64 name => 'Venus::Box',
65 skip => 0,
66 test => 't/Venus_Box.t',
67 type => 'class',
68 },
69 'lib/Venus/Check.pm' => {
70 help => 'lib/Venus/Check.pod',
71 name => 'Venus::Check',
72 skip => 0,
73 test => 't/Venus_Check.t',
74 type => 'class',
75 },
76 'lib/Venus/Class.pm' => {
77 help => 'lib/Venus/Class.pod',
78 name => 'Venus::Class',
79 skip => 0,
80 test => 't/Venus_Class.t',
81 type => 'dsl',
82 },
83 'lib/Venus/Cli.pm' => {
84 help => 'lib/Venus/Cli.pod',
85 name => 'Venus::Cli',
86 skip => 0,
87 test => 't/Venus_Cli.t',
88 type => 'class',
89 },
90 'lib/Venus/Code.pm' => {
91 help => 'lib/Venus/Code.pod',
92 name => 'Venus::Code',
93 skip => 0,
94 test => 't/Venus_Code.t',
95 type => 'class',
96 },
97 'lib/Venus/Coercion.pm' => {
98 help => 'lib/Venus/Coercion.pod',
99 name => 'Venus::Coercion',
100 skip => 0,
101 test => 't/Venus_Coercion.t',
102 type => 'class',
103 },
104 'lib/Venus/Config.pm' => {
105 help => 'lib/Venus/Config.pod',
106 name => 'Venus::Config',
107 skip => 0,
108 test => 't/Venus_Config.t',
109 type => 'class',
110 },
111 'lib/Venus/Collect.pm' => {
112 help => 'lib/Venus/Collect.pod',
113 name => 'Venus::Collect',
114 skip => 0,
115 test => 't/Venus_Collect.t',
116 type => 'class',
117 },
118 'lib/Venus/Constraint.pm' => {
119 help => 'lib/Venus/Constraint.pod',
120 name => 'Venus::Constraint',
121 skip => 0,
122 test => 't/Venus_Constraint.t',
123 type => 'class',
124 },
125 'lib/Venus/Core.pm' => {
126 help => 'lib/Venus/Core.pod',
127 name => 'Venus::Core',
128 skip => 0,
129 test => 't/Venus_Core.t',
130 type => 'core',
131 },
132 'lib/Venus/Core/Class.pm' => {
133 help => 'lib/Venus/Core/Class.pod',
134 name => 'Venus::Core::Class',
135 skip => 0,
136 test => 't/Venus_Core_Class.t',
137 type => 'core',
138 },
139 'lib/Venus/Core/Mixin.pm' => {
140 help => 'lib/Venus/Core/Mixin.pod',
141 name => 'Venus::Core::Mixin',
142 skip => 0,
143 test => 't/Venus_Core_Mixin.t',
144 type => 'core',
145 },
146 'lib/Venus/Core/Role.pm' => {
147 help => 'lib/Venus/Core/Role.pod',
148 name => 'Venus::Core::Role',
149 skip => 0,
150 test => 't/Venus_Core_Role.t',
151 type => 'core',
152 },
153 'lib/Venus/Data.pm' => {
154 help => 'lib/Venus/Data.pod',
155 name => 'Venus::Data',
156 skip => 0,
157 test => 't/Venus_Data.t',
158 type => 'class',
159 },
160 'lib/Venus/Date.pm' => {
161 help => 'lib/Venus/Date.pod',
162 name => 'Venus::Date',
163 skip => 0,
164 test => 't/Venus_Date.t',
165 type => 'class',
166 },
167 'lib/Venus/Dump.pm' => {
168 help => 'lib/Venus/Dump.pod',
169 name => 'Venus::Dump',
170 skip => 0,
171 test => 't/Venus_Dump.t',
172 type => 'class',
173 },
174 'lib/Venus/Enum.pm' => {
175 help => 'lib/Venus/Enum.pod',
176 name => 'Venus::Enum',
177 skip => 0,
178 test => 't/Venus_Enum.t',
179 type => 'class',
180 },
181 'lib/Venus/Error.pm' => {
182 help => 'lib/Venus/Error.pod',
183 name => 'Venus::Error',
184 skip => 0,
185 test => 't/Venus_Error.t',
186 type => 'class',
187 },
188 'lib/Venus/Factory.pm' => {
189 help => 'lib/Venus/Factory.pod',
190 name => 'Venus::Factory',
191 skip => 0,
192 test => 't/Venus_Factory.t',
193 type => 'class',
194 },
195 'lib/Venus/False.pm' => {
196 help => 'lib/Venus/False.pod',
197 name => 'Venus::False',
198 skip => 0,
199 test => 't/Venus_False.t',
200 type => 'class',
201 },
202 'lib/Venus/Fault.pm' => {
203 help => 'lib/Venus/Fault.pod',
204 name => 'Venus::Fault',
205 skip => 0,
206 test => 't/Venus_Fault.t',
207 type => 'class',
208 },
209 'lib/Venus/Float.pm' => {
210 help => 'lib/Venus/Float.pod',
211 name => 'Venus::Float',
212 skip => 0,
213 test => 't/Venus_Float.t',
214 type => 'class',
215 },
216 'lib/Venus/Future.pm' => {
217 help => 'lib/Venus/Future.pod',
218 name => 'Venus::Future',
219 skip => 0,
220 test => 't/Venus_Future.t',
221 type => 'class',
222 },
223 'lib/Venus/Gather.pm' => {
224 help => 'lib/Venus/Gather.pod',
225 name => 'Venus::Gather',
226 skip => 0,
227 test => 't/Venus_Gather.t',
228 type => 'class',
229 },
230 'lib/Venus/Hash.pm' => {
231 help => 'lib/Venus/Hash.pod',
232 name => 'Venus::Hash',
233 skip => 0,
234 test => 't/Venus_Hash.t',
235 type => 'class',
236 },
237 'lib/Venus/Hook.pm' => {
238 help => 'lib/Venus/Hook.pod',
239 name => 'Venus::Hook',
240 skip => 1,
241 test => 't/Venus_Hook.t',
242 type => 'dsl',
243 },
244 'lib/Venus/Json.pm' => {
245 help => 'lib/Venus/Json.pod',
246 name => 'Venus::Json',
247 skip => 0,
248 test => 't/Venus_Json.t',
249 type => 'class',
250 },
251 'lib/Venus/Kind.pm' => {
252 help => 'lib/Venus/Kind.pod',
253 name => 'Venus::Kind',
254 skip => 0,
255 test => 't/Venus_Kind.t',
256 type => 'kind',
257 },
258 'lib/Venus/Kind/Utility.pm' => {
259 help => 'lib/Venus/Kind/Utility.pod',
260 name => 'Venus::Kind::Utility',
261 skip => 0,
262 test => 't/Venus_Kind_Utility.t',
263 type => 'kind',
264 },
265 'lib/Venus/Kind/Value.pm' => {
266 help => 'lib/Venus/Kind/Value.pod',
267 name => 'Venus::Kind::Value',
268 skip => 0,
269 test => 't/Venus_Kind_Value.t',
270 type => 'kind',
271 },
272 'lib/Venus/Log.pm' => {
273 help => 'lib/Venus/Log.pod',
274 name => 'Venus::Log',
275 skip => 0,
276 test => 't/Venus_Log.t',
277 type => 'class',
278 },
279 'lib/Venus/Match.pm' => {
280 help => 'lib/Venus/Match.pod',
281 name => 'Venus::Match',
282 skip => 0,
283 test => 't/Venus_Match.t',
284 type => 'class',
285 },
286 'lib/Venus/Map.pm' => {
287 help => 'lib/Venus/Map.pod',
288 name => 'Venus::Map',
289 skip => 0,
290 test => 't/Venus_Map.t',
291 type => 'class',
292 },
293 'lib/Venus/Meta.pm' => {
294 help => 'lib/Venus/Meta.pod',
295 name => 'Venus::Meta',
296 skip => 0,
297 test => 't/Venus_Meta.t',
298 type => 'class',
299 },
300 'lib/Venus/Mixin.pm' => {
301 help => 'lib/Venus/Mixin.pod',
302 name => 'Venus::Mixin',
303 skip => 0,
304 test => 't/Venus_Mixin.t',
305 type => 'dsl',
306 },
307 'lib/Venus/Module.pm' => {
308 help => 'lib/Venus/Module.pod',
309 name => 'Venus::Module',
310 skip => 0,
311 test => 't/Venus_Module.t',
312 type => 'dsl',
313 },
314 'lib/Venus/Name.pm' => {
315 help => 'lib/Venus/Name.pod',
316 name => 'Venus::Name',
317 skip => 0,
318 test => 't/Venus_Name.t',
319 type => 'class',
320 },
321 'lib/Venus/Number.pm' => {
322 help => 'lib/Venus/Number.pod',
323 name => 'Venus::Number',
324 skip => 0,
325 test => 't/Venus_Number.t',
326 type => 'class',
327 },
328 'lib/Venus/Opts.pm' => {
329 help => 'lib/Venus/Opts.pod',
330 name => 'Venus::Opts',
331 skip => 0,
332 test => 't/Venus_Opts.t',
333 type => 'class',
334 },
335 'lib/Venus/Os.pm' => {
336 help => 'lib/Venus/Os.pod',
337 name => 'Venus::Os',
338 skip => 0,
339 test => 't/Venus_Os.t',
340 type => 'class',
341 },
342 'lib/Venus/Path.pm' => {
343 help => 'lib/Venus/Path.pod',
344 name => 'Venus::Path',
345 skip => 0,
346 test => 't/Venus_Path.t',
347 type => 'class',
348 },
349 'lib/Venus/Process.pm' => {
350 help => 'lib/Venus/Process.pod',
351 name => 'Venus::Process',
352 skip => 0,
353 test => 't/Venus_Process.t',
354 type => 'class',
355 },
356 'lib/Venus/Prototype.pm' => {
357 help => 'lib/Venus/Prototype.pod',
358 name => 'Venus::Prototype',
359 skip => 0,
360 test => 't/Venus_Prototype.t',
361 type => 'class',
362 },
363 'lib/Venus/Random.pm' => {
364 help => 'lib/Venus/Random.pod',
365 name => 'Venus::Random',
366 skip => 0,
367 test => 't/Venus_Random.t',
368 type => 'class',
369 },
370 'lib/Venus/Range.pm' => {
371 help => 'lib/Venus/Range.pod',
372 name => 'Venus::Range',
373 skip => 0,
374 test => 't/Venus_Range.t',
375 type => 'class',
376 },
377 'lib/Venus/Regexp.pm' => {
378 help => 'lib/Venus/Regexp.pod',
379 name => 'Venus::Regexp',
380 skip => 0,
381 test => 't/Venus_Regexp.t',
382 type => 'class',
383 },
384 'lib/Venus/Replace.pm' => {
385 help => 'lib/Venus/Replace.pod',
386 name => 'Venus::Replace',
387 skip => 0,
388 test => 't/Venus_Replace.t',
389 type => 'class',
390 },
391 'lib/Venus/Result.pm' => {
392 help => 'lib/Venus/Result.pod',
393 name => 'Venus::Result',
394 skip => 0,
395 test => 't/Venus_Result.t',
396 type => 'class',
397 },
398 'lib/Venus/Role.pm' => {
399 help => 'lib/Venus/Role.pod',
400 name => 'Venus::Role',
401 skip => 0,
402 test => 't/Venus_Role.t',
403 type => 'dsl',
404 },
405 'lib/Venus/Role/Accessible.pm' => {
406 help => 'lib/Venus/Role/Accessible.pod',
407 name => 'Venus::Role::Accessible',
408 skip => 0,
409 test => 't/Venus_Role_Accessible.t',
410 type => 'role',
411 },
412 'lib/Venus/Role/Boxable.pm' => {
413 help => 'lib/Venus/Role/Boxable.pod',
414 name => 'Venus::Role::Boxable',
415 skip => 0,
416 test => 't/Venus_Role_Boxable.t',
417 type => 'role',
418 },
419 'lib/Venus/Role/Buildable.pm' => {
420 help => 'lib/Venus/Role/Buildable.pod',
421 name => 'Venus::Role::Buildable',
422 skip => 0,
423 test => 't/Venus_Role_Buildable.t',
424 type => 'role',
425 },
426 'lib/Venus/Role/Catchable.pm' => {
427 help => 'lib/Venus/Role/Catchable.pod',
428 name => 'Venus::Role::Catchable',
429 skip => 0,
430 test => 't/Venus_Role_Catchable.t',
431 type => 'role',
432 },
433 'lib/Venus/Role/Coercible.pm' => {
434 help => 'lib/Venus/Role/Coercible.pod',
435 name => 'Venus::Role::Coercible',
436 skip => 0,
437 test => 't/Venus_Role_Coercible.t',
438 type => 'role',
439 },
440 'lib/Venus/Role/Comparable.pm' => {
441 help => 'lib/Venus/Role/Comparable.pod',
442 name => 'Venus::Role::Comparable',
443 skip => 0,
444 test => 't/Venus_Role_Comparable.t',
445 type => 'role',
446 },
447 'lib/Venus/Role/Defaultable.pm' => {
448 help => 'lib/Venus/Role/Defaultable.pod',
449 name => 'Venus::Role::Defaultable',
450 skip => 0,
451 test => 't/Venus_Role_Defaultable.t',
452 type => 'role',
453 },
454 'lib/Venus/Role/Deferrable.pm' => {
455 help => 'lib/Venus/Role/Deferrable.pod',
456 name => 'Venus::Role::Deferrable',
457 skip => 0,
458 test => 't/Venus_Role_Deferrable.t',
459 type => 'role',
460 },
461 'lib/Venus/Role/Digestable.pm' => {
462 help => 'lib/Venus/Role/Digestable.pod',
463 name => 'Venus::Role::Digestable',
464 skip => 0,
465 test => 't/Venus_Role_Digestable.t',
466 type => 'role',
467 },
468 'lib/Venus/Role/Doable.pm' => {
469 help => 'lib/Venus/Role/Doable.pod',
470 name => 'Venus::Role::Doable',
471 skip => 0,
472 test => 't/Venus_Role_Doable.t',
473 type => 'role',
474 },
475 'lib/Venus/Role/Dumpable.pm' => {
476 help => 'lib/Venus/Role/Dumpable.pod',
477 name => 'Venus::Role::Dumpable',
478 skip => 0,
479 test => 't/Venus_Role_Dumpable.t',
480 type => 'role',
481 },
482 'lib/Venus/Role/Encaseable.pm' => {
483 help => 'lib/Venus/Role/Encaseable.pod',
484 name => 'Venus::Role::Encaseable',
485 skip => 0,
486 test => 't/Venus_Role_Encaseable.t',
487 type => 'role',
488 },
489 'lib/Venus/Role/Explainable.pm' => {
490 help => 'lib/Venus/Role/Explainable.pod',
491 name => 'Venus::Role::Explainable',
492 skip => 0,
493 test => 't/Venus_Role_Explainable.t',
494 type => 'role',
495 },
496 'lib/Venus/Role/Fromable.pm' => {
497 help => 'lib/Venus/Role/Fromable.pod',
498 name => 'Venus::Role::Fromable',
499 skip => 0,
500 test => 't/Venus_Role_Fromable.t',
501 type => 'role',
502 },
503 'lib/Venus/Role/Mappable.pm' => {
504 help => 'lib/Venus/Role/Mappable.pod',
505 name => 'Venus::Role::Mappable',
506 skip => 0,
507 test => 't/Venus_Role_Mappable.t',
508 type => 'role',
509 },
510 'lib/Venus/Role/Matchable.pm' => {
511 help => 'lib/Venus/Role/Matchable.pod',
512 name => 'Venus::Role::Matchable',
513 skip => 0,
514 test => 't/Venus_Role_Matchable.t',
515 type => 'role',
516 },
517 'lib/Venus/Role/Mockable.pm' => {
518 help => 'lib/Venus/Role/Mockable.pod',
519 name => 'Venus::Role::Mockable',
520 skip => 0,
521 test => 't/Venus_Role_Mockable.t',
522 type => 'role',
523 },
524 'lib/Venus/Role/Optional.pm' => {
525 help => 'lib/Venus/Role/Optional.pod',
526 name => 'Venus::Role::Optional',
527 skip => 0,
528 test => 't/Venus_Role_Optional.t',
529 type => 'role',
530 },
531 'lib/Venus/Role/Patchable.pm' => {
532 help => 'lib/Venus/Role/Patchable.pod',
533 name => 'Venus::Role::Patchable',
534 skip => 0,
535 test => 't/Venus_Role_Patchable.t',
536 type => 'role',
537 },
538 'lib/Venus/Role/Pluggable.pm' => {
539 help => 'lib/Venus/Role/Pluggable.pod',
540 name => 'Venus::Role::Pluggable',
541 skip => 0,
542 test => 't/Venus_Role_Pluggable.t',
543 type => 'role',
544 },
545 'lib/Venus/Role/Printable.pm' => {
546 help => 'lib/Venus/Role/Printable.pod',
547 name => 'Venus::Role::Printable',
548 skip => 0,
549 test => 't/Venus_Role_Printable.t',
550 type => 'role',
551 },
552 'lib/Venus/Role/Proxyable.pm' => {
553 help => 'lib/Venus/Role/Proxyable.pod',
554 name => 'Venus::Role::Proxyable',
555 skip => 0,
556 test => 't/Venus_Role_Proxyable.t',
557 type => 'role',
558 },
559 'lib/Venus/Role/Reflectable.pm' => {
560 help => 'lib/Venus/Role/Reflectable.pod',
561 name => 'Venus::Role::Reflectable',
562 skip => 0,
563 test => 't/Venus_Role_Reflectable.t',
564 type => 'role',
565 },
566 'lib/Venus/Role/Rejectable.pm' => {
567 help => 'lib/Venus/Role/Rejectable.pod',
568 name => 'Venus::Role::Rejectable',
569 skip => 0,
570 test => 't/Venus_Role_Rejectable.t',
571 type => 'role',
572 },
573 'lib/Venus/Role/Resultable.pm' => {
574 help => 'lib/Venus/Role/Resultable.pod',
575 name => 'Venus::Role::Resultable',
576 skip => 0,
577 test => 't/Venus_Role_Resultable.t',
578 type => 'role',
579 },
580 'lib/Venus/Role/Serializable.pm' => {
581 help => 'lib/Venus/Role/Serializable.pod',
582 name => 'Venus::Role::Serializable',
583 skip => 0,
584 test => 't/Venus_Role_Serializable.t',
585 type => 'role',
586 },
587 'lib/Venus/Role/Stashable.pm' => {
588 help => 'lib/Venus/Role/Stashable.pod',
589 name => 'Venus::Role::Stashable',
590 skip => 0,
591 test => 't/Venus_Role_Stashable.t',
592 type => 'role',
593 },
594 'lib/Venus/Role/Subscribable.pm' => {
595 help => 'lib/Venus/Role/Subscribable.pod',
596 name => 'Venus::Role::Subscribable',
597 skip => 0,
598 test => 't/Venus_Role_Subscribable.t',
599 type => 'role',
600 },
601 'lib/Venus/Role/Superable.pm' => {
602 help => 'lib/Venus/Role/Superable.pod',
603 name => 'Venus::Role::Superable',
604 skip => 0,
605 test => 't/Venus_Role_Superable.t',
606 type => 'role',
607 },
608 'lib/Venus/Role/Testable.pm' => {
609 help => 'lib/Venus/Role/Testable.pod',
610 name => 'Venus::Role::Testable',
611 skip => 0,
612 test => 't/Venus_Role_Testable.t',
613 type => 'role',
614 },
615 'lib/Venus/Role/Throwable.pm' => {
616 help => 'lib/Venus/Role/Throwable.pod',
617 name => 'Venus::Role::Throwable',
618 skip => 0,
619 test => 't/Venus_Role_Throwable.t',
620 type => 'role',
621 },
622 'lib/Venus/Role/Tryable.pm' => {
623 help => 'lib/Venus/Role/Tryable.pod',
624 name => 'Venus::Role::Tryable',
625 skip => 0,
626 test => 't/Venus_Role_Tryable.t',
627 type => 'role',
628 },
629 'lib/Venus/Role/Unacceptable.pm' => {
630 help => 'lib/Venus/Role/Unacceptable.pod',
631 name => 'Venus::Role::Unacceptable',
632 skip => 0,
633 test => 't/Venus_Role_Unacceptable.t',
634 type => 'role',
635 },
636 'lib/Venus/Role/Unpackable.pm' => {
637 help => 'lib/Venus/Role/Unpackable.pod',
638 name => 'Venus::Role::Unpackable',
639 skip => 0,
640 test => 't/Venus_Role_Unpackable.t',
641 type => 'role',
642 },
643 'lib/Venus/Role/Valuable.pm' => {
644 help => 'lib/Venus/Role/Valuable.pod',
645 name => 'Venus::Role::Valuable',
646 skip => 0,
647 test => 't/Venus_Role_Valuable.t',
648 type => 'role',
649 },
650 'lib/Venus/Run.pm' => {
651 help => 'lib/Venus/Run.pod',
652 name => 'Venus::Run',
653 skip => 0,
654 test => 't/Venus_Run.t',
655 type => 'class',
656 },
657 'lib/Venus/Scalar.pm' => {
658 help => 'lib/Venus/Scalar.pod',
659 name => 'Venus::Scalar',
660 skip => 0,
661 test => 't/Venus_Scalar.t',
662 type => 'class',
663 },
664 'lib/Venus/Schema.pm' => {
665 help => 'lib/Venus/Schema.pod',
666 name => 'Venus::Schema',
667 skip => 0,
668 test => 't/Venus_Schema.t',
669 type => 'class',
670 },
671 'lib/Venus/Sealed.pm' => {
672 help => 'lib/Venus/Sealed.pod',
673 name => 'Venus::Sealed',
674 skip => 0,
675 test => 't/Venus_Sealed.t',
676 type => 'class',
677 },
678 'lib/Venus/Search.pm' => {
679 help => 'lib/Venus/Search.pod',
680 name => 'Venus::Search',
681 skip => 0,
682 test => 't/Venus_Search.t',
683 type => 'class',
684 },
685 'lib/Venus/Set.pm' => {
686 help => 'lib/Venus/Set.pod',
687 name => 'Venus::Set',
688 skip => 0,
689 test => 't/Venus_Set.t',
690 type => 'class',
691 },
692 'lib/Venus/Space.pm' => {
693 help => 'lib/Venus/Space.pod',
694 name => 'Venus::Space',
695 skip => 0,
696 test => 't/Venus_Space.t',
697 type => 'class',
698 },
699 'lib/Venus/String.pm' => {
700 help => 'lib/Venus/String.pod',
701 name => 'Venus::String',
702 skip => 0,
703 test => 't/Venus_String.t',
704 type => 'class',
705 },
706 'lib/Venus/Task.pm' => {
707 help => 'lib/Venus/Task.pod',
708 name => 'Venus::Task',
709 skip => 0,
710 test => 't/Venus_Task.t',
711 type => 'class',
712 },
713 'lib/Venus/Task/Venus.pm' => {
714 help => 'lib/Venus/Task/Venus.pod',
715 name => 'Venus::Task::Venus',
716 skip => 0,
717 test => 't/Venus_Task_Venus.t',
718 type => 'class',
719 },
720 'lib/Venus/Task/Venus/Gen.pm' => {
721 help => 'lib/Venus/Task/Venus/Gen.pod',
722 name => 'Venus::Task::Venus::Gen',
723 skip => 0,
724 test => 't/Venus_Task_Venus_Gen.t',
725 type => 'class',
726 },
727 'lib/Venus/Task/Venus/Get.pm' => {
728 help => 'lib/Venus/Task/Venus/Get.pod',
729 name => 'Venus::Task::Venus::Get',
730 skip => 0,
731 test => 't/Venus_Task_Venus_Get.t',
732 type => 'class',
733 },
734 'lib/Venus/Task/Venus/New.pm' => {
735 help => 'lib/Venus/Task/Venus/New.pod',
736 name => 'Venus::Task::Venus::New',
737 skip => 0,
738 test => 't/Venus_Task_Venus_New.t',
739 type => 'class',
740 },
741 'lib/Venus/Task/Venus/Run.pm' => {
742 help => 'lib/Venus/Task/Venus/Run.pod',
743 name => 'Venus::Task::Venus::Run',
744 skip => 0,
745 test => 't/Venus_Task_Venus_Run.t',
746 type => 'class',
747 },
748 'lib/Venus/Task/Venus/Set.pm' => {
749 help => 'lib/Venus/Task/Venus/Set.pod',
750 name => 'Venus::Task::Venus::Set',
751 skip => 0,
752 test => 't/Venus_Task_Venus_Set.t',
753 type => 'class',
754 },
755 'lib/Venus/Template.pm' => {
756 help => 'lib/Venus/Template.pod',
757 name => 'Venus::Template',
758 skip => 0,
759 test => 't/Venus_Template.t',
760 type => 'class',
761 },
762 'lib/Venus/Test.pm' => {
763 help => 'lib/Venus/Test.pod',
764 name => 'Venus::Test',
765 skip => 0,
766 test => 't/Venus_Test.t',
767 type => 'class',
768 },
769 'lib/Venus/Text.pm' => {
770 help => 'lib/Venus/Text.pod',
771 name => 'Venus::Text',
772 skip => 0,
773 test => 't/Venus_Text.t',
774 type => 'class',
775 },
776 'lib/Venus/Text/Pod.pm' => {
777 help => 'lib/Venus/Text/Pod.pod',
778 name => 'Venus::Text::Pod',
779 skip => 0,
780 test => 't/Venus_Text_Pod.t',
781 type => 'class',
782 },
783 'lib/Venus/Text/Tag.pm' => {
784 help => 'lib/Venus/Text/Tag.pod',
785 name => 'Venus::Text::Tag',
786 skip => 0,
787 test => 't/Venus_Text_Tag.t',
788 type => 'class',
789 },
790 'lib/Venus/Throw.pm' => {
791 help => 'lib/Venus/Throw.pod',
792 name => 'Venus::Throw',
793 skip => 0,
794 test => 't/Venus_Throw.t',
795 type => 'class',
796 },
797 'lib/Venus/True.pm' => {
798 help => 'lib/Venus/True.pod',
799 name => 'Venus::True',
800 skip => 0,
801 test => 't/Venus_True.t',
802 type => 'class',
803 },
804 'lib/Venus/Try.pm' => {
805 help => 'lib/Venus/Try.pod',
806 name => 'Venus::Try',
807 skip => 0,
808 test => 't/Venus_Try.t',
809 type => 'class',
810 },
811 'lib/Venus/Type.pm' => {
812 help => 'lib/Venus/Type.pod',
813 name => 'Venus::Type',
814 skip => 0,
815 test => 't/Venus_Type.t',
816 type => 'class',
817 },
818 'lib/Venus/Undef.pm' => {
819 help => 'lib/Venus/Undef.pod',
820 name => 'Venus::Undef',
821 skip => 0,
822 test => 't/Venus_Undef.t',
823 type => 'class',
824 },
825 'lib/Venus/Unpack.pm' => {
826 help => 'lib/Venus/Unpack.pod',
827 name => 'Venus::Unpack',
828 skip => 0,
829 test => 't/Venus_Unpack.t',
830 type => 'class',
831 },
832 'lib/Venus/Validate.pm' => {
833 help => 'lib/Venus/Validate.pod',
834 name => 'Venus::Validate',
835 skip => 0,
836 test => 't/Venus_Validate.t',
837 type => 'class',
838 },
839 'lib/Venus/Vars.pm' => {
840 help => 'lib/Venus/Vars.pod',
841 name => 'Venus::Vars',
842 skip => 0,
843 test => 't/Venus_Vars.t',
844 type => 'class',
845 },
846 'lib/Venus/What.pm' => {
847 help => 'lib/Venus/What.pod',
848 name => 'Venus::What',
849 skip => 0,
850 test => 't/Venus_What.t',
851 type => 'class',
852 },
853 'lib/Venus/Yaml.pm' => {
854 help => 'lib/Venus/Yaml.pod',
855 name => 'Venus::Yaml',
856 skip => 0,
857 test => 't/Venus_Yaml.t',
858 type => 'class',
859 },
860 };
861  
862 # IMPORTS
863  
864 953 ▶sub import {
Subroutine import: called CC=6 SCAR=18.9
865 953 my ($self, @args) = @_;
866  
867 953 my $target = caller;
868  
869 120 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
870  
871 953 my %exports = (
872 after => 1,
873 all => 1,
874 any => 1,
875 args => 1,
876 around => 1,
877 array => 1,
878 arrayref => 1,
879 assert => 1,
880 async => 1,
881 atom => 1,
882 await => 1,
883 before => 1,
884 bool => 1,
885 box => 1,
886 call => 1,
887 cast => 1,
888 catch => 1,
889 caught => 1,
890 chain => 1,
891 check => 1,
892 clargs => 1,
893 cli => 1,
894 clone => 1,
895 code => 1,
896 collect => 1,
897 concat => 1,
898 config => 1,
899 cop => 1,
900 data => 1,
901 date => 1,
902 docs => 1,
903 enum => 1,
904 error => 1,
905 factory => 1,
906 false => 1,
907 fault => 1,
908 flat => 1,
909 float => 1,
910 future => 1,
911 gather => 1,
912 gets => 1,
913 handle => 1,
914 hash => 1,
915 hashref => 1,
916 hook => 1,
917 in => 1,
918 is => 1,
919 is_arrayref => 1,
920 is_blessed => 1,
921 is_bool => 1,
922 is_boolean => 1,
923 is_coderef => 1,
924 is_dirhandle => 1,
925 is_enum => 1,
926 is_error => 1,
927 is_false => 1,
928 is_fault => 1,
929 is_filehandle => 1,
930 is_float => 1,
931 is_glob => 1,
932 is_hashref => 1,
933 is_number => 1,
934 is_object => 1,
935 is_package => 1,
936 is_reference => 1,
937 is_regexp => 1,
938 is_scalarref => 1,
939 is_string => 1,
940 is_true => 1,
941 is_undef => 1,
942 is_value => 1,
943 is_yesno => 1,
944 json => 1,
945 kvargs => 1,
946 list => 1,
947 load => 1,
948 log => 1,
949 make => 1,
950 map => 1,
951 match => 1,
952 merge => 1,
953 merge_flat => 1,
954 merge_flat_mutate => 1,
955 merge_join => 1,
956 merge_join_mutate => 1,
957 merge_keep => 1,
958 merge_keep_mutate => 1,
959 merge_swap => 1,
960 merge_swap_mutate => 1,
961 merge_take => 1,
962 merge_take_mutate => 1,
963 meta => 1,
964 name => 1,
965 number => 1,
966 opts => 1,
967 pairs => 1,
968 path => 1,
969 perl => 1,
970 process => 1,
971 proto => 1,
972 puts => 1,
973 raise => 1,
974 random => 1,
975 range => 1,
976 read_env => 1,
977 read_env_file => 1,
978 read_json => 1,
979 read_json_file => 1,
980 read_perl => 1,
981 read_perl_file => 1,
982 read_yaml => 1,
983 read_yaml_file => 1,
984 regexp => 1,
985 render => 1,
986 replace => 1,
987 roll => 1,
988 schema => 1,
989 search => 1,
990 set => 1,
991 sets => 1,
992 sorts => 1,
993 space => 1,
994 string => 1,
995 syscall => 1,
996 template => 1,
997 test => 1,
998 text_pod => 1,
999 text_pod_string => 1,
1000 text_tag => 1,
1001 text_tag_string => 1,
1002 then => 1,
1003 throw => 1,
1004 true => 1,
1005 try => 1,
1006 tv => 1,
1007 type => 1,
1008 unpack => 1,
1009 vars => 1,
1010 vns => 1,
1011 what => 1,
1012 work => 1,
1013 wrap => 1,
1014 write_env => 1,
1015 write_env_file => 1,
1016 write_json => 1,
1017 write_json_file => 1,
1018 write_perl => 1,
1019 write_perl_file => 1,
1020 write_yaml => 1,
1021 write_yaml_file => 1,
1022 yaml => 1,
1023 );
1024  
1025 953 ▶ @args = grep defined && !ref && /^[A-Za-z]/ && $exports{$_}, @args;
Condition33%3/9
defined $_ && !ref($_) && /^[A-Za-z]/u && $exports{$_}
!ll&&!rl&&r
001041
defined $_ and not ref $_ and /^[A-Za-z]/u
!ll&&!rl&&r
001041
defined $_ and not ref $_
!ll&&!rl&&r
001041
MC/DC0%0/4
defined $_ && !ref($_) && /^[A-Za-z]/u && $exports{$_}
defined $_ not ref $_ /^[A-Za-z]/u $exports{$_}
Truth table20%1/5
A and not(B) and C && D
A= defined $_B= not ref $_C= /^[A-Za-z]/uD= $exports{$_}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
1026  
1027 953 my %seen;
1028 953 for my $name (grep !$seen{$_}++, @args, 'true', 'false') {
1029 2947 ▶ *{"${target}::${name}"} = $self->can($name) if !$target->can($name);
Branch: 1 branch
BranchTrueFalseTotal
unless $target->can($name) 756 2191 2947
1030 }
1031  
1032 953 return $self;
1033 }
1034  
1035 # HOOKS
1036  
1037 0 ▶sub _qx {
Subroutine _qx: not called CC=2 SCAR=17.9
1038 0 my (@args) = @_;
1039 0 local $| = 1;
1040 0 ▶ local $SIG{__WARN__} = sub {};
Subroutine __ANON__: not called CC=1 SCAR=6.9
1041 0 ▶ (do{local $_ = qx(@{[@args]}); chomp if $_; $_}, $?, ($? >> 8))
Branch: 1 branch
BranchTrueFalseTotal
if $_ 0 0 0
1042 }
1043  
1044 # FUNCTIONS
1045  
1046 6 ▶sub after ($$) {
Subroutine after: called CC=1 SCAR=0.0
Pod documented
1047 6 my ($name, $code) = @_;
1048  
1049 6 my $package = caller;
1050  
1051 6 return space($package, 'after', $name, $code);
1052 }
1053  
1054 7 ▶sub all ($;$) {
Subroutine all: called CC=7 SCAR=22.7
Pod documented
1055 7 my ($data, $expr) = @_;
1056  
1057 7 my $cast = cast($data);
1058  
1059 7 ▶ my $code = (defined $expr && ref $expr ne 'CODE') ? sub{tv($_[1], $expr)} : $expr;
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
defined $expr && ref $expr ne 'CODE' ? : 5 2 7
Condition66%2/3
defined $expr and ref $expr ne "CODE"
!ll&&!rl&&r
025
MC/DC50%1/2
defined $expr and ref $expr ne "CODE"
defined $expr ref $expr ne "CODE"
Truth table66%2/3
A and B
A= defined $exprB= ref $expr ne "CODE"
ABresult
0X0
100
111
1060  
1061 7 ▶ if ($cast->isa('Venus::Kind') && $cast->does('Venus::Role::Mappable')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cast->isa('Venus::Kind') and $cast->does('Venus::Role::Mappable')) { } 7 0 7
Condition33%1/3
$cast->isa("Venus::Kind") and $cast->does("Venus::Role::Mappable")
!ll&&!rl&&r
007
MC/DC0%0/2
$cast->isa("Venus::Kind") and $cast->does("Venus::Role::Mappable")
$cast->isa("Venus::Kind") $cast->does("Venus::Role::Mappable")
Truth table33%1/3
A and B
A= $cast->isa("Venus::Kind")B= $cast->does("Venus::Role::Mappable")
ABresult
0X0
100
111
1062 7 ▶ return ref $code eq 'CODE' ? $cast->all($code) : $cast->count ? true() : false();
Branch: 2 branches
BranchTrueFalseTotal
ref $code eq 'CODE' ? : 7 0 7
$cast->count ? : 0 0 0
1063 }
1064 else {
1065 0 return false();
1066 }
1067 }
1068  
1069 13 ▶sub any ($;$) {
Subroutine any: called CC=7 SCAR=22.7
Pod documented
1070 13 my ($data, $expr) = @_;
1071  
1072 13 my $cast = cast($data);
1073  
1074 13 ▶ my $code = (defined $expr && ref $expr ne 'CODE') ? sub{tv($_[1], $expr)} : $expr;
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
defined $expr && ref $expr ne 'CODE' ? : 5 8 13
Condition66%2/3
defined $expr and ref $expr ne "CODE"
!ll&&!rl&&r
085
MC/DC50%1/2
defined $expr and ref $expr ne "CODE"
defined $expr ref $expr ne "CODE"
Truth table66%2/3
A and B
A= defined $exprB= ref $expr ne "CODE"
ABresult
0X0
100
111
1075  
1076 13 ▶ if ($cast->isa('Venus::Kind') && $cast->does('Venus::Role::Mappable')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($cast->isa('Venus::Kind') and $cast->does('Venus::Role::Mappable')) { } 13 0 13
Condition33%1/3
$cast->isa("Venus::Kind") and $cast->does("Venus::Role::Mappable")
!ll&&!rl&&r
0013
MC/DC0%0/2
$cast->isa("Venus::Kind") and $cast->does("Venus::Role::Mappable")
$cast->isa("Venus::Kind") $cast->does("Venus::Role::Mappable")
Truth table33%1/3
A and B
A= $cast->isa("Venus::Kind")B= $cast->does("Venus::Role::Mappable")
ABresult
0X0
100
111
1077 13 ▶ return ref $code eq 'CODE' ? $cast->any($code) : $cast->count ? true() : false();
Branch: 2 branches
BranchTrueFalseTotal
ref $code eq 'CODE' ? : 13 0 13
$cast->count ? : 0 0 0
1078 }
1079 else {
1080 0 return false();
1081 }
1082 }
1083  
1084 6 ▶sub args ($;$@) {
Subroutine args: called CC=2 SCAR=6.9
Pod documented
1085 6 my ($data, $code, @args) = @_;
1086  
1087 6 require Venus::Args;
1088  
1089 6 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 5 1 6
1090 5 return Venus::Args->new($data);
1091 }
1092  
1093 1 return Venus::Args->new($data)->$code(@args);
1094 }
1095  
1096 10 ▶sub array ($;$@) {
Subroutine array: called CC=2 SCAR=6.9
Pod documented
1097 10 my ($data, $code, @args) = @_;
1098  
1099 10 require Venus::Array;
1100  
1101 10 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 7 3 10
1102 7 return Venus::Array->new($data);
1103 }
1104  
1105 3 return Venus::Array->new($data)->$code(@args);
1106 }
1107  
1108 11 ▶sub arrayref (@) {
Subroutine arrayref: called CC=3 SCAR=11.0
Pod documented
1109 11 my (@args) = @_;
1110  
1111 11 ▶ return @args > 1
Branch: 2 branches
BranchTrueFalseTotal
@args > 1 ? : 1 10 11
ref $args[0] eq 'ARRAY' ? : 8 2 10
1112 ? ([@args])
1113 : ((ref $args[0] eq 'ARRAY') ? ($args[0]) : ([@args]));
1114 }
1115  
1116 6 ▶sub around ($$) {
Subroutine around: called CC=1 SCAR=0.0
Pod documented
1117 6 my ($name, $code) = @_;
1118  
1119 6 my $package = caller;
1120  
1121 6 return space($package, 'around', $name, $code);
1122 }
1123  
1124 3 ▶sub assert ($$) {
Subroutine assert: called CC=1 SCAR=0.0
Pod documented
1125 3 my ($data, $expr) = @_;
1126  
1127 3 require Venus::Assert;
1128  
1129 3 my $assert = Venus::Assert->new->expression($expr);
1130  
1131 3 return $assert->validate($data);
1132 }
1133  
1134 2 ▶sub async ($) {
Subroutine async: called CC=1 SCAR=0.0
Pod documented
1135 2 my ($code) = @_;
1136  
1137 2 require Venus::Process;
1138  
1139 2 return Venus::Process->new->future($code);
1140 }
1141  
1142 1 ▶sub atom (;$) {
Subroutine atom: called CC=1 SCAR=0.0
Pod documented
1143 1 my ($data) = @_;
1144  
1145 1 require Venus::Atom;
1146  
1147 1 return Venus::Atom->new($data);
1148 }
1149  
1150 1 ▶sub await ($;$) {
Subroutine await: called CC=1 SCAR=0.0
Pod documented
1151 1 my ($future, $timeout) = @_;
1152  
1153 1 require Venus::Future;
1154  
1155 1 return $future->wait($timeout);
1156 }
1157  
1158 6 ▶sub before ($$) {
Subroutine before: called CC=1 SCAR=0.0
Pod documented
1159 6 my ($name, $code) = @_;
1160  
1161 6 my $package = caller;
1162  
1163 6 return space($package, 'before', $name, $code);
1164 }
1165  
1166 2 ▶sub bool (;$) {
Subroutine bool: called CC=1 SCAR=0.0
Pod documented
1167 2 my ($data) = @_;
1168  
1169 2 require Venus::Boolean;
1170  
1171 2 return Venus::Boolean->new($data);
1172 }
1173  
1174 2 ▶sub box ($) {
Subroutine box: called CC=1 SCAR=0.0
Pod documented
1175 2 my ($data) = @_;
1176  
1177 2 require Venus::Box;
1178  
1179 2 my $box = Venus::Box->new($data);
1180  
1181 2 return $box;
1182 }
1183  
1184 14 ▶sub call (@) {
Subroutine call: called CC=15 SCAR=32.0
Pod documented
1185 14 my ($data, @args) = @_;
1186 14 my $next = @args;
1187 14 ▶ if ($next && UNIVERSAL::isa($data, 'CODE')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($next and UNIVERSAL::isa($data, "CODE")) 1 13 14
Condition66%2/3
$next and UNIVERSAL::isa($data, "CODE")
!ll&&!rl&&r
0131
MC/DC50%1/2
$next and UNIVERSAL::isa($data, "CODE")
$next UNIVERSAL::isa($data, "CODE")
Truth table66%2/3
A and B
A= $nextB= UNIVERSAL::isa($data, "CODE")
ABresult
0X0
100
111
1188 1 return $data->(@args);
1189 }
1190 13 my $code = shift(@args);
1191 13 ▶ if ($next && Scalar::Util::blessed($data)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($next and builtin::blessed($data)) 3 10 13
Condition66%2/3
$next and builtin::blessed($data)
!ll&&!rl&&r
0103
MC/DC50%1/2
$next and builtin::blessed($data)
$next builtin::blessed($data)
Truth table66%2/3
A and B
A= $nextB= builtin::blessed($data)
ABresult
0X0
100
111
1192 3 ▶ return $data->$code(@args) if UNIVERSAL::can($data, $code)
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::can($data, $code) or UNIVERSAL::can($data, "AUTOLOAD") 3 0 3
Condition66%2/3
UNIVERSAL::can($data, $code) or UNIVERSAL::can($data, "AUTOLOAD")
l!l&&r!l&&!r
210
MC/DC0%0/2
UNIVERSAL::can($data, $code) or UNIVERSAL::can($data, "AUTOLOAD")
UNIVERSAL::can($data, $code) UNIVERSAL::can($data, "AUTOLOAD")
Truth table66%2/3
A or B
A= UNIVERSAL::can($data, $code)B= UNIVERSAL::can($data, "AUTOLOAD")
ABresult
1X1
011
000
1193 || UNIVERSAL::can($data, 'AUTOLOAD');
1194 0 $next = 0;
1195 }
1196 10 ▶ if ($next && ref($data) eq 'SCALAR') {
Branch: 1 branch
BranchTrueFalseTotal
if ($next and ref $data eq "SCALAR") 2 8 10
Condition66%2/3
$next and ref $data eq "SCALAR"
!ll&&!rl&&r
082
MC/DC50%1/2
$next and ref $data eq "SCALAR"
$next ref $data eq "SCALAR"
Truth table66%2/3
A and B
A= $nextB= ref $data eq "SCALAR"
ABresult
0X0
100
111
1197 2 ▶ return $$data->$code(@args) if UNIVERSAL::can(load($$data)->package, $code);
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::can(&load($$data)->package, $code) 2 0 2
1198 0 $next = 0;
1199 }
1200 8 ▶ if ($next && UNIVERSAL::can(load($data)->package, $code)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($next and UNIVERSAL::can(&load($data)->package, $code)) 8 0 8
Condition33%1/3
$next and UNIVERSAL::can(&load($data)->package, $code)
!ll&&!rl&&r
008
MC/DC0%0/2
$next and UNIVERSAL::can(&load($data)->package, $code)
$next UNIVERSAL::can(&load($data)->package, $code)
Truth table33%1/3
A and B
A= $nextB= UNIVERSAL::can(&load($data)->package, $code)
ABresult
0X0
100
111
1201 120 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
1202 8 return *{"${data}::${code}"}{"CODE"} ?
1203 8 ▶ &{"${data}::${code}"}(@args) : $data->$code(@args[1..$#args]);
Branch: 1 branch
BranchTrueFalseTotal
*{"${data}::$code";}{'CODE'} ? : 6 2 8
1204 }
1205 0 ▶ if ($next && UNIVERSAL::can($data, 'AUTOLOAD')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($next and UNIVERSAL::can($data, "AUTOLOAD")) 0 0 0
Condition0%0/3
$next and UNIVERSAL::can($data, "AUTOLOAD")
!ll&&!rl&&r
000
MC/DC0%0/2
$next and UNIVERSAL::can($data, "AUTOLOAD")
$next UNIVERSAL::can($data, "AUTOLOAD")
Truth table0%0/3
A and B
A= $nextB= UNIVERSAL::can($data, "AUTOLOAD")
ABresult
0X0
100
111
1206 120 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
1207 0 return &{"${data}::${code}"}(@args);
1208 }
1209 0 fault("Exception! call(@{[join(', ', map qq('$_'), @_)]}) failed.");
1210 }
1211  
1212 38 ▶sub cast (;$$) {
Subroutine cast: called CC=3 SCAR=11.0
Pod documented
1213 38 ▶ my ($data, $into) = (@_ ? (@_) : ($_));
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 35 3 38
1214  
1215 38 require Venus::What;
1216  
1217 38 my $what = Venus::What->new($data);
1218  
1219 38 ▶ return $into ? $what->cast($into) : $what->deduce;
Branch: 1 branch
BranchTrueFalseTotal
$into ? : 0 38 38
1220 }
1221  
1222 197 ▶sub catch (&) {
Subroutine catch: called CC=3 SCAR=11.0
Pod documented
1223 197 my ($data) = @_;
1224  
1225 197 my $error;
1226  
1227 197 require Venus::Try;
1228  
1229 197 my @result = Venus::Try->new($data)->error(\$error)->result;
1230  
1231 197 ▶ return wantarray ? ($error ? ($error, undef) : ($error, @result)) : $error;
Branch: 2 branches
BranchTrueFalseTotal
wantarray ? : 153 44 197
$error ? : 152 1 153
1232 }
1233  
1234 10 ▶sub caught ($$;&) {
Subroutine caught: called CC=11 SCAR=25.2
Pod documented
1235 10 my ($data, $type, $code) = @_;
1236  
1237 10 require Scalar::Util;
1238  
1239 10 ▶ ($type, my($name)) = @$type if ref $type eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $type eq "ARRAY" 6 4 10
1240  
1241 10 ▶ my $is_true = $data
Branch: 1 branch
BranchTrueFalseTotal
$data->name ? : 4 3 7
Condition56%9/16
$data && builtin::blessed($data) && $data->isa('Venus::Error') && $data->isa($type || 'Venus::Error') && ($data->name ? $data->of($name || '') : !$name)
!ll&&!rl&&r
316
$data and builtin::blessed($data) and $data->isa("Venus::Error") and $data->isa($type || "Venus::Error")
!ll&&!rl&&r
037
$data and builtin::blessed($data) and $data->isa("Venus::Error")
!ll&&!rl&&r
0010
$data and builtin::blessed($data)
!ll&&!rl&&r
0010
$type || 'Venus::Error'
l!l
100
$name || ''
l!l
40
MC/DC40%2/5
$data && builtin::blessed($data) && $data->isa('Venus::Error') && $data->isa($type || 'Venus::Error') && ($data->name ? $data->of($name || '') : !$name)
$data builtin::blessed($data) $data->isa("Venus::Error") $data->isa($type || "Venus::Error") ($data->name ? $data->of($name || '') : !$name)
MC/DC0%0/1
$type || 'Venus::Error'
$type
MC/DC0%0/1
$name || ''
$name
Truth table50%3/6
A and B and C and D && E
A= $dataB= builtin::blessed($data)C= $data->isa("Venus::Error")D= $data->isa($type || "Venus::Error")E= ($data->name ? $data->of($name || '') : !$name)
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
Truth table50%1/2
A
A= $type
Aresult
11
00
Truth table50%1/2
A
A= $name
Aresult
11
00
1242 && Scalar::Util::blessed($data)
1243 && $data->isa('Venus::Error')
1244 && $data->isa($type || 'Venus::Error')
1245 && ($data->name ? $data->of($name || '') : !$name);
1246  
1247 10 ▶ return undef unless $is_true;
Branch: 1 branch
BranchTrueFalseTotal
unless $is_true 4 6 10
1248  
1249 6 local $_ = $data;
1250 6 ▶ return $code ? $code->($data) : $data;
Branch: 1 branch
BranchTrueFalseTotal
$code ? : 1 5 6
1251 }
1252  
1253 2 ▶sub chain {
Subroutine chain: called CC=4 SCAR=13.9
Pod documented
1254 2 my ($data, @args) = @_;
1255  
1256 2 ▶ return if !$data;
Branch: 1 branch
BranchTrueFalseTotal
unless $data 0 2 2
1257  
1258 2 ▶ for my $next (map +(ref($_) eq 'ARRAY' ? $_ : [$_]), @args) {
Branch: 1 branch
BranchTrueFalseTotal
ref $_ eq 'ARRAY' ? : 3 1 4
1259 4 $data = call($data, @$next);
1260 }
1261  
1262 2 return $data;
1263 }
1264  
1265 81 ▶sub check ($$) {
Subroutine check: called CC=1 SCAR=0.0
Pod documented
1266 81 my ($data, $expr) = @_;
1267  
1268 81 require Venus::Assert;
1269  
1270 81 return Venus::Assert->new->expression($expr)->valid($data);
1271 }
1272  
1273 5 ▶sub clargs (@) {
Subroutine clargs: called CC=3 SCAR=11.0
Pod documented
1274 5 my (@args) = @_;
1275  
1276 5 ▶ my ($argv, $specs) = (@args > 1) ? (map arrayref($_), @args) : ([@ARGV], arrayref(@args));
Branch: 1 branch
BranchTrueFalseTotal
@args > 1 ? : 3 2 5
1277  
1278 5 my $opts = opts($argv, 'reparse', $specs);
1279  
1280 5 ▶ return wantarray ? (args($opts->unused), $opts, vars({})) : $opts;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 4 1 5
1281 }
1282  
1283 2 ▶sub cli (;$) {
Subroutine cli: called CC=1 SCAR=0.0
Pod documented
1284 2 my ($data) = @_;
1285  
1286 2 require Venus::Cli;
1287  
1288 2 my $cli = Venus::Cli->new($data);
1289  
1290 2 return $cli;
1291 }
1292  
1293 78 ▶sub clone ($) {
Subroutine clone: called CC=6 SCAR=21.2
Pod documented
1294 78 my ($data) = @_;
1295  
1296 78 require Storable;
1297 78 require Scalar::Util;
1298  
1299 78 local $Storable::Deparse = 1;
1300  
1301 78 local $Storable::Eval = 1;
1302  
1303 78 ▶ return $data if !ref $data;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $data 12 66 78
1304  
1305 66 ▶ return Scalar::Util::blessed($data)
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($data) && $data->isa('Venus::Core') && ($data->DOES('Venus::Role::Encaseable') || $data->DOES('Venus::Role::Reflectable')) ? : 0 66 66
Condition22%2/9
builtin::blessed($data) and $data->isa("Venus::Core") and $data->DOES("Venus::Role::Encaseable") || $data->DOES("Venus::Role::Reflectable")
!ll&&!rl&&r
6600
builtin::blessed($data) and $data->isa("Venus::Core")
!ll&&!rl&&r
6600
$data->DOES("Venus::Role::Encaseable") or $data->DOES("Venus::Role::Reflectable")
l!l&&r!l&&!r
000
MC/DC0%0/4
builtin::blessed($data) and $data->isa("Venus::Core") and $data->DOES("Venus::Role::Encaseable") || $data->DOES("Venus::Role::Reflectable")
builtin::blessed($data) $data->isa("Venus::Core") $data->DOES("Venus::Role::Encaseable") $data->DOES("Venus::Role::Reflectable")
Truth table20%1/5
A and B and C or D
A= builtin::blessed($data)B= $data->isa("Venus::Core")C= $data->DOES("Venus::Role::Encaseable")D= $data->DOES("Venus::Role::Reflectable")
ABCDresult
0XXX0
10XX0
11000
111X1
11011
1306 && $data->isa('Venus::Core')
1307 && ($data->DOES('Venus::Role::Encaseable') || $data->DOES('Venus::Role::Reflectable'))
1308 ? $data->clone
1309 : Storable::dclone($data);
1310 }
1311  
1312 2 ▶sub code ($;$@) {
Subroutine code: called CC=2 SCAR=6.9
Pod documented
1313 2 my ($data, $code, @args) = @_;
1314  
1315 2 require Venus::Code;
1316  
1317 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
1318 1 return Venus::Code->new($data);
1319 }
1320  
1321 1 return Venus::Code->new($data)->$code(@args);
1322 }
1323  
1324 2 ▶sub config ($;$@) {
Subroutine config: called CC=2 SCAR=6.9
Pod documented
1325 2 my ($data, $code, @args) = @_;
1326  
1327 2 require Venus::Config;
1328  
1329 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
1330 1 return Venus::Config->new($data);
1331 }
1332  
1333 1 return Venus::Config->new($data)->$code(@args);
1334 }
1335  
1336 5 ▶sub concat (@) {
Subroutine concat: called CC=1 SCAR=0.0
Pod documented
1337 5 my (@args) = @_;
1338  
1339 5 require Venus::Log;
1340  
1341 5 return Venus::Log->new->output(@args);
1342 }
1343  
1344 4 ▶sub collect ($;$) {
Subroutine collect: called CC=1 SCAR=0.0
Pod documented
1345 4 my ($data, $code) = @_;
1346  
1347 4 require Venus::Collect;
1348  
1349 4 return Venus::Collect->new(value => $data)->execute($code);
1350 }
1351  
1352 2 ▶sub cop (@) {
Subroutine cop: called CC=3 SCAR=11.0
Pod documented
1353 2 my ($data, @args) = @_;
1354  
1355 2 require Scalar::Util;
1356  
1357 ($data, $args[0]) = map {
1358 2 ▶ ref eq 'SCALAR' ? $$_ : Scalar::Util::blessed($_) ? ref($_) : $_
Branch: 2 branches
BranchTrueFalseTotal
ref $_ eq 'SCALAR' ? : 0 4 4
builtin::blessed($_) ? : 1 3 4
1359 } ($data, $args[0]);
1360  
1361 2 return space("$data")->cop(@args);
1362 }
1363  
1364 4 ▶sub data ($;$@) {
Subroutine data: called CC=2 SCAR=6.9
Pod documented
1365 4 my ($data, $code, @args) = @_;
1366  
1367 4 require Venus::Data;
1368  
1369 4 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 3 4
1370 1 return Venus::Data->new($data);
1371 }
1372  
1373 3 return Venus::Data->new($data)->$code(@args);
1374 }
1375  
1376 3 ▶sub date ($;$@) {
Subroutine date: called CC=2 SCAR=6.9
Pod documented
1377 3 my ($data, $code, @args) = @_;
1378  
1379 3 require Venus::Date;
1380  
1381 3 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 2 3
1382 1 return Venus::Date->new($data);
1383 }
1384  
1385 2 return Venus::Date->new($data)->$code(@args);
1386 }
1387  
1388 2 ▶sub enum {
Subroutine enum: called CC=1 SCAR=0.0
Pod documented
1389 2 my (@data) = @_;
1390  
1391 2 require Venus::Enum;
1392  
1393 2 return Venus::Enum->new(@data);
1394 }
1395  
1396 179 ▶sub error (;$) {
Subroutine error: called CC=3 SCAR=11.2
Pod documented
1397 179 my ($data) = @_;
1398  
1399 179 ▶ $data ||= {};
Condition100%2/2
$data ||= {}
l!l
6173
MC/DC100%1/1
$data ||= {}
$data
Truth table100%2/2
A
A= $data
Aresult
11
00
1400 179 ▶ $data->{context} ||= (caller(1))[3];
Condition33%1/3
$data->{"context"} ||= (caller 1)[3]
l!l&&r!l&&!r
01790
MC/DC0%0/2
$data->{"context"} ||= (caller 1)[3]
$data->{"context"} (caller 1)[3]
Truth table33%1/3
A ||= B
A= $data->{"context"}B= (caller 1)[3]
ABresult
1X1
011
000
1401  
1402 179 require Venus::Throw;
1403  
1404 179 return Venus::Throw->new->die($data);
1405 }
1406  
1407 2 ▶sub factory ($;$@) {
Subroutine factory: called CC=2 SCAR=6.9
Pod documented
1408 2 my ($data, $code, @args) = @_;
1409  
1410 2 require Venus::Factory;
1411  
1412 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
1413 1 return Venus::Factory->new($data);
1414 }
1415  
1416 1 return Venus::Factory->new($data)->$code(@args);
1417 }
1418  
1419 12682 ▶sub false () {
Subroutine false: called CC=1 SCAR=0.0
Pod documented
1420  
1421 12682 require Venus::False;
1422  
1423 12682 return Venus::False->value;
1424 }
1425  
1426 35 ▶sub fault (;$) {
Subroutine fault: called CC=1 SCAR=0.0
Pod documented
1427 35 my ($data) = @_;
1428  
1429 35 require Venus::Fault;
1430  
1431 35 return Venus::Fault->new($data)->throw;
1432 }
1433  
1434 244 ▶sub flat {
Subroutine flat: called CC=3 SCAR=11.0
Pod documented
1435 244 my @args = @_;
1436  
1437 return (
1438 244 ▶ map +(ref $_ eq 'HASH' ? flat(%$_) : (ref $_ eq 'ARRAY' ? flat(@$_) : $_)), @args,
Branch: 2 branches
BranchTrueFalseTotal
ref $_ eq 'HASH' ? : 1 1121 1122
ref $_ eq 'ARRAY' ? : 2 1119 1121
1439 );
1440 }
1441  
1442 2 ▶sub float ($;$@) {
Subroutine float: called CC=2 SCAR=6.9
Pod documented
1443 2 my ($data, $code, @args) = @_;
1444  
1445 2 require Venus::Float;
1446  
1447 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
1448 1 return Venus::Float->new($data);
1449 }
1450  
1451 1 return Venus::Float->new($data)->$code(@args);
1452 }
1453  
1454 1 ▶sub future {
Subroutine future: called CC=1 SCAR=0.0
Pod documented
1455 1 my (@data) = @_;
1456  
1457 1 require Venus::Future;
1458  
1459 1 return Venus::Future->new(@data);
1460 }
1461  
1462 5 ▶sub gather ($;&) {
Subroutine gather: called CC=3 SCAR=11.0
Pod documented
1463 5 my ($data, $code) = @_;
1464  
1465 5 require Venus::Gather;
1466  
1467 5 my $match = Venus::Gather->new($data);
1468  
1469 5 ▶ return $match if !$code;
Branch: 1 branch
BranchTrueFalseTotal
unless $code 1 4 5
1470  
1471 4 local $_ = $match;
1472  
1473 4 my $returned = $code->($match, $data);
1474  
1475 4 ▶ $match->data($returned) if ref $returned eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $returned eq "HASH" 2 2 4
1476  
1477 4 return $match->result;
1478 }
1479  
1480 4 ▶sub gets ($;@) {
Subroutine gets: called CC=4 SCAR=13.9
Pod documented
1481 4 my ($data, @args) = @_;
1482  
1483 4 $data = cast($data);
1484  
1485 4 my $result = [];
1486  
1487 4 ▶ if ($data->isa('Venus::Hash')) {
Branch: 2 branches
BranchTrueFalseTotal
if ($data->isa('Venus::Hash')) { } 2 2 4
elsif ($data->isa('Venus::Array')) { } 2 0 2
1488 2 $result = $data->gets(@args);
1489 }
1490 elsif ($data->isa('Venus::Array')) {
1491 2 $result = $data->gets(@args);
1492 }
1493  
1494 4 ▶ return wantarray ? (@{$result}) : $result;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 2 4
1495 }
1496  
1497 7 ▶sub handle ($$) {
Subroutine handle: called CC=1 SCAR=0.0
Pod documented
1498 7 my ($name, $code) = @_;
1499  
1500 7 my $package = caller;
1501  
1502 7 return space($package, 'handle', $name, $code);
1503 }
1504  
1505 2 ▶sub hash ($;$@) {
Subroutine hash: called CC=2 SCAR=6.9
Pod documented
1506 2 my ($data, $code, @args) = @_;
1507  
1508 2 require Venus::Hash;
1509  
1510 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
1511 1 return Venus::Hash->new($data);
1512 }
1513  
1514 1 return Venus::Hash->new($data)->$code(@args);
1515 }
1516  
1517 4 ▶sub hashref (@) {
Subroutine hashref: called CC=5 SCAR=16.1
Pod documented
1518 4 my (@args) = @_;
1519  
1520 4 ▶ return @args > 1
Branch: 4 branches
BranchTrueFalseTotal
@args > 1 ? : 2 2 4
scalar(@args) % 2 ? : 1 1 2
ref $args[0] eq 'HASH' ? : 1 1 2
scalar(@args) % 2 ? : 1 0 1
1521 ? ({(scalar(@args) % 2) ? (@args, undef) : @args})
1522 : ((ref $args[0] eq 'HASH')
1523 ? ($args[0])
1524 : ({(scalar(@args) % 2) ? (@args, undef) : @args}));
1525 }
1526  
1527 6 ▶sub hook ($$$) {
Subroutine hook: called CC=1 SCAR=0.0
Pod documented
1528 6 my ($type, $name, $code) = @_;
1529  
1530 6 my $package = caller;
1531  
1532 6 return space($package, 'hook', $type, $name, $code);
1533 }
1534  
1535 6 ▶sub in ($$) {
Subroutine in: called CC=1 SCAR=0.0
Pod documented
1536 6 my ($lvalue, $rvalue) = @_;
1537  
1538 6 ▶ return any($lvalue, sub{tv($rvalue, $_)});
Subroutine __ANON__: called CC=1 SCAR=0.0
1539 }
1540  
1541 2 ▶sub is_arrayref ($) {
Subroutine is_arrayref: called CC=1 SCAR=0.0
Pod undocumented
1542 2 my ($data) = @_;
1543  
1544 2 return check($data, 'arrayref');
1545 }
1546  
1547 4 ▶sub is_blessed ($) {
Subroutine is_blessed: called CC=1 SCAR=0.0
Pod documented
1548 4 my ($data) = @_;
1549  
1550 4 return check($data, 'object');
1551 }
1552  
1553 4 ▶sub is_boolean ($) {
Subroutine is_boolean: called CC=1 SCAR=0.0
Pod documented
1554 4 my ($data) = @_;
1555  
1556 4 return check($data, 'boolean');
1557 }
1558  
1559 5 ▶sub is_coderef ($) {
Subroutine is_coderef: called CC=1 SCAR=0.0
Pod documented
1560 5 my ($data) = @_;
1561  
1562 5 return check($data, 'coderef');
1563 }
1564  
1565 4 ▶sub is_dirhandle ($) {
Subroutine is_dirhandle: called CC=1 SCAR=0.0
Pod documented
1566 4 my ($data) = @_;
1567  
1568 4 return check($data, 'dirhandle');
1569 }
1570  
1571 4 ▶sub is_enum ($@) {
Subroutine is_enum: called CC=1 SCAR=0.0
Pod documented
1572 4 my ($data, @args) = @_;
1573  
1574 4 my $enum = sprintf 'enum[%s]', join ', ', map "$_", @args;
1575  
1576 4 return check($data, $enum);
1577 }
1578  
1579 54 ▶sub is_error ($;$@) {
Subroutine is_error: called CC=5 SCAR=16.1
Pod documented
1580 54 my ($data, $code, @args) = @_;
1581  
1582 54 require Scalar::Util;
1583 54 require Venus::Boolean;
1584  
1585 54 ▶ if (Scalar::Util::blessed($data) && $data->isa('Venus::Error')) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($data) and $data->isa('Venus::Error')) { } 50 4 54
Condition100%3/3
builtin::blessed($data) and $data->isa("Venus::Error")
!ll&&!rl&&r
3150
MC/DC100%2/2
builtin::blessed($data) and $data->isa("Venus::Error")
builtin::blessed($data) $data->isa("Venus::Error")
Truth table100%3/3
A and B
A= builtin::blessed($data)B= $data->isa("Venus::Error")
ABresult
0X0
100
111
1586 50 ▶ return $code
Branch: 2 branches
BranchTrueFalseTotal
$code ? : 2 48 50
$data->can($code) ? : 2 0 2
1587 ? ($data->can($code)
1588 ? Venus::Boolean->new($data->$code(@args))->is_true
1589 : Venus::Boolean->false)
1590 : Venus::Boolean->new($data)->is_true;
1591 }
1592 else {
1593 4 return Venus::Boolean->false;
1594 }
1595 }
1596  
1597 8 ▶sub is_false ($;$@) {
Subroutine is_false: called CC=3 SCAR=11.0
Pod documented
1598 8 my ($data, $code, @args) = @_;
1599  
1600 8 require Scalar::Util;
1601 8 require Venus::Boolean;
1602  
1603 8 ▶ if (Scalar::Util::blessed($data) && $code) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($data) and $code) { } 2 6 8
Condition100%3/3
builtin::blessed($data) and $code
!ll&&!rl&&r
512
MC/DC100%2/2
builtin::blessed($data) and $code
builtin::blessed($data) $code
Truth table100%3/3
A and B
A= builtin::blessed($data)B= $code
ABresult
0X0
100
111
1604 2 return Venus::Boolean->new($data->$code(@args))->is_false;
1605 }
1606 else {
1607 6 return Venus::Boolean->new($data)->is_false;
1608 }
1609 }
1610  
1611 6 ▶sub is_fault ($;$@) {
Subroutine is_fault: called CC=3 SCAR=11.0
Pod documented
1612 6 my ($data, $code, @args) = @_;
1613  
1614 6 require Scalar::Util;
1615 6 require Venus::Boolean;
1616  
1617 6 ▶ if (Scalar::Util::blessed($data) && $data->isa('Venus::Fault')) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($data) and $data->isa('Venus::Fault')) { } 2 4 6
Condition100%3/3
builtin::blessed($data) and $data->isa("Venus::Fault")
!ll&&!rl&&r
312
MC/DC100%2/2
builtin::blessed($data) and $data->isa("Venus::Fault")
builtin::blessed($data) $data->isa("Venus::Fault")
Truth table100%3/3
A and B
A= builtin::blessed($data)B= $data->isa("Venus::Fault")
ABresult
0X0
100
111
1618 2 return Venus::Boolean->true;
1619 }
1620 else {
1621 4 return Venus::Boolean->false;
1622 }
1623 }
1624  
1625 4 ▶sub is_filehandle ($) {
Subroutine is_filehandle: called CC=1 SCAR=0.0
Pod documented
1626 4 my ($data) = @_;
1627  
1628 4 return check($data, 'filehandle');
1629 }
1630  
1631 4 ▶sub is_float ($) {
Subroutine is_float: called CC=1 SCAR=0.0
Pod documented
1632 4 my ($data) = @_;
1633  
1634 4 return check($data, 'float');
1635 }
1636  
1637 4 ▶sub is_glob ($) {
Subroutine is_glob: called CC=1 SCAR=0.0
Pod documented
1638 4 my ($data) = @_;
1639  
1640 4 return check($data, 'glob');
1641 }
1642  
1643 4 ▶sub is_hashref ($) {
Subroutine is_hashref: called CC=1 SCAR=0.0
Pod documented
1644 4 my ($data) = @_;
1645  
1646 4 return check($data, 'hashref');
1647 }
1648  
1649 4 ▶sub is_number ($) {
Subroutine is_number: called CC=1 SCAR=0.0
Pod documented
1650 4 my ($data) = @_;
1651  
1652 4 return check($data, 'number');
1653 }
1654  
1655 4 ▶sub is_object ($) {
Subroutine is_object: called CC=1 SCAR=0.0
Pod documented
1656 4 my ($data) = @_;
1657  
1658 4 return check($data, 'object');
1659 }
1660  
1661 4 ▶sub is_package ($) {
Subroutine is_package: called CC=1 SCAR=0.0
Pod documented
1662 4 my ($data) = @_;
1663  
1664 4 return check($data, 'package');
1665 }
1666  
1667 4 ▶sub is_reference ($) {
Subroutine is_reference: called CC=1 SCAR=0.0
Pod documented
1668 4 my ($data) = @_;
1669  
1670 4 return check($data, 'reference');
1671 }
1672  
1673 4 ▶sub is_regexp ($) {
Subroutine is_regexp: called CC=1 SCAR=0.0
Pod documented
1674 4 my ($data) = @_;
1675  
1676 4 return check($data, 'regexp');
1677 }
1678  
1679 4 ▶sub is_scalarref ($) {
Subroutine is_scalarref: called CC=1 SCAR=0.0
Pod documented
1680 4 my ($data) = @_;
1681  
1682 4 return check($data, 'scalarref');
1683 }
1684  
1685 4 ▶sub is_string ($) {
Subroutine is_string: called CC=1 SCAR=0.0
Pod documented
1686 4 my ($data) = @_;
1687  
1688 4 return check($data, 'string');
1689 }
1690  
1691 8 ▶sub is_true ($;$@) {
Subroutine is_true: called CC=3 SCAR=11.0
Pod documented
1692 8 my ($data, $code, @args) = @_;
1693  
1694 8 require Scalar::Util;
1695 8 require Venus::Boolean;
1696  
1697 8 ▶ if (Scalar::Util::blessed($data) && $code) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($data) and $code) { } 2 6 8
Condition100%3/3
builtin::blessed($data) and $code
!ll&&!rl&&r
512
MC/DC100%2/2
builtin::blessed($data) and $code
builtin::blessed($data) $code
Truth table100%3/3
A and B
A= builtin::blessed($data)B= $code
ABresult
0X0
100
111
1698 2 return Venus::Boolean->new($data->$code(@args))->is_true;
1699 }
1700 else {
1701 6 return Venus::Boolean->new($data)->is_true;
1702 }
1703 }
1704  
1705 4 ▶sub is_undef ($) {
Subroutine is_undef: called CC=1 SCAR=0.0
Pod documented
1706 4 my ($data) = @_;
1707  
1708 4 return check($data, 'undef');
1709 }
1710  
1711 4 ▶sub is_value ($) {
Subroutine is_value: called CC=1 SCAR=0.0
Pod documented
1712 4 my ($data) = @_;
1713  
1714 4 return check($data, 'value');
1715 }
1716  
1717 4 ▶sub is_yesno ($) {
Subroutine is_yesno: called CC=1 SCAR=0.0
Pod documented
1718 4 my ($data) = @_;
1719  
1720 4 return check($data, 'yesno');
1721 }
1722  
1723 53 ▶sub is ($$) {
Subroutine is: called CC=4 SCAR=13.9
Pod documented
1724 53 my ($lvalue, $rvalue) = @_;
1725  
1726 53 require Scalar::Util;
1727  
1728 53 ▶ if (ref($lvalue) && ref($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue and ref $rvalue) { } 15 38 53
Condition100%3/3
ref $lvalue and ref $rvalue
!ll&&!rl&&r
36215
MC/DC100%2/2
ref $lvalue and ref $rvalue
ref $lvalue ref $rvalue
Truth table100%3/3
A and B
A= ref $lvalueB= ref $rvalue
ABresult
0X0
100
111
1729 15 ▶ return Scalar::Util::refaddr($lvalue) == Scalar::Util::refaddr($rvalue) ? true() : false();
Branch: 1 branch
BranchTrueFalseTotal
builtin::refaddr($lvalue) == builtin::refaddr($rvalue) ? : 2 13 15
1730 }
1731 else {
1732 38 return false();
1733 }
1734 }
1735  
1736 4 ▶sub json (;$$) {
Subroutine json: called CC=4 SCAR=13.9
Pod documented
1737 4 my ($code, $data) = @_;
1738  
1739 4 require Venus::Json;
1740  
1741 4 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 3 4
1742 1 return Venus::Json->new;
1743 }
1744  
1745 3 ▶ if (lc($code) eq 'decode') {
Branch: 1 branch
BranchTrueFalseTotal
if (lc $code eq "decode") 1 2 3
1746 1 return Venus::Json->new->decode($data);
1747 }
1748  
1749 2 ▶ if (lc($code) eq 'encode') {
Branch: 1 branch
BranchTrueFalseTotal
if (lc $code eq "encode") 1 1 2
1750 1 return Venus::Json->new(value => $data)->encode;
1751 }
1752  
1753 1 return fault(qq(Invalid "json" action "$code"));
1754 }
1755  
1756 20 ▶sub kvargs {
Subroutine kvargs: called CC=4 SCAR=13.9
Pod documented
1757 20 my (@args) = @_;
1758  
1759 20 ▶ return $args[0] if @args == 1 && ref($args[0]) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if @args == 1 and ref $args[0] eq "HASH" 5 15 20
Condition66%2/3
@args == 1 and ref $args[0] eq "HASH"
!ll&&!rl&&r
1505
MC/DC50%1/2
@args == 1 and ref $args[0] eq "HASH"
@args == 1 ref $args[0] eq "HASH"
Truth table66%2/3
A and B
A= @args == 1B= ref $args[0] eq "HASH"
ABresult
0X0
100
111
1760  
1761 15 ▶ return (@args % 2) ? {@args, undef} : {@args};
Branch: 1 branch
BranchTrueFalseTotal
@args % 2 ? : 1 14 15
1762 }
1763  
1764 430 ▶sub list (@) {
Subroutine list: called CC=3 SCAR=11.0
Pod documented
1765 430 my (@args) = @_;
1766  
1767 430 ▶ return map {defined $_ ? (ref eq 'ARRAY' ? (@{$_}) : ($_)) : ($_)} @args;
Branch: 2 branches
BranchTrueFalseTotal
defined $_ ? : 518 0 518
ref $_ eq 'ARRAY' ? : 176 342 518
1768 }
1769  
1770 11 ▶sub load ($) {
Subroutine load: called CC=1 SCAR=0.0
Pod documented
1771 11 my ($data) = @_;
1772  
1773 11 return space($data)->do('load');
1774 }
1775  
1776 1 ▶sub log (@) {
Subroutine log: called CC=4 SCAR=16.1
Pod documented
1777 1 my (@args) = @_;
1778  
1779 1 state $codes = {
1780 debug => 'debug',
1781 error => 'error',
1782 fatal => 'fatal',
1783 info => 'info',
1784 trace => 'trace',
1785 warn => 'warn',
1786 };
1787  
1788 1 ▶ unshift @args, 'debug' if @args && !$codes->{$args[0]};
Branch: 1 branch
BranchTrueFalseTotal
if @args and not $$codes{$args[0]} 0 1 1
Condition33%1/3
@args and not $$codes{$args[0]}
!ll&&!rl&&r
100
MC/DC0%0/2
@args and not $$codes{$args[0]}
@args not $$codes{$args[0]}
Truth table33%1/3
A and not(B)
A= @argsB= not $$codes{$args[0]}
ABresult
0X0
100
111
1789  
1790 1 require Venus::Log;
1791  
1792 1 my $log = Venus::Log->new($ENV{VENUS_LOG_LEVEL});
1793  
1794 1 ▶ return $log if !@args;
Branch: 1 branch
BranchTrueFalseTotal
unless @args 1 0 1
1795  
1796 0 my $code = shift @args;
1797  
1798 0 return $log->$code(@args);
1799 }
1800  
1801 4 ▶sub make (@) {
Subroutine make: called CC=2 SCAR=7.2
Pod documented
1802  
1803 4 ▶ return if !@_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 4 4
1804  
1805 4 return call($_[0], 'new', @_);
1806 }
1807  
1808 2 ▶sub map ($;$@) {
Subroutine map: called CC=2 SCAR=6.9
Pod documented
1809 2 my ($data, $code, @args) = @_;
1810  
1811 2 require Venus::Map;
1812  
1813 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
1814 1 return Venus::Map->new($data);
1815 }
1816  
1817 1 return Venus::Map->new($data)->$code(@args);
1818 }
1819  
1820 6 ▶sub match ($;&) {
Subroutine match: called CC=3 SCAR=11.0
Pod documented
1821 6 my ($data, $code) = @_;
1822  
1823 6 require Venus::Match;
1824  
1825 6 my $match = Venus::Match->new($data);
1826  
1827 6 ▶ return $match if !$code;
Branch: 1 branch
BranchTrueFalseTotal
unless $code 1 5 6
1828  
1829 5 local $_ = $match;
1830  
1831 5 my $returned = $code->($match, $data);
1832  
1833 5 ▶ $match->data($returned) if ref $returned eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $returned eq "HASH" 2 3 5
1834  
1835 5 return $match->result;
1836 }
1837  
1838 5 ▶sub merge {
Subroutine merge: called CC=1 SCAR=0.0
Pod documented
1839 5 my ($lvalue, @rvalues) = @_;
1840  
1841 5 return merge_join($lvalue, @rvalues);
1842 }
1843  
1844 27 ▶sub merge_flat {
Subroutine merge_flat: called CC=21 SCAR=30.7
Pod documented
1845 27 my ($lvalue, @rvalues) = @_;
1846  
1847 27 ▶ return $lvalue if !@rvalues;
Branch: 1 branch
BranchTrueFalseTotal
unless @rvalues 2 25 27
1848  
1849 25 ▶ if (@rvalues > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rvalues > 1) 1 24 25
1850 1 my $result = $lvalue;
1851  
1852 1 $result = merge_flat($result, $_) for @rvalues;
1853  
1854 1 return $result;
1855 }
1856  
1857 24 my $rvalue = $rvalues[0];
1858  
1859 24 ▶ return $rvalue if !ref($lvalue) && !ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $lvalue or ref $rvalue 4 20 24
Condition100%3/3
ref $lvalue or ref $rvalue
l!l&&r!l&&!r
1554
MC/DC100%2/2
ref $lvalue or ref $rvalue
ref $lvalue ref $rvalue
Truth table100%3/3
A or B
A= ref $lvalueB= ref $rvalue
ABresult
1X1
011
000
1860  
1861 20 ▶ return $rvalue if !ref($lvalue) && ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
if not ref $lvalue and ref $rvalue 5 15 20
Condition66%2/3
not ref $lvalue and ref $rvalue
!ll&&!rl&&r
1505
MC/DC50%1/2
not ref $lvalue and ref $rvalue
not ref $lvalue ref $rvalue
Truth table66%2/3
not(A) and B
A= not ref $lvalueB= ref $rvalue
ABresult
0X0
100
111
1862  
1863 15 ▶ if (ref($lvalue) eq 'ARRAY' && !ref($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and not ref $rvalue) 3 12 15
Condition100%3/3
ref $lvalue eq "ARRAY" and not ref $rvalue
!ll&&!rl&&r
753
MC/DC100%2/2
ref $lvalue eq "ARRAY" and not ref $rvalue
ref $lvalue eq "ARRAY" not ref $rvalue
Truth table100%3/3
A and not(B)
A= ref $lvalue eq "ARRAY"B= not ref $rvalue
ABresult
0X0
100
111
1864 3 return [@$lvalue, $rvalue];
1865 }
1866  
1867 12 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY") 2 10 12
Condition100%3/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
!ll&&!rl&&r
732
MC/DC100%2/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
ref $lvalue eq "ARRAY" ref $rvalue eq "ARRAY"
Truth table100%3/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "ARRAY"
ABresult
0X0
100
111
1868 2 return [@$lvalue, @$rvalue];
1869 }
1870  
1871 10 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH") 3 7 10
Condition66%2/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
!ll&&!rl&&r
703
MC/DC50%1/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
ref $lvalue eq "ARRAY" ref $rvalue eq "HASH"
Truth table66%2/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
1872 3 return [@$lvalue, values %$rvalue];
1873 }
1874  
1875 7 ▶ return $rvalue if ref($lvalue) eq 'HASH' && (!ref($rvalue) || ref($rvalue) eq 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY" 2 5 7
Condition83%5/6
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
!ll&&!rl&&r
052
not ref $rvalue or ref $rvalue eq "ARRAY"
l!l&&r!l&&!r
115
MC/DC66%2/3
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
ref $lvalue eq "HASH" not ref $rvalue ref $rvalue eq "ARRAY"
Truth table75%3/4
A and not(B) or C
A= ref $lvalue eq "HASH"B= not ref $rvalueC= ref $rvalue eq "ARRAY"
ABCresult
0XX0
1000
11X1
1011
1876  
1877 5 ▶ if (ref($lvalue) eq 'HASH' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "HASH" and ref $rvalue eq "HASH") 5 0 5
Condition33%1/3
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
!ll&&!rl&&r
005
MC/DC0%0/2
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
ref $lvalue eq "HASH" ref $rvalue eq "HASH"
Truth table33%1/3
A and B
A= ref $lvalue eq "HASH"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
1878 5 my $result = {%$lvalue};
1879 5 for my $key (keys %$rvalue) {
1880 14 ▶ $result->{$key} = exists $lvalue->{$key} ? merge_flat($lvalue->{$key}, $rvalue->{$key}) : $rvalue->{$key};
Branch: 1 branch
BranchTrueFalseTotal
exists $lvalue->{$key} ? : 8 6 14
1881 }
1882 5 return $result;
1883 }
1884  
1885 0 return $lvalue;
1886 }
1887  
1888 17 ▶sub merge_flat_mutate {
Subroutine merge_flat_mutate: called CC=21 SCAR=31.1
Pod documented
1889 17 my ($lvalue, @rvalues) = @_;
1890  
1891 17 ▶ return $lvalue if !@rvalues;
Branch: 1 branch
BranchTrueFalseTotal
unless @rvalues 2 15 17
1892  
1893 15 ▶ if (@rvalues > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rvalues > 1) 0 15 15
1894 0 $lvalue = merge_flat_mutate($lvalue, $_) for @rvalues;
1895 0 return $lvalue;
1896 }
1897  
1898 15 my $rvalue = $rvalues[0];
1899  
1900 15 ▶ return $_[0] = $rvalue if !ref($lvalue) && !ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $lvalue or ref $rvalue 3 12 15
Condition100%3/3
ref $lvalue or ref $rvalue
l!l&&r!l&&!r
843
MC/DC100%2/2
ref $lvalue or ref $rvalue
ref $lvalue ref $rvalue
Truth table100%3/3
A or B
A= ref $lvalueB= ref $rvalue
ABresult
1X1
011
000
1901  
1902 12 ▶ return $_[0] = $rvalue if !ref($lvalue) && ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
if not ref $lvalue and ref $rvalue 4 8 12
Condition66%2/3
not ref $lvalue and ref $rvalue
!ll&&!rl&&r
804
MC/DC50%1/2
not ref $lvalue and ref $rvalue
not ref $lvalue ref $rvalue
Truth table66%2/3
not(A) and B
A= not ref $lvalueB= ref $rvalue
ABresult
0X0
100
111
1903  
1904 8 ▶ if (ref($lvalue) eq 'ARRAY' && !ref($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and not ref $rvalue) 2 6 8
Condition100%3/3
ref $lvalue eq "ARRAY" and not ref $rvalue
!ll&&!rl&&r
332
MC/DC100%2/2
ref $lvalue eq "ARRAY" and not ref $rvalue
ref $lvalue eq "ARRAY" not ref $rvalue
Truth table100%3/3
A and not(B)
A= ref $lvalue eq "ARRAY"B= not ref $rvalue
ABresult
0X0
100
111
1905 2 push @$lvalue, $rvalue;
1906 2 return $lvalue;
1907 }
1908  
1909 6 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY") 1 5 6
Condition100%3/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
!ll&&!rl&&r
321
MC/DC100%2/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
ref $lvalue eq "ARRAY" ref $rvalue eq "ARRAY"
Truth table100%3/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "ARRAY"
ABresult
0X0
100
111
1910 1 push @$lvalue, @$rvalue;
1911 1 return $lvalue;
1912 }
1913  
1914 5 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH") 2 3 5
Condition66%2/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
!ll&&!rl&&r
302
MC/DC50%1/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
ref $lvalue eq "ARRAY" ref $rvalue eq "HASH"
Truth table66%2/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
1915 2 push @$lvalue, values %$rvalue;
1916 2 return $lvalue;
1917 }
1918  
1919 3 ▶ return $_[0] = $rvalue if ref($lvalue) eq 'HASH' && (!ref($rvalue) || ref($rvalue) eq 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY" 2 1 3
Condition83%5/6
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
!ll&&!rl&&r
012
not ref $rvalue or ref $rvalue eq "ARRAY"
l!l&&r!l&&!r
111
MC/DC66%2/3
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
ref $lvalue eq "HASH" not ref $rvalue ref $rvalue eq "ARRAY"
Truth table75%3/4
A and not(B) or C
A= ref $lvalue eq "HASH"B= not ref $rvalueC= ref $rvalue eq "ARRAY"
ABCresult
0XX0
1000
11X1
1011
1920  
1921 1 ▶ if (ref($lvalue) eq 'HASH' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "HASH" and ref $rvalue eq "HASH") 1 0 1
Condition33%1/3
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
!ll&&!rl&&r
001
MC/DC0%0/2
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
ref $lvalue eq "HASH" ref $rvalue eq "HASH"
Truth table33%1/3
A and B
A= ref $lvalue eq "HASH"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
1922 1 for my $key (keys %$rvalue) {
1923 2 ▶ if (exists $lvalue->{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $lvalue->{$key}) { } 1 1 2
1924 1 merge_flat_mutate($lvalue->{$key}, $rvalue->{$key});
1925 } else {
1926 1 $lvalue->{$key} = $rvalue->{$key};
1927 }
1928 }
1929 1 return $lvalue;
1930 }
1931  
1932 0 return $lvalue;
1933 }
1934  
1935 38 ▶sub merge_join {
Subroutine merge_join: called CC=21 SCAR=30.7
Pod documented
1936 38 my ($lvalue, @rvalues) = @_;
1937  
1938 38 ▶ return $lvalue if !@rvalues;
Branch: 1 branch
BranchTrueFalseTotal
unless @rvalues 2 36 38
1939  
1940 36 ▶ if (@rvalues > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rvalues > 1) 2 34 36
1941 2 my $result = $lvalue;
1942  
1943 2 $result = merge_join($result, $_) for @rvalues;
1944  
1945 2 return $result;
1946 }
1947  
1948 34 my $rvalue = $rvalues[0];
1949  
1950 34 ▶ return $rvalue if !ref($lvalue) && !ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $lvalue or ref $rvalue 5 29 34
Condition100%3/3
ref $lvalue or ref $rvalue
l!l&&r!l&&!r
2545
MC/DC100%2/2
ref $lvalue or ref $rvalue
ref $lvalue ref $rvalue
Truth table100%3/3
A or B
A= ref $lvalueB= ref $rvalue
ABresult
1X1
011
000
1951  
1952 29 ▶ return $rvalue if !ref($lvalue) && ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
if not ref $lvalue and ref $rvalue 4 25 29
Condition66%2/3
not ref $lvalue and ref $rvalue
!ll&&!rl&&r
2504
MC/DC50%1/2
not ref $lvalue and ref $rvalue
not ref $lvalue ref $rvalue
Truth table66%2/3
not(A) and B
A= not ref $lvalueB= ref $rvalue
ABresult
0X0
100
111
1953  
1954 25 ▶ if (ref($lvalue) eq 'ARRAY' && !ref($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and not ref $rvalue) 3 22 25
Condition100%3/3
ref $lvalue eq "ARRAY" and not ref $rvalue
!ll&&!rl&&r
1753
MC/DC100%2/2
ref $lvalue eq "ARRAY" and not ref $rvalue
ref $lvalue eq "ARRAY" not ref $rvalue
Truth table100%3/3
A and not(B)
A= ref $lvalue eq "ARRAY"B= not ref $rvalue
ABresult
0X0
100
111
1955 3 return [@$lvalue, $rvalue];
1956 }
1957  
1958 22 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY") 3 19 22
Condition100%3/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
!ll&&!rl&&r
1723
MC/DC100%2/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
ref $lvalue eq "ARRAY" ref $rvalue eq "ARRAY"
Truth table100%3/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "ARRAY"
ABresult
0X0
100
111
1959 3 return [@$lvalue, @$rvalue];
1960 }
1961  
1962 19 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH") 2 17 19
Condition66%2/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
!ll&&!rl&&r
1702
MC/DC50%1/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
ref $lvalue eq "ARRAY" ref $rvalue eq "HASH"
Truth table66%2/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
1963 2 return [@$lvalue, $rvalue];
1964 }
1965  
1966 17 ▶ return $rvalue if ref($lvalue) eq 'HASH' && (!ref($rvalue) || ref($rvalue) eq 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY" 2 15 17
Condition83%5/6
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
!ll&&!rl&&r
0152
not ref $rvalue or ref $rvalue eq "ARRAY"
l!l&&r!l&&!r
1115
MC/DC66%2/3
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
ref $lvalue eq "HASH" not ref $rvalue ref $rvalue eq "ARRAY"
Truth table75%3/4
A and not(B) or C
A= ref $lvalue eq "HASH"B= not ref $rvalueC= ref $rvalue eq "ARRAY"
ABCresult
0XX0
1000
11X1
1011
1967  
1968 15 ▶ if (ref($lvalue) eq 'HASH' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "HASH" and ref $rvalue eq "HASH") 15 0 15
Condition33%1/3
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
!ll&&!rl&&r
0015
MC/DC0%0/2
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
ref $lvalue eq "HASH" ref $rvalue eq "HASH"
Truth table33%1/3
A and B
A= ref $lvalue eq "HASH"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
1969 15 my $result = {%$lvalue};
1970 15 for my $key (keys %$rvalue) {
1971 27 ▶ $result->{$key} = exists $lvalue->{$key} ? merge_join($lvalue->{$key}, $rvalue->{$key}) : $rvalue->{$key};
Branch: 1 branch
BranchTrueFalseTotal
exists $lvalue->{$key} ? : 12 15 27
1972 }
1973 15 return $result;
1974 }
1975  
1976 0 return $lvalue;
1977 }
1978  
1979 18 ▶sub merge_join_mutate {
Subroutine merge_join_mutate: called CC=21 SCAR=31.1
Pod documented
1980 18 my ($lvalue, @rvalues) = @_;
1981  
1982 18 ▶ return $lvalue if !@rvalues;
Branch: 1 branch
BranchTrueFalseTotal
unless @rvalues 2 16 18
1983  
1984 16 ▶ if (@rvalues > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rvalues > 1) 0 16 16
1985 0 $lvalue = merge_join_mutate($lvalue, $_) for @rvalues;
1986 0 return $lvalue;
1987 }
1988  
1989 16 my $rvalue = $rvalues[0];
1990  
1991 16 ▶ return $_[0] = $rvalue if !ref($lvalue) && !ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $lvalue or ref $rvalue 4 12 16
Condition100%3/3
ref $lvalue or ref $rvalue
l!l&&r!l&&!r
934
MC/DC100%2/2
ref $lvalue or ref $rvalue
ref $lvalue ref $rvalue
Truth table100%3/3
A or B
A= ref $lvalueB= ref $rvalue
ABresult
1X1
011
000
1992  
1993 12 ▶ return $_[0] = $rvalue if !ref($lvalue) && ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
if not ref $lvalue and ref $rvalue 3 9 12
Condition66%2/3
not ref $lvalue and ref $rvalue
!ll&&!rl&&r
903
MC/DC50%1/2
not ref $lvalue and ref $rvalue
not ref $lvalue ref $rvalue
Truth table66%2/3
not(A) and B
A= not ref $lvalueB= ref $rvalue
ABresult
0X0
100
111
1994  
1995 9 ▶ if (ref($lvalue) eq 'ARRAY' && !ref($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and not ref $rvalue) 2 7 9
Condition100%3/3
ref $lvalue eq "ARRAY" and not ref $rvalue
!ll&&!rl&&r
432
MC/DC100%2/2
ref $lvalue eq "ARRAY" and not ref $rvalue
ref $lvalue eq "ARRAY" not ref $rvalue
Truth table100%3/3
A and not(B)
A= ref $lvalue eq "ARRAY"B= not ref $rvalue
ABresult
0X0
100
111
1996 2 push @$lvalue, $rvalue;
1997 2 return $lvalue;
1998 }
1999  
2000 7 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY") 2 5 7
Condition100%3/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
!ll&&!rl&&r
412
MC/DC100%2/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
ref $lvalue eq "ARRAY" ref $rvalue eq "ARRAY"
Truth table100%3/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "ARRAY"
ABresult
0X0
100
111
2001 2 push @$lvalue, @$rvalue;
2002 2 return $lvalue;
2003 }
2004  
2005 5 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH") 1 4 5
Condition66%2/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
!ll&&!rl&&r
401
MC/DC50%1/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
ref $lvalue eq "ARRAY" ref $rvalue eq "HASH"
Truth table66%2/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
2006 1 push @$lvalue, $rvalue;
2007 1 return $lvalue;
2008 }
2009  
2010 4 ▶ return $_[0] = $rvalue if ref($lvalue) eq 'HASH' && (!ref($rvalue) || ref($rvalue) eq 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY" 2 2 4
Condition83%5/6
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
!ll&&!rl&&r
022
not ref $rvalue or ref $rvalue eq "ARRAY"
l!l&&r!l&&!r
112
MC/DC66%2/3
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
ref $lvalue eq "HASH" not ref $rvalue ref $rvalue eq "ARRAY"
Truth table75%3/4
A and not(B) or C
A= ref $lvalue eq "HASH"B= not ref $rvalueC= ref $rvalue eq "ARRAY"
ABCresult
0XX0
1000
11X1
1011
2011  
2012 2 ▶ if (ref($lvalue) eq 'HASH' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "HASH" and ref $rvalue eq "HASH") 2 0 2
Condition33%1/3
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
!ll&&!rl&&r
002
MC/DC0%0/2
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
ref $lvalue eq "HASH" ref $rvalue eq "HASH"
Truth table33%1/3
A and B
A= ref $lvalue eq "HASH"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
2013 2 for my $key (keys %$rvalue) {
2014 4 ▶ if (exists $lvalue->{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $lvalue->{$key}) { } 2 2 4
2015 2 merge_join_mutate($lvalue->{$key}, $rvalue->{$key});
2016 } else {
2017 2 $lvalue->{$key} = $rvalue->{$key};
2018 }
2019 }
2020 2 return $lvalue;
2021 }
2022  
2023 0 return $lvalue;
2024 }
2025  
2026 29 ▶sub merge_keep {
Subroutine merge_keep: called CC=21 SCAR=30.7
Pod documented
2027 29 my ($lvalue, @rvalues) = @_;
2028  
2029 29 ▶ return $lvalue if !@rvalues;
Branch: 1 branch
BranchTrueFalseTotal
unless @rvalues 2 27 29
2030  
2031 27 ▶ if (@rvalues > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rvalues > 1) 1 26 27
2032 1 my $result = $lvalue;
2033  
2034 1 $result = merge_keep($result, $_) for @rvalues;
2035  
2036 1 return $result;
2037 }
2038  
2039 26 my $rvalue = $rvalues[0];
2040  
2041 26 ▶ return $lvalue if !ref($lvalue) && !ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $lvalue or ref $rvalue 6 20 26
Condition100%3/3
ref $lvalue or ref $rvalue
l!l&&r!l&&!r
1646
MC/DC100%2/2
ref $lvalue or ref $rvalue
ref $lvalue ref $rvalue
Truth table100%3/3
A or B
A= ref $lvalueB= ref $rvalue
ABresult
1X1
011
000
2042  
2043 20 ▶ return $lvalue if !ref($lvalue) && ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
if not ref $lvalue and ref $rvalue 4 16 20
Condition66%2/3
not ref $lvalue and ref $rvalue
!ll&&!rl&&r
1604
MC/DC50%1/2
not ref $lvalue and ref $rvalue
not ref $lvalue ref $rvalue
Truth table66%2/3
not(A) and B
A= not ref $lvalueB= ref $rvalue
ABresult
0X0
100
111
2044  
2045 16 ▶ if (ref($lvalue) eq 'ARRAY' && !ref($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and not ref $rvalue) 3 13 16
Condition100%3/3
ref $lvalue eq "ARRAY" and not ref $rvalue
!ll&&!rl&&r
853
MC/DC100%2/2
ref $lvalue eq "ARRAY" and not ref $rvalue
ref $lvalue eq "ARRAY" not ref $rvalue
Truth table100%3/3
A and not(B)
A= ref $lvalue eq "ARRAY"B= not ref $rvalue
ABresult
0X0
100
111
2046 3 return [@$lvalue, $rvalue];
2047 }
2048  
2049 13 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY") 3 10 13
Condition100%3/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
!ll&&!rl&&r
823
MC/DC100%2/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
ref $lvalue eq "ARRAY" ref $rvalue eq "ARRAY"
Truth table100%3/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "ARRAY"
ABresult
0X0
100
111
2050 3 return [@$lvalue, @$rvalue];
2051 }
2052  
2053 10 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH") 2 8 10
Condition66%2/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
!ll&&!rl&&r
802
MC/DC50%1/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
ref $lvalue eq "ARRAY" ref $rvalue eq "HASH"
Truth table66%2/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
2054 2 return [@$lvalue, $rvalue];
2055 }
2056  
2057 8 ▶ return $lvalue if ref($lvalue) eq 'HASH' && (!ref($rvalue) || ref($rvalue) eq 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY" 2 6 8
Condition83%5/6
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
!ll&&!rl&&r
062
not ref $rvalue or ref $rvalue eq "ARRAY"
l!l&&r!l&&!r
116
MC/DC66%2/3
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
ref $lvalue eq "HASH" not ref $rvalue ref $rvalue eq "ARRAY"
Truth table75%3/4
A and not(B) or C
A= ref $lvalue eq "HASH"B= not ref $rvalueC= ref $rvalue eq "ARRAY"
ABCresult
0XX0
1000
11X1
1011
2058  
2059 6 ▶ if (ref($lvalue) eq 'HASH' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "HASH" and ref $rvalue eq "HASH") 6 0 6
Condition33%1/3
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
!ll&&!rl&&r
006
MC/DC0%0/2
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
ref $lvalue eq "HASH" ref $rvalue eq "HASH"
Truth table33%1/3
A and B
A= ref $lvalue eq "HASH"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
2060 6 my $result = {%$lvalue};
2061 6 for my $key (keys %$rvalue) {
2062 17 ▶ $result->{$key} = exists $lvalue->{$key} ? merge_keep($lvalue->{$key}, $rvalue->{$key}) : $rvalue->{$key};
Branch: 1 branch
BranchTrueFalseTotal
exists $lvalue->{$key} ? : 10 7 17
2063 }
2064 6 return $result;
2065 }
2066  
2067 0 return $lvalue;
2068 }
2069  
2070 18 ▶sub merge_keep_mutate {
Subroutine merge_keep_mutate: called CC=21 SCAR=31.1
Pod documented
2071 18 my ($lvalue, @rvalues) = @_;
2072  
2073 18 ▶ return $lvalue if !@rvalues;
Branch: 1 branch
BranchTrueFalseTotal
unless @rvalues 2 16 18
2074  
2075 16 ▶ if (@rvalues > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rvalues > 1) 0 16 16
2076 0 $lvalue = merge_keep_mutate($lvalue, $_) for @rvalues;
2077 0 return $lvalue;
2078 }
2079  
2080 16 my $rvalue = $rvalues[0];
2081  
2082 16 ▶ return $lvalue if !ref($lvalue) && !ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $lvalue or ref $rvalue 4 12 16
Condition100%3/3
ref $lvalue or ref $rvalue
l!l&&r!l&&!r
934
MC/DC100%2/2
ref $lvalue or ref $rvalue
ref $lvalue ref $rvalue
Truth table100%3/3
A or B
A= ref $lvalueB= ref $rvalue
ABresult
1X1
011
000
2083  
2084 12 ▶ return $lvalue if !ref($lvalue) && ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
if not ref $lvalue and ref $rvalue 3 9 12
Condition66%2/3
not ref $lvalue and ref $rvalue
!ll&&!rl&&r
903
MC/DC50%1/2
not ref $lvalue and ref $rvalue
not ref $lvalue ref $rvalue
Truth table66%2/3
not(A) and B
A= not ref $lvalueB= ref $rvalue
ABresult
0X0
100
111
2085  
2086 9 ▶ if (ref($lvalue) eq 'ARRAY' && !ref($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and not ref $rvalue) 2 7 9
Condition100%3/3
ref $lvalue eq "ARRAY" and not ref $rvalue
!ll&&!rl&&r
432
MC/DC100%2/2
ref $lvalue eq "ARRAY" and not ref $rvalue
ref $lvalue eq "ARRAY" not ref $rvalue
Truth table100%3/3
A and not(B)
A= ref $lvalue eq "ARRAY"B= not ref $rvalue
ABresult
0X0
100
111
2087 2 push @$lvalue, $rvalue;
2088 2 return $lvalue;
2089 }
2090  
2091 7 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY") 2 5 7
Condition100%3/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
!ll&&!rl&&r
412
MC/DC100%2/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
ref $lvalue eq "ARRAY" ref $rvalue eq "ARRAY"
Truth table100%3/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "ARRAY"
ABresult
0X0
100
111
2092 2 push @$lvalue, @$rvalue;
2093 2 return $lvalue;
2094 }
2095  
2096 5 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH") 1 4 5
Condition66%2/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
!ll&&!rl&&r
401
MC/DC50%1/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
ref $lvalue eq "ARRAY" ref $rvalue eq "HASH"
Truth table66%2/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
2097 1 push @$lvalue, $rvalue;
2098 1 return $lvalue;
2099 }
2100  
2101 4 ▶ return $lvalue if ref($lvalue) eq 'HASH' && (!ref($rvalue) || ref($rvalue) eq 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY" 2 2 4
Condition83%5/6
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
!ll&&!rl&&r
022
not ref $rvalue or ref $rvalue eq "ARRAY"
l!l&&r!l&&!r
112
MC/DC66%2/3
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
ref $lvalue eq "HASH" not ref $rvalue ref $rvalue eq "ARRAY"
Truth table75%3/4
A and not(B) or C
A= ref $lvalue eq "HASH"B= not ref $rvalueC= ref $rvalue eq "ARRAY"
ABCresult
0XX0
1000
11X1
1011
2102  
2103 2 ▶ if (ref($lvalue) eq 'HASH' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "HASH" and ref $rvalue eq "HASH") 2 0 2
Condition33%1/3
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
!ll&&!rl&&r
002
MC/DC0%0/2
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
ref $lvalue eq "HASH" ref $rvalue eq "HASH"
Truth table33%1/3
A and B
A= ref $lvalue eq "HASH"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
2104 2 for my $key (keys %$rvalue) {
2105 4 ▶ if (!exists $lvalue->{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $lvalue->{$key}) { } 2 2 4
2106 2 $lvalue->{$key} = $rvalue->{$key};
2107 } else {
2108 2 merge_keep_mutate($lvalue->{$key}, $rvalue->{$key});
2109 }
2110 }
2111 2 return $lvalue;
2112 }
2113  
2114 0 return $lvalue;
2115 }
2116  
2117 90 ▶sub merge_swap {
Subroutine merge_swap: called CC=23 SCAR=31.7
Pod documented
2118 90 my ($lvalue, @rvalues) = @_;
2119  
2120 90 ▶ return $lvalue if !@rvalues;
Branch: 1 branch
BranchTrueFalseTotal
unless @rvalues 2 88 90
2121  
2122 88 ▶ if (@rvalues > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rvalues > 1) 2 86 88
2123 2 my $result = $lvalue;
2124  
2125 2 $result = merge_swap($result, $_) for @rvalues;
2126  
2127 2 return $result;
2128 }
2129  
2130 86 my $rvalue = $rvalues[0];
2131  
2132 86 ▶ return $rvalue if !ref($lvalue) && !ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $lvalue or ref $rvalue 11 75 86
Condition100%3/3
ref $lvalue or ref $rvalue
l!l&&r!l&&!r
71411
MC/DC100%2/2
ref $lvalue or ref $rvalue
ref $lvalue ref $rvalue
Truth table100%3/3
A or B
A= ref $lvalueB= ref $rvalue
ABresult
1X1
011
000
2133  
2134 75 ▶ return $rvalue if !ref($lvalue) && ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
if not ref $lvalue and ref $rvalue 4 71 75
Condition66%2/3
not ref $lvalue and ref $rvalue
!ll&&!rl&&r
7104
MC/DC50%1/2
not ref $lvalue and ref $rvalue
not ref $lvalue ref $rvalue
Truth table66%2/3
not(A) and B
A= not ref $lvalueB= ref $rvalue
ABresult
0X0
100
111
2135  
2136 71 ▶ if (ref($lvalue) eq 'ARRAY' && !ref($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and not ref $rvalue) 3 68 71
Condition100%3/3
ref $lvalue eq "ARRAY" and not ref $rvalue
!ll&&!rl&&r
56123
MC/DC100%2/2
ref $lvalue eq "ARRAY" and not ref $rvalue
ref $lvalue eq "ARRAY" not ref $rvalue
Truth table100%3/3
A and not(B)
A= ref $lvalue eq "ARRAY"B= not ref $rvalue
ABresult
0X0
100
111
2137 3 return [@$lvalue, $rvalue];
2138 }
2139  
2140 68 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY") 10 58 68
Condition100%3/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
!ll&&!rl&&r
56210
MC/DC100%2/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
ref $lvalue eq "ARRAY" ref $rvalue eq "ARRAY"
Truth table100%3/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "ARRAY"
ABresult
0X0
100
111
2141 10 my $result = [@$lvalue];
2142 10 for my $i (0..$#$rvalue) {
2143 36 ▶ $result->[$i] = $rvalue->[$i] if exists $rvalue->[$i];
Branch: 1 branch
BranchTrueFalseTotal
if exists $rvalue->[$i] 36 0 36
2144 }
2145 10 return $result;
2146 }
2147  
2148 58 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH") 2 56 58
Condition66%2/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
!ll&&!rl&&r
5602
MC/DC50%1/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
ref $lvalue eq "ARRAY" ref $rvalue eq "HASH"
Truth table66%2/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
2149 2 return [@$lvalue, $rvalue];
2150 }
2151  
2152 56 ▶ return $rvalue if ref($lvalue) eq 'HASH' && (!ref($rvalue) || ref($rvalue) eq 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY" 2 54 56
Condition83%5/6
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
!ll&&!rl&&r
0542
not ref $rvalue or ref $rvalue eq "ARRAY"
l!l&&r!l&&!r
1154
MC/DC66%2/3
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
ref $lvalue eq "HASH" not ref $rvalue ref $rvalue eq "ARRAY"
Truth table75%3/4
A and not(B) or C
A= ref $lvalue eq "HASH"B= not ref $rvalueC= ref $rvalue eq "ARRAY"
ABCresult
0XX0
1000
11X1
1011
2153  
2154 54 ▶ if (ref($lvalue) eq 'HASH' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "HASH" and ref $rvalue eq "HASH") 54 0 54
Condition33%1/3
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
!ll&&!rl&&r
0054
MC/DC0%0/2
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
ref $lvalue eq "HASH" ref $rvalue eq "HASH"
Truth table33%1/3
A and B
A= ref $lvalue eq "HASH"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
2155 54 my $result = {%$lvalue};
2156 54 for my $key (keys %$rvalue) {
2157 112 ▶ $result->{$key} = exists $lvalue->{$key} ? merge_swap($lvalue->{$key}, $rvalue->{$key}) : $rvalue->{$key};
Branch: 1 branch
BranchTrueFalseTotal
exists $lvalue->{$key} ? : 25 87 112
2158 }
2159 54 return $result;
2160 }
2161  
2162 0 return $lvalue;
2163 }
2164  
2165 18 ▶sub merge_swap_mutate {
Subroutine merge_swap_mutate: called CC=23 SCAR=32.1
Pod documented
2166 18 my ($lvalue, @rvalues) = @_;
2167  
2168 18 ▶ return $lvalue if !@rvalues;
Branch: 1 branch
BranchTrueFalseTotal
unless @rvalues 2 16 18
2169  
2170 16 ▶ if (@rvalues > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rvalues > 1) 0 16 16
2171 0 $lvalue = merge_swap_mutate($lvalue, $_) for @rvalues;
2172 0 return $lvalue;
2173 }
2174  
2175 16 my $rvalue = $rvalues[0];
2176  
2177 16 ▶ return $_[0] = $rvalue if !ref($lvalue) && !ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
unless ref $lvalue or ref $rvalue 4 12 16
Condition100%3/3
ref $lvalue or ref $rvalue
l!l&&r!l&&!r
934
MC/DC100%2/2
ref $lvalue or ref $rvalue
ref $lvalue ref $rvalue
Truth table100%3/3
A or B
A= ref $lvalueB= ref $rvalue
ABresult
1X1
011
000
2178  
2179 12 ▶ return $_[0] = $rvalue if !ref($lvalue) && ref($rvalue);
Branch: 1 branch
BranchTrueFalseTotal
if not ref $lvalue and ref $rvalue 3 9 12
Condition66%2/3
not ref $lvalue and ref $rvalue
!ll&&!rl&&r
903
MC/DC50%1/2
not ref $lvalue and ref $rvalue
not ref $lvalue ref $rvalue
Truth table66%2/3
not(A) and B
A= not ref $lvalueB= ref $rvalue
ABresult
0X0
100
111
2180  
2181 9 ▶ if (ref($lvalue) eq 'ARRAY' && !ref($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and not ref $rvalue) 2 7 9
Condition100%3/3
ref $lvalue eq "ARRAY" and not ref $rvalue
!ll&&!rl&&r
432
MC/DC100%2/2
ref $lvalue eq "ARRAY" and not ref $rvalue
ref $lvalue eq "ARRAY" not ref $rvalue
Truth table100%3/3
A and not(B)
A= ref $lvalue eq "ARRAY"B= not ref $rvalue
ABresult
0X0
100
111
2182 2 push @$lvalue, $rvalue;
2183 2 return $lvalue;
2184 }
2185  
2186 7 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY") 2 5 7
Condition100%3/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
!ll&&!rl&&r
412
MC/DC100%2/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
ref $lvalue eq "ARRAY" ref $rvalue eq "ARRAY"
Truth table100%3/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "ARRAY"
ABresult
0X0
100
111
2187 2 for my $i (0..$#$rvalue) {
2188 4 ▶ $lvalue->[$i] = $rvalue->[$i] if exists $rvalue->[$i];
Branch: 1 branch
BranchTrueFalseTotal
if exists $rvalue->[$i] 4 0 4
2189 }
2190 2 return $lvalue;
2191 }
2192  
2193 5 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH") 1 4 5
Condition66%2/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
!ll&&!rl&&r
401
MC/DC50%1/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "HASH"
ref $lvalue eq "ARRAY" ref $rvalue eq "HASH"
Truth table66%2/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
2194 1 push @$lvalue, $rvalue;
2195 1 return $lvalue;
2196 }
2197  
2198 4 ▶ return $_[0] = $rvalue if ref($lvalue) eq 'HASH' && (!ref($rvalue) || ref($rvalue) eq 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY" 2 2 4
Condition83%5/6
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
!ll&&!rl&&r
022
not ref $rvalue or ref $rvalue eq "ARRAY"
l!l&&r!l&&!r
112
MC/DC66%2/3
ref $lvalue eq "HASH" and !ref($rvalue) || ref $rvalue eq "ARRAY"
ref $lvalue eq "HASH" not ref $rvalue ref $rvalue eq "ARRAY"
Truth table75%3/4
A and not(B) or C
A= ref $lvalue eq "HASH"B= not ref $rvalueC= ref $rvalue eq "ARRAY"
ABCresult
0XX0
1000
11X1
1011
2199  
2200 2 ▶ if (ref($lvalue) eq 'HASH' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "HASH" and ref $rvalue eq "HASH") 2 0 2
Condition33%1/3
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
!ll&&!rl&&r
002
MC/DC0%0/2
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
ref $lvalue eq "HASH" ref $rvalue eq "HASH"
Truth table33%1/3
A and B
A= ref $lvalue eq "HASH"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
2201 2 for my $key (keys %$rvalue) {
2202 4 ▶ if (exists $lvalue->{$key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $lvalue->{$key}) { } 2 2 4
2203 2 merge_swap_mutate($lvalue->{$key}, $rvalue->{$key});
2204 } else {
2205 2 $lvalue->{$key} = $rvalue->{$key};
2206 }
2207 }
2208 2 return $lvalue;
2209 }
2210  
2211 0 return $lvalue;
2212 }
2213  
2214 23173 ▶sub merge_take {
Subroutine merge_take: called CC=9 SCAR=22.0
Pod documented
2215 23173 my ($lvalue, @rvalues) = @_;
2216  
2217 23173 ▶ return $lvalue if !@rvalues;
Branch: 1 branch
BranchTrueFalseTotal
unless @rvalues 2 23171 23173
2218  
2219 23171 ▶ if (@rvalues > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rvalues > 1) 1 23170 23171
2220 1 my $result = $lvalue;
2221  
2222 1 $result = merge_take($result, $_) for @rvalues;
2223  
2224 1 return $result;
2225 }
2226  
2227 23170 my $rvalue = $rvalues[0];
2228  
2229 23170 ▶ if (ref($rvalue) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $rvalue eq "ARRAY") 717 22453 23170
2230 717 return [map {merge_take(undef, $_)} @$rvalue];
2231 }
2232  
2233 22453 ▶ if (ref($lvalue) eq 'HASH' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "HASH" and ref $rvalue eq "HASH") 3619 18834 22453
Condition100%3/3
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
!ll&&!rl&&r
1883223619
MC/DC100%2/2
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
ref $lvalue eq "HASH" ref $rvalue eq "HASH"
Truth table100%3/3
A and B
A= ref $lvalue eq "HASH"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
2234 3619 my $result = {%$lvalue};
2235 3619 foreach my $key (keys %$rvalue) {
2236 18938 $result->{$key} = merge_take($lvalue->{$key}, $rvalue->{$key});
2237 }
2238 3619 return $result;
2239 }
2240  
2241 18834 ▶ if (ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $rvalue eq "HASH") 4 18830 18834
2242 4 return {%$rvalue};
2243 }
2244  
2245 18830 return $rvalue;
2246 }
2247  
2248 21 ▶sub merge_take_mutate {
Subroutine merge_take_mutate: called CC=9 SCAR=22.1
Pod documented
2249 21 my ($lvalue, @rvalues) = @_;
2250  
2251 21 ▶ return $lvalue if !@rvalues;
Branch: 1 branch
BranchTrueFalseTotal
unless @rvalues 2 19 21
2252  
2253 19 ▶ if (@rvalues > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@rvalues > 1) 0 19 19
2254 0 $lvalue = merge_take_mutate($lvalue, $_) for @rvalues;
2255 0 return $lvalue;
2256 }
2257  
2258 19 my $rvalue = $rvalues[0];
2259  
2260 19 ▶ if (ref($lvalue) eq 'ARRAY' && ref($rvalue) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY") 2 17 19
Condition100%3/3
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
!ll&&!rl&&r
1432
MC/DC100%2/2
ref $lvalue eq "ARRAY" and ref $rvalue eq "ARRAY"
ref $lvalue eq "ARRAY" ref $rvalue eq "ARRAY"
Truth table100%3/3
A and B
A= ref $lvalue eq "ARRAY"B= ref $rvalue eq "ARRAY"
ABresult
0X0
100
111
2261 2 @$lvalue = @$rvalue;
2262 2 return $lvalue;
2263 }
2264  
2265 17 ▶ if (ref($lvalue) eq 'HASH' && ref($rvalue) eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue eq "HASH" and ref $rvalue eq "HASH") 3 14 17
Condition100%3/3
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
!ll&&!rl&&r
1133
MC/DC100%2/2
ref $lvalue eq "HASH" and ref $rvalue eq "HASH"
ref $lvalue eq "HASH" ref $rvalue eq "HASH"
Truth table100%3/3
A and B
A= ref $lvalue eq "HASH"B= ref $rvalue eq "HASH"
ABresult
0X0
100
111
2266 3 foreach my $key (keys %$rvalue) {
2267 5 $lvalue->{$key} = merge_take_mutate($lvalue->{$key}, $rvalue->{$key});
2268 }
2269 3 return $lvalue;
2270 }
2271  
2272 14 return $_[0] = $rvalue;
2273 }
2274  
2275 2 ▶sub meta ($;$@) {
Subroutine meta: called CC=2 SCAR=6.9
Pod documented
2276 2 my ($data, $code, @args) = @_;
2277  
2278 2 require Venus::Meta;
2279  
2280 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
2281 1 return Venus::Meta->new(name => $data);
2282 }
2283  
2284 1 return Venus::Meta->new(name => $data)->$code(@args);
2285 }
2286  
2287 2 ▶sub name ($;$@) {
Subroutine name: called CC=2 SCAR=6.9
Pod documented
2288 2 my ($data, $code, @args) = @_;
2289  
2290 2 require Venus::Name;
2291  
2292 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
2293 1 return Venus::Name->new($data);
2294 }
2295  
2296 1 return Venus::Name->new($data)->$code(@args);
2297 }
2298  
2299 12 ▶sub number ($;$@) {
Subroutine number: called CC=2 SCAR=6.9
Pod documented
2300 12 my ($data, $code, @args) = @_;
2301  
2302 12 require Venus::Number;
2303  
2304 12 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 11 1 12
2305 11 return Venus::Number->new($data);
2306 }
2307  
2308 1 return Venus::Number->new($data)->$code(@args);
2309 }
2310  
2311 7 ▶sub opts ($;$@) {
Subroutine opts: called CC=2 SCAR=6.9
Pod documented
2312 7 my ($data, $code, @args) = @_;
2313  
2314 7 require Venus::Opts;
2315  
2316 7 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 6 7
2317 1 return Venus::Opts->new($data);
2318 }
2319  
2320 6 return Venus::Opts->new($data)->$code(@args);
2321 }
2322  
2323 31 ▶sub pairs (@) {
Subroutine pairs: called CC=5 SCAR=16.2
Pod documented
2324 31 my ($args) = @_;
2325  
2326 my $result = defined $args
2327 ? (
2328 ref $args eq 'ARRAY'
2329 44 ▶ ? ([map {[$_, $args->[$_]]} 0..$#{$args}])
Branch: 1 branch
BranchTrueFalseTotal
ref $args eq 'HASH' ? : 20 0 20
2330 31 ▶ : (ref $args eq 'HASH' ? ([map {[$_, $args->{$_}]} sort keys %{$args}]) : ([])))
Branch: 2 branches
BranchTrueFalseTotal
defined $args ? : 31 0 31
ref $args eq 'ARRAY' ? : 11 20 31
2331 : [];
2332  
2333 31 ▶ return wantarray ? @{$result} : $result;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 11 20 31
2334 }
2335  
2336 2 ▶sub path ($;$@) {
Subroutine path: called CC=2 SCAR=6.9
Pod documented
2337 2 my ($data, $code, @args) = @_;
2338  
2339 2 require Venus::Path;
2340  
2341 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
2342 1 return Venus::Path->new($data);
2343 }
2344  
2345 1 return Venus::Path->new($data)->$code(@args);
2346 }
2347  
2348 4 ▶sub perl (;$$) {
Subroutine perl: called CC=4 SCAR=13.9
Pod documented
2349 4 my ($code, $data) = @_;
2350  
2351 4 require Venus::Dump;
2352  
2353 4 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 3 4
2354 1 return Venus::Dump->new;
2355 }
2356  
2357 3 ▶ if (lc($code) eq 'decode') {
Branch: 1 branch
BranchTrueFalseTotal
if (lc $code eq "decode") 1 2 3
2358 1 return Venus::Dump->new->decode($data);
2359 }
2360  
2361 2 ▶ if (lc($code) eq 'encode') {
Branch: 1 branch
BranchTrueFalseTotal
if (lc $code eq "encode") 1 1 2
2362 1 return Venus::Dump->new(value => $data)->encode;
2363 }
2364  
2365 1 return fault(qq(Invalid "perl" action "$code"));
2366 }
2367  
2368 2 ▶sub process (;$@) {
Subroutine process: called CC=2 SCAR=6.9
Pod documented
2369 2 my ($code, @args) = @_;
2370  
2371 2 require Venus::Process;
2372  
2373 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
2374 1 return Venus::Process->new;
2375 }
2376  
2377 1 return Venus::Process->new->$code(@args);
2378 }
2379  
2380 2 ▶sub proto ($;$@) {
Subroutine proto: called CC=2 SCAR=6.9
Pod documented
2381 2 my ($data, $code, @args) = @_;
2382  
2383 2 require Venus::Prototype;
2384  
2385 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
2386 1 return Venus::Prototype->new($data);
2387 }
2388  
2389 1 return Venus::Prototype->new($data)->$code(@args);
2390 }
2391  
2392 1 ▶sub puts ($;@) {
Subroutine puts: called CC=4 SCAR=16.6
Pod documented
2393 1 my ($data, @args) = @_;
2394  
2395 1 $data = cast($data);
2396  
2397 1 my $result = [];
2398  
2399 1 ▶ if ($data->isa('Venus::Hash')) {
Branch: 2 branches
BranchTrueFalseTotal
if ($data->isa('Venus::Hash')) { } 1 0 1
elsif ($data->isa('Venus::Array')) { } 0 0 0
2400 1 $result = $data->puts(@args);
2401 }
2402 elsif ($data->isa('Venus::Array')) {
2403 0 $result = $data->puts(@args);
2404 }
2405  
2406 0 ▶ return wantarray ? (@{$result}) : $result;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 1 1
2407 }
2408  
2409 16 ▶sub raise ($;@) {
Subroutine raise: called CC=4 SCAR=14.0
Pod documented
2410 16 my ($self, @args) = @_;
2411  
2412 16 ▶ ($self, my $parent) = (@$self) if (ref($self) eq 'ARRAY');
Branch: 1 branch
BranchTrueFalseTotal
if ref $self eq "ARRAY" 2 14 16
2413  
2414 16 my $data = kvargs(@args);
2415  
2416 16 ▶ $data->{context} ||= (caller(1))[3];
Condition33%1/3
$data->{"context"} ||= (caller 1)[3]
l!l&&r!l&&!r
0160
MC/DC0%0/2
$data->{"context"} ||= (caller 1)[3]
$data->{"context"} (caller 1)[3]
Truth table33%1/3
A ||= B
A= $data->{"context"}B= (caller 1)[3]
ABresult
1X1
011
000
2417  
2418 16 ▶ $parent = 'Venus::Error' if !$parent;
Branch: 1 branch
BranchTrueFalseTotal
unless $parent 9 7 16
2419  
2420 16 require Venus::Throw;
2421  
2422 16 return Venus::Throw->new(package => $self, parent => $parent)->die($data);
2423 }
2424  
2425 2 ▶sub random (;$@) {
Subroutine random: called CC=2 SCAR=6.9
Pod documented
2426 2 my ($code, @args) = @_;
2427  
2428 2 require Venus::Random;
2429  
2430 2 state $random = Venus::Random->new;
2431  
2432 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
2433 1 return $random;
2434 }
2435  
2436 1 return $random->$code(@args);
2437 }
2438  
2439 2 ▶sub range ($;@) {
Subroutine range: called CC=1 SCAR=0.0
Pod documented
2440 2 my ($data, @args) = @_;
2441  
2442 2 return array($data, 'range', @args);
2443 }
2444  
2445 1 ▶sub read_env ($) {
Subroutine read_env: called CC=1 SCAR=0.0
Pod documented
2446 1 my ($data) = @_;
2447  
2448 1 require Venus::Config;
2449  
2450 1 return Venus::Config->new->read_env($data);
2451 }
2452  
2453 1 ▶sub read_env_file ($) {
Subroutine read_env_file: called CC=1 SCAR=0.0
Pod documented
2454 1 my ($data) = @_;
2455  
2456 1 require Venus::Config;
2457  
2458 1 return Venus::Config->new->read_env_file($data);
2459 }
2460  
2461 1 ▶sub read_json ($) {
Subroutine read_json: called CC=1 SCAR=0.0
Pod documented
2462 1 my ($data) = @_;
2463  
2464 1 require Venus::Config;
2465  
2466 1 return Venus::Config->new->read_json($data);
2467 }
2468  
2469 1 ▶sub read_json_file ($) {
Subroutine read_json_file: called CC=1 SCAR=0.0
Pod documented
2470 1 my ($data) = @_;
2471  
2472 1 require Venus::Config;
2473  
2474 1 return Venus::Config->new->read_json_file($data);
2475 }
2476  
2477 1 ▶sub read_perl ($) {
Subroutine read_perl: called CC=1 SCAR=0.0
Pod documented
2478 1 my ($data) = @_;
2479  
2480 1 require Venus::Config;
2481  
2482 1 return Venus::Config->new->read_perl($data);
2483 }
2484  
2485 1 ▶sub read_perl_file ($) {
Subroutine read_perl_file: called CC=1 SCAR=0.0
Pod documented
2486 1 my ($data) = @_;
2487  
2488 1 require Venus::Config;
2489  
2490 1 return Venus::Config->new->read_perl_file($data);
2491 }
2492  
2493 1 ▶sub read_yaml ($) {
Subroutine read_yaml: called CC=1 SCAR=0.0
Pod documented
2494 1 my ($data) = @_;
2495  
2496 1 require Venus::Config;
2497  
2498 1 return Venus::Config->new->read_yaml($data);
2499 }
2500  
2501 1 ▶sub read_yaml_file ($) {
Subroutine read_yaml_file: called CC=1 SCAR=0.0
Pod documented
2502 1 my ($data) = @_;
2503  
2504 1 require Venus::Config;
2505  
2506 1 return Venus::Config->new->read_yaml_file($data);
2507 }
2508  
2509 2 ▶sub regexp ($;$@) {
Subroutine regexp: called CC=2 SCAR=6.9
Pod documented
2510 2 my ($data, $code, @args) = @_;
2511  
2512 2 require Venus::Regexp;
2513  
2514 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
2515 1 return Venus::Regexp->new($data);
2516 }
2517  
2518 1 return Venus::Regexp->new($data)->$code(@args);
2519 }
2520  
2521 1 ▶sub render ($;$) {
Subroutine render: called CC=2 SCAR=7.2
Pod documented
2522 1 my ($data, $args) = @_;
2523  
2524 1 ▶ return template($data, 'render', undef, $args || {});
Condition50%1/2
$args || {}
l!l
10
MC/DC0%0/1
$args || {}
$args
Truth table50%1/2
A
A= $args
Aresult
11
00
2525 }
2526  
2527 2 ▶sub replace ($;$@) {
Subroutine replace: called CC=3 SCAR=11.0
Pod documented
2528 2 my ($data, $code, @args) = @_;
2529  
2530 2 my @keys = qw(
2531 string
2532 regexp
2533 substr
2534 );
2535  
2536 2 ▶ my @data = (ref $data eq 'ARRAY' ? (map +(shift(@keys), $_), @{$data}) : $data);
Branch: 1 branch
BranchTrueFalseTotal
ref $data eq 'ARRAY' ? : 2 0 2
2537  
2538 2 require Venus::Replace;
2539  
2540 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
2541 1 return Venus::Replace->new(@data);
2542 }
2543  
2544 1 return Venus::Replace->new(@data)->$code(@args);
2545 }
2546  
2547 2 ▶sub roll (@) {
Subroutine roll: called CC=1 SCAR=0.0
Pod documented
2548  
2549 2 return (@_[1,0,2..$#_]);
2550 }
2551  
2552 3 ▶sub schema (;$@) {
Subroutine schema: called CC=2 SCAR=6.9
Pod documented
2553 3 my ($code, @args) = @_;
2554  
2555 3 require Venus::Schema;
2556  
2557 3 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 2 3
2558 1 return Venus::Schema->new;
2559 }
2560  
2561 2 return Venus::Schema->new->$code(@args);
2562 }
2563  
2564 2 ▶sub search ($;$@) {
Subroutine search: called CC=3 SCAR=11.0
Pod documented
2565 2 my ($data, $code, @args) = @_;
2566  
2567 2 my @keys = qw(
2568 string
2569 regexp
2570 );
2571  
2572 2 ▶ my @data = (ref $data eq 'ARRAY' ? (map +(shift(@keys), $_), @{$data}) : $data);
Branch: 1 branch
BranchTrueFalseTotal
ref $data eq 'ARRAY' ? : 2 0 2
2573  
2574 2 require Venus::Search;
2575  
2576 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
2577 1 return Venus::Search->new(@data);
2578 }
2579  
2580 1 return Venus::Search->new(@data)->$code(@args);
2581 }
2582  
2583 2 ▶sub set ($;$@) {
Subroutine set: called CC=2 SCAR=6.9
Pod documented
2584 2 my ($data, $code, @args) = @_;
2585  
2586 2 require Venus::Set;
2587  
2588 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
2589 1 return Venus::Set->new($data);
2590 }
2591  
2592 1 return Venus::Set->new($data)->$code(@args);
2593 }
2594  
2595 8 ▶sub sets ($;@) {
Subroutine sets: called CC=4 SCAR=13.9
Pod documented
2596 8 my ($data, @args) = @_;
2597  
2598 8 $data = cast($data);
2599  
2600 8 my $result = [];
2601  
2602 8 ▶ if ($data->isa('Venus::Hash')) {
Branch: 2 branches
BranchTrueFalseTotal
if ($data->isa('Venus::Hash')) { } 4 4 8
elsif ($data->isa('Venus::Array')) { } 4 0 4
2603 4 $result = $data->sets(@args);
2604  
2605 4 $_[0] = $data->get;
2606 }
2607 elsif ($data->isa('Venus::Array')) {
2608 4 $result = $data->sets(@args);
2609  
2610 4 $_[0] = $data->get;
2611 }
2612  
2613 8 ▶ return wantarray ? (@{$result}) : $result;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 6 8
2614 }
2615  
2616 48 ▶sub space ($;$@) {
Subroutine space: called CC=2 SCAR=6.9
Pod documented
2617 48 my ($data, $code, @args) = @_;
2618  
2619 48 require Venus::Space;
2620  
2621 48 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 17 31 48
2622 17 return Venus::Space->new($data);
2623 }
2624  
2625 31 return Venus::Space->new($data)->$code(@args);
2626 }
2627  
2628 3 ▶sub sorts (@) {
Subroutine sorts: called CC=1 SCAR=0.0
Pod documented
2629  
2630 3 return CORE::sort(map list($_), @_);
2631 }
2632  
2633 2 ▶sub string ($;$@) {
Subroutine string: called CC=2 SCAR=6.9
Pod documented
2634 2 my ($data, $code, @args) = @_;
2635  
2636 2 require Venus::String;
2637  
2638 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
2639 1 return Venus::String->new($data);
2640 }
2641  
2642 1 return Venus::String->new($data)->$code(@args);
2643 }
2644  
2645 4 ▶sub syscall ($;@) {
Subroutine syscall: called CC=11 SCAR=26.6
Pod documented
2646 4 my (@args) = @_;
2647  
2648 4 require Venus::Os;
2649  
2650 4 ▶ for (my $i = 0; $i < @args; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < @args) 8 4 12
2651 8 ▶ if ($args[$i] =~ /^\|+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args[$i] =~ /^\|+$/u) 0 8 8
2652 0 next;
2653 }
2654 8 ▶ if ($args[$i] =~ /^\&+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args[$i] =~ /^\&+$/u) 0 8 8
2655 0 next;
2656 }
2657 8 ▶ if ($args[$i] =~ /^\w+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args[$i] =~ /^\w+$/u) 4 4 8
2658 4 next;
2659 }
2660 4 ▶ if ($args[$i] =~ /^[<>]+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args[$i] =~ /^[<>]+$/u) 0 4 4
2661 0 next;
2662 }
2663 4 ▶ if ($args[$i] =~ /^\d[<>&]+\d?$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args[$i] =~ /^\d[<>&]+\d?$/u) 0 4 4
2664 0 next;
2665 }
2666 4 ▶ if ($args[$i] =~ /\$[A-Z]\w+/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args[$i] =~ /\$[A-Z]\w+/u) 0 4 4
2667 0 next;
2668 }
2669 4 ▶ if ($args[$i] =~ /^\$\((.*)\)$/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($args[$i] =~ /^\$\((.*)\)$/u) 0 4 4
2670 0 next;
2671 }
2672 4 $args[$i] = Venus::Os->quote($args[$i]);
2673 }
2674  
2675 4 my ($data, $exit, $code) = (_qx(@args));
2676  
2677 4 ▶ return wantarray ? ($data, $code) : (($exit == 0) ? true() : false());
Branch: 2 branches
BranchTrueFalseTotal
wantarray ? : 2 2 4
$exit == 0 ? : 1 1 2
2678 }
2679  
2680 3 ▶sub template ($;$@) {
Subroutine template: called CC=2 SCAR=6.9
Pod documented
2681 3 my ($data, $code, @args) = @_;
2682  
2683 3 require Venus::Template;
2684  
2685 3 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 2 3
2686 1 return Venus::Template->new($data);
2687 }
2688  
2689 2 return Venus::Template->new($data)->$code(@args);
2690 }
2691  
2692 0 ▶sub test ($;$@) {
Subroutine test: not called CC=2 SCAR=17.9
Pod documented
2693 0 my ($data, $code, @args) = @_;
2694  
2695 0 require Venus::Test;
2696  
2697 0 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 0 0 0
2698 0 return Venus::Test->new($data);
2699 }
2700  
2701 0 return Venus::Test->new($data)->$code(@args);
2702 }
2703  
2704 4 ▶sub text_pod ($;$@) {
Subroutine text_pod: called CC=2 SCAR=6.9
Pod documented
2705 4 my ($data, $code, @args) = @_;
2706  
2707 4 require Venus::Text::Pod;
2708  
2709 4 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 3 4
2710 1 return Venus::Text::Pod->new($data);
2711 }
2712  
2713 3 return Venus::Text::Pod->new($data)->$code(@args);
2714 }
2715  
2716 2 ▶sub text_pod_string {
Subroutine text_pod_string: called CC=2 SCAR=6.9
Pod documented
2717 2 my (@args) = @_;
2718  
2719 2 my $file = (grep -f, (caller(0))[1], $0)[0];
2720  
2721 2 ▶ return text_pod($file, 'string', @args > 1 ? @args : (undef, @args));
Branch: 1 branch
BranchTrueFalseTotal
@args > 1 ? : 1 1 2
2722 }
2723  
2724 5 ▶sub text_tag ($;$@) {
Subroutine text_tag: called CC=2 SCAR=6.9
Pod documented
2725 5 my ($data, $code, @args) = @_;
2726  
2727 5 require Venus::Text::Tag;
2728  
2729 5 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 4 5
2730 1 return Venus::Text::Tag->new($data);
2731 }
2732  
2733 4 return Venus::Text::Tag->new($data)->$code(@args);
2734 }
2735  
2736 3 ▶sub text_tag_string {
Subroutine text_tag_string: called CC=2 SCAR=6.9
Pod documented
2737 3 my (@args) = @_;
2738  
2739 3 my $file = (grep -f, (caller(0))[1], $0)[0];
2740  
2741 3 ▶ return text_tag($file, 'string', @args > 1 ? @args : (undef, @args));
Branch: 1 branch
BranchTrueFalseTotal
@args > 1 ? : 2 1 3
2742 }
2743  
2744 1 ▶sub then (@) {
Subroutine then: called CC=1 SCAR=0.0
Pod documented
2745  
2746 1 return ($_[0], call(@_));
2747 }
2748  
2749 3 ▶sub throw ($;$@) {
Subroutine throw: called CC=6 SCAR=18.0
Pod documented
2750 3 my ($data, $code, @args) = @_;
2751  
2752 3 ▶ $data ||= {};
Condition50%1/2
$data ||= {}
l!l
30
MC/DC0%0/1
$data ||= {}
$data
Truth table50%1/2
A
A= $data
Aresult
11
00
2753  
2754 3 require Venus::Throw;
2755  
2756 3 my $throw = Venus::Throw->new(context => (caller(1))[3]);
2757  
2758 3 ▶ $data = {package => $data} if ref $data ne 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $data ne "HASH" 2 1 3
2759  
2760 3 for my $key (keys %{$data}) {
2761 6 ▶ $throw->$key($data->{$key}) if $throw->can($key);
Branch: 1 branch
BranchTrueFalseTotal
if $throw->can($key) 6 0 6
2762 }
2763  
2764 3 ▶ return $throw if !$code;
Branch: 1 branch
BranchTrueFalseTotal
unless $code 2 1 3
2765  
2766 1 return $throw->$code(@args);
2767 }
2768  
2769 62990 ▶sub true () {
Subroutine true: called CC=1 SCAR=0.0
Pod documented
2770  
2771 62990 require Venus::True;
2772  
2773 62990 return Venus::True->value;
2774 }
2775  
2776 3 ▶sub try ($;$@) {
Subroutine try: called CC=2 SCAR=6.9
Pod documented
2777 3 my ($data, $code, @args) = @_;
2778  
2779 3 require Venus::Try;
2780  
2781 3 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 2 1 3
2782 2 return Venus::Try->new($data);
2783 }
2784  
2785 1 return Venus::Try->new($data)->$code(@args);
2786 }
2787  
2788 49 ▶sub tv {
Subroutine tv: called CC=38 SCAR=49.6
Pod documented
2789 49 my ($lvalue, $rvalue) = @_;
2790  
2791 49 require Scalar::Util;
2792  
2793 49 ▶ if (is($lvalue, $rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&is($lvalue, $rvalue)) 1 48 49
2794 1 return true();
2795 }
2796 48 ▶ if (!defined($lvalue) && !defined($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $lvalue or defined $rvalue) 1 47 48
Condition66%2/3
defined $lvalue or defined $rvalue
l!l&&r!l&&!r
4701
MC/DC50%1/2
defined $lvalue or defined $rvalue
defined $lvalue defined $rvalue
Truth table66%2/3
A or B
A= defined $lvalueB= defined $rvalue
ABresult
1X1
011
000
2797 1 return true();
2798 }
2799 47 ▶ if (!defined($lvalue) || !defined($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $lvalue and defined $rvalue) 1 46 47
Condition66%2/3
defined $lvalue and defined $rvalue
!ll&&!rl&&r
0146
MC/DC50%1/2
defined $lvalue and defined $rvalue
defined $lvalue defined $rvalue
Truth table66%2/3
A and B
A= defined $lvalueB= defined $rvalue
ABresult
0X0
100
111
2800 1 return false();
2801 }
2802 46 ▶ if (ref($lvalue) && ref($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue and ref $rvalue) 12 34 46
Condition66%2/3
ref $lvalue and ref $rvalue
!ll&&!rl&&r
34012
MC/DC50%1/2
ref $lvalue and ref $rvalue
ref $lvalue ref $rvalue
Truth table66%2/3
A and B
A= ref $lvalueB= ref $rvalue
ABresult
0X0
100
111
2803 12 ▶ if (Scalar::Util::blessed($lvalue) && Scalar::Util::blessed($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($lvalue) and builtin::blessed($rvalue)) { } 2 10 12
Condition66%2/3
builtin::blessed($lvalue) and builtin::blessed($rvalue)
!ll&&!rl&&r
1002
MC/DC50%1/2
builtin::blessed($lvalue) and builtin::blessed($rvalue)
builtin::blessed($lvalue) builtin::blessed($rvalue)
Truth table66%2/3
A and B
A= builtin::blessed($lvalue)B= builtin::blessed($rvalue)
ABresult
0X0
100
111
2804 2 ▶ if (ref($lvalue) ne ref($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $lvalue ne ref $rvalue) 0 2 2
2805 0 return false();
2806 }
2807 2 ▶ if (UNIVERSAL::isa($lvalue, 'HASH')) {
Branch: 6 branches
BranchTrueFalseTotal
if (UNIVERSAL::isa($lvalue, 'HASH')) { } 2 0 2
elsif (UNIVERSAL::isa($lvalue, 'ARRAY')) { } 0 0 0
elsif (UNIVERSAL::isa($lvalue, 'REF')) { } 0 0 0
elsif (UNIVERSAL::isa($lvalue, 'SCALAR')) { } 0 0 0
elsif (UNIVERSAL::isa($lvalue, 'GLOB')) { } 0 0 0
elsif (UNIVERSAL::isa($lvalue, 'REGEXP')) { } 0 0 0
2808 2 return tv({%$lvalue}, {%$rvalue});
2809 }
2810 elsif (UNIVERSAL::isa($lvalue, 'ARRAY')) {
2811 0 return tv([@$lvalue], [@$rvalue]);
2812 }
2813 elsif (UNIVERSAL::isa($lvalue, 'REF')) {
2814 0 return tv($$lvalue, $$rvalue);
2815 }
2816 elsif (UNIVERSAL::isa($lvalue, 'SCALAR')) {
2817 0 return tv($$lvalue, $$rvalue);
2818 }
2819 elsif (UNIVERSAL::isa($lvalue, 'GLOB')) {
2820 0 return *$lvalue eq *$rvalue;
2821 }
2822 elsif (UNIVERSAL::isa($lvalue, 'REGEXP')) {
2823 0 return $lvalue eq $rvalue;
2824 }
2825 else {
2826 0 return false();
2827 }
2828 }
2829 else {
2830 10 ▶ if (ref($lvalue) eq 'ARRAY') {
Branch: 6 branches
BranchTrueFalseTotal
if (ref $lvalue eq 'ARRAY') { } 8 2 10
elsif (ref $lvalue eq 'HASH') { } 2 0 2
elsif (ref $lvalue eq 'SCALAR') { } 0 0 0
elsif (ref $lvalue eq 'GLOB') { } 0 0 0
elsif (ref $lvalue eq 'REF') { } 0 0 0
elsif (ref $lvalue eq 'REGEXP') { } 0 0 0
2831 8 ▶ if (@$lvalue != @$rvalue) {
Branch: 1 branch
BranchTrueFalseTotal
if (@$lvalue != @$rvalue) 0 8 8
2832 0 return false();
2833 }
2834 8 for my $i (0 .. $#$lvalue) {
2835 12 ▶ if (!tv($lvalue->[$i], $rvalue->[$i])) {
Branch: 1 branch
BranchTrueFalseTotal
unless (tv($lvalue->[$i], $rvalue->[$i])) 3 9 12
2836 3 return false();
2837 }
2838 }
2839 5 return true();
2840 }
2841 elsif (ref($lvalue) eq 'HASH') {
2842 2 ▶ if (keys %$lvalue != keys %$rvalue) {
Branch: 1 branch
BranchTrueFalseTotal
if (keys %$lvalue != keys %$rvalue) 0 2 2
2843 0 return false();
2844 }
2845 2 for my $key (keys %$lvalue) {
2846 2 ▶ if (!exists $rvalue->{$key} || !tv($lvalue->{$key}, $rvalue->{$key})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $rvalue->{$key} and tv($lvalue->{$key}, $rvalue->{$key})) 1 1 2
Condition66%2/3
exists $rvalue->{$key} and tv($lvalue->{$key}, $rvalue->{$key})
!ll&&!rl&&r
011
MC/DC50%1/2
exists $rvalue->{$key} and tv($lvalue->{$key}, $rvalue->{$key})
exists $rvalue->{$key} tv($lvalue->{$key}, $rvalue->{$key})
Truth table66%2/3
A and B
A= exists $rvalue->{$key}B= tv($lvalue->{$key}, $rvalue->{$key})
ABresult
0X0
100
111
2847 1 return false();
2848 }
2849 }
2850 1 return true();
2851 }
2852 elsif (ref($lvalue) eq 'SCALAR') {
2853 0 return tv($$lvalue, $$rvalue);
2854 }
2855 elsif (ref($lvalue) eq 'GLOB') {
2856 0 return *$lvalue eq *$rvalue;
2857 }
2858 elsif (ref($lvalue) eq 'REF') {
2859 0 return tv($$lvalue, $$rvalue);
2860 }
2861 elsif (ref($lvalue) eq 'REGEXP') {
2862 0 return $lvalue eq $rvalue;
2863 }
2864 else {
2865 0 return false();
2866 }
2867 }
2868 }
2869 34 ▶ if (!ref($lvalue) && !ref($rvalue)) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $lvalue || ref $rvalue) { } 34 0 34
Condition33%1/3
ref $lvalue || ref $rvalue
l!l&&r!l&&!r
0034
MC/DC0%0/2
ref $lvalue || ref $rvalue
ref $lvalue ref $rvalue
Truth table33%1/3
A || B
A= ref $lvalueB= ref $rvalue
ABresult
1X1
011
000
2870 34 require Venus::What;
2871  
2872 34 ▶ if (Venus::What::scalar_is_boolean($lvalue) && Venus::What::scalar_is_boolean($rvalue)) {
Branch: 3 branches
BranchTrueFalseTotal
if (Venus::What::scalar_is_boolean($lvalue) and Venus::What::scalar_is_boolean($rvalue)) { } 0 34 34
elsif (Venus::What::scalar_is_numeric($lvalue) and Venus::What::scalar_is_numeric($rvalue)) { } 30 4 34
elsif (not Venus::What::scalar_is_numeric($lvalue) || Venus::What::scalar_is_numeric($rvalue)) { } 1 3 4
Condition33%1/3
Venus::What::scalar_is_boolean($lvalue) and Venus::What::scalar_is_boolean($rvalue)
!ll&&!rl&&r
3400
MC/DC0%0/2
Venus::What::scalar_is_boolean($lvalue) and Venus::What::scalar_is_boolean($rvalue)
Venus::What::scalar_is_boolean($lvalue) Venus::What::scalar_is_boolean($rvalue)
Truth table33%1/3
A and B
A= Venus::What::scalar_is_boolean($lvalue)B= Venus::What::scalar_is_boolean($rvalue)
ABresult
0X0
100
111
2873 0 return $lvalue == $rvalue;
2874 }
2875 ▶ elsif (Venus::What::scalar_is_numeric($lvalue) && Venus::What::scalar_is_numeric($rvalue)) {
Condition66%2/3
Venus::What::scalar_is_numeric($lvalue) and Venus::What::scalar_is_numeric($rvalue)
!ll&&!rl&&r
4030
MC/DC50%1/2
Venus::What::scalar_is_numeric($lvalue) and Venus::What::scalar_is_numeric($rvalue)
Venus::What::scalar_is_numeric($lvalue) Venus::What::scalar_is_numeric($rvalue)
Truth table66%2/3
A and B
A= Venus::What::scalar_is_numeric($lvalue)B= Venus::What::scalar_is_numeric($rvalue)
ABresult
0X0
100
111
2876 30 return $lvalue == $rvalue;
2877 }
2878 ▶ elsif (!Venus::What::scalar_is_numeric($lvalue) && !Venus::What::scalar_is_numeric($rvalue)) {
Condition66%2/3
Venus::What::scalar_is_numeric($lvalue) || Venus::What::scalar_is_numeric($rvalue)
l!l&&r!l&&!r
031
MC/DC50%1/2
Venus::What::scalar_is_numeric($lvalue) || Venus::What::scalar_is_numeric($rvalue)
Venus::What::scalar_is_numeric($lvalue) Venus::What::scalar_is_numeric($rvalue)
Truth table66%2/3
A || B
A= Venus::What::scalar_is_numeric($lvalue)B= Venus::What::scalar_is_numeric($rvalue)
ABresult
1X1
011
000
2879 1 return $lvalue eq $rvalue;
2880 }
2881 else {
2882 3 return false();
2883 }
2884 }
2885 else {
2886 0 return false();
2887 }
2888 }
2889  
2890 3 ▶sub type {
Subroutine type: called CC=2 SCAR=6.9
Pod documented
2891 3 my ($code, @args) = @_;
2892  
2893 3 require Venus::Type;
2894  
2895 3 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 2 3
2896 1 return Venus::Type->new;
2897 }
2898  
2899 2 return Venus::Type->new->$code(@args);
2900 }
2901  
2902 2 ▶sub unpack (@) {
Subroutine unpack: called CC=1 SCAR=0.0
Pod documented
2903 2 my (@args) = @_;
2904  
2905 2 require Venus::Unpack;
2906  
2907 2 return Venus::Unpack->new->do('args', @args)->all;
2908 }
2909  
2910 6 ▶sub vars ($;$@) {
Subroutine vars: called CC=2 SCAR=6.9
Pod documented
2911 6 my ($data, $code, @args) = @_;
2912  
2913 6 require Venus::Vars;
2914  
2915 6 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 5 1 6
2916 5 return Venus::Vars->new($data);
2917 }
2918  
2919 1 return Venus::Vars->new($data)->$code(@args);
2920 }
2921  
2922 3 ▶sub vns ($;@) {
Subroutine vns: called CC=4 SCAR=15.6
Pod documented
2923 3 my ($name, $data, $code, @args) = @_;
2924  
2925 3 my $space = space('Venus')->child($name)->do('tryload');
2926  
2927 3 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 3 0 3
2928 3 ▶ return $space->package->new($#_ > 0 ? $data : ());
Branch: 1 branch
BranchTrueFalseTotal
$#_ > 0 ? : 2 1 3
2929 }
2930  
2931 0 ▶ return $space->package->new($#_ > 0 ? $data : ())->$code(@args);
Branch: 1 branch
BranchTrueFalseTotal
$#_ > 0 ? : 0 0 0
2932 }
2933  
2934 2 ▶sub what ($;$@) {
Subroutine what: called CC=2 SCAR=6.9
Pod documented
2935 2 my ($data, $code, @args) = @_;
2936  
2937 2 require Venus::What;
2938  
2939 2 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 1 2
2940 1 return Venus::What->new($data);
2941 }
2942  
2943 1 return Venus::What->new($data)->$code(@args);
2944 }
2945  
2946 1 ▶sub work ($) {
Subroutine work: called CC=1 SCAR=0.0
Pod documented
2947 1 my ($data) = @_;
2948  
2949 1 require Venus::Process;
2950  
2951 1 return Venus::Process->new->do('work', $data);
2952 }
2953  
2954 2 ▶sub wrap ($;$) {
Subroutine wrap: called CC=3 SCAR=11.0
Pod documented
2955 2 my ($data, $name) = @_;
2956  
2957 2 ▶ return if !@_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 2 2
2958  
2959 2 ▶ my $moniker = $name // $data =~ s/\W//gr;
Condition66%2/3
$name // $data =~ s/\W//gru
l!l&&r!l&&!r
110
MC/DC0%0/2
$name // $data =~ s/\W//gru
$name $data =~ s/\W//gru
Truth table66%2/3
A // B
A= $nameB= $data =~ s/\W//gru
ABresult
1X1
011
000
2960 2 my $caller = caller(0);
2961  
2962 120 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
2963 120 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
2964  
2965 2 ▶ return *{"${caller}::${moniker}"} = sub {@_ ? make($data, @_) : $data};
Subroutine __ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 2 2 4
2966 }
2967  
2968 1 ▶sub write_env ($) {
Subroutine write_env: called CC=1 SCAR=0.0
Pod documented
2969 1 my ($data) = @_;
2970  
2971 1 require Venus::Config;
2972  
2973 1 return Venus::Config->new($data)->write_env;
2974 }
2975  
2976 1 ▶sub write_env_file ($$) {
Subroutine write_env_file: called CC=1 SCAR=0.0
Pod documented
2977 1 my ($path, $data) = @_;
2978  
2979 1 require Venus::Config;
2980  
2981 1 return Venus::Config->new($data)->write_env_file($path);
2982 }
2983  
2984 1 ▶sub write_json ($) {
Subroutine write_json: called CC=1 SCAR=0.0
Pod documented
2985 1 my ($data) = @_;
2986  
2987 1 require Venus::Config;
2988  
2989 1 return Venus::Config->new($data)->write_json;
2990 }
2991  
2992 1 ▶sub write_json_file ($$) {
Subroutine write_json_file: called CC=1 SCAR=0.0
Pod documented
2993 1 my ($path, $data) = @_;
2994  
2995 1 require Venus::Config;
2996  
2997 1 return Venus::Config->new($data)->write_json_file($path);
2998 }
2999  
3000 1 ▶sub write_perl ($) {
Subroutine write_perl: called CC=1 SCAR=0.0
Pod documented
3001 1 my ($data) = @_;
3002  
3003 1 require Venus::Config;
3004  
3005 1 return Venus::Config->new($data)->write_perl;
3006 }
3007  
3008 1 ▶sub write_perl_file ($$) {
Subroutine write_perl_file: called CC=1 SCAR=0.0
Pod documented
3009 1 my ($path, $data) = @_;
3010  
3011 1 require Venus::Config;
3012  
3013 1 return Venus::Config->new($data)->write_perl_file($path);
3014 }
3015  
3016 1 ▶sub write_yaml ($) {
Subroutine write_yaml: called CC=1 SCAR=0.0
Pod documented
3017 1 my ($data) = @_;
3018  
3019 1 require Venus::Config;
3020  
3021 1 return Venus::Config->new($data)->write_yaml;
3022 }
3023  
3024 1 ▶sub write_yaml_file ($$) {
Subroutine write_yaml_file: called CC=1 SCAR=0.0
Pod documented
3025 1 my ($path, $data) = @_;
3026  
3027 1 require Venus::Config;
3028  
3029 1 return Venus::Config->new($data)->write_yaml_file($path);
3030 }
3031  
3032 4 ▶sub yaml (;$$) {
Subroutine yaml: called CC=4 SCAR=13.9
Pod documented
3033 4 my ($code, $data) = @_;
3034  
3035 4 require Venus::Yaml;
3036  
3037 4 ▶ if (!$code) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($code) 1 3 4
3038 1 return Venus::Yaml->new;
3039 }
3040  
3041 3 ▶ if (lc($code) eq 'decode') {
Branch: 1 branch
BranchTrueFalseTotal
if (lc $code eq "decode") 1 2 3
3042 1 return Venus::Yaml->new->decode($data);
3043 }
3044  
3045 2 ▶ if (lc($code) eq 'encode') {
Branch: 1 branch
BranchTrueFalseTotal
if (lc $code eq "encode") 1 1 2
3046 1 return Venus::Yaml->new(value => $data)->encode;
3047 }
3048  
3049 1 return fault(qq(Invalid "yaml" action "$code"));
3050 }
3051  
3052 120 1;
3053  
3054  
3055 =head1 NAME
3056  
3057 Venus - Standard Library
3058  
3059 =cut
3060  
3061 =head1 ABSTRACT
3062  
3063 Standard Library for Perl 5
3064  
3065 =cut
3066  
3067 =head1 VERSION
3068  
3069 5.01
3070  
3071 =cut
3072  
3073 =head1 SYNOPSIS
3074  
3075 package main;
3076  
3077 use Venus 'catch', 'error', 'raise';
3078  
3079 # error handling
3080 my ($error, $result) = catch {
3081 error;
3082 };
3083  
3084 # boolean keywords
3085 if ($result) {
3086 error;
3087 }
3088  
3089 # raise exceptions
3090 if ($result) {
3091 raise 'MyApp::Error';
3092 }
3093  
3094 # boolean keywords, and more!
3095 my $bool = true ne false;
3096  
3097 =cut
3098  
3099 =head1 DESCRIPTION
3100  
3101 This library provides an object-orientation framework and extendible standard
3102 library for Perl 5 with classes which wrap most native Perl data types. Venus
3103 has a simple modular architecture, robust library of classes, methods, and
3104 roles, supports pure-Perl autoboxing, advanced exception handling, "true" and
3105 "false" functions, package introspection, command-line options parsing, and
3106 more. This package will always automatically exports C<true> and C<false>
3107 keyword functions (unless existing routines of the same name already exist in
3108 the calling package or its parents), otherwise exports keyword functions as
3109 requested at import. This library requires Perl C<5.18+>.
3110  
3111 =head1 CAPABILITIES
3112  
3113 The following is a short list of capabilities:
3114  
3115 =over 4
3116  
3117 =item *
3118  
3119 Perl 5.18.0+
3120  
3121 =item *
3122  
3123 Zero Dependencies
3124  
3125 =item *
3126  
3127 Fast Object-Orientation
3128  
3129 =item *
3130  
3131 Robust Standard Library
3132  
3133 =item *
3134  
3135 Intuitive Value Classes
3136  
3137 =item *
3138  
3139 Pure Perl Autoboxing
3140  
3141 =item *
3142  
3143 Convenient Utility Classes
3144  
3145 =item *
3146  
3147 Simple Package Reflection
3148  
3149 =item *
3150  
3151 Flexible Exception Handling
3152  
3153 =item *
3154  
3155 Composable Standards
3156  
3157 =item *
3158  
3159 Pluggable (no monkeypatching)
3160  
3161 =item *
3162  
3163 Proxyable Methods
3164  
3165 =item *
3166  
3167 Type Assertions
3168  
3169 =item *
3170  
3171 Type Coercions
3172  
3173 =item *
3174  
3175 Value Casting
3176  
3177 =item *
3178  
3179 Boolean Values
3180  
3181 =item *
3182  
3183 Complete Documentation
3184  
3185 =item *
3186  
3187 Complete Test Coverage
3188  
3189 =back
3190  
3191 =cut
3192  
3193 =head1 FUNCTIONS
3194  
3195 This package provides the following functions:
3196  
3197 =cut
3198  
3199 =head2 after
3200  
3201 after(string $name, coderef $code) (coderef)
3202  
3203 The after function installs a method modifier that executes after the original
3204 method, allowing you to perform actions after a method call. B<Note:> The
3205 return value of the modifier routine is ignored; the wrapped method always
3206 returns the value from the original method. Modifiers are executed in the order
3207 they are stacked. This function is always exported unless a routine of the same
3208 name already exists.
3209  
3210 I<Since C<4.15>>
3211  
3212 =over 4
3213  
3214 =item after example 1
3215  
3216 package Example;
3217  
3218 use Venus::Class 'after', 'attr';
3219  
3220 attr 'calls';
3221  
3222 sub BUILD {
3223 my ($self) = @_;
3224 $self->calls([]);
3225 }
3226  
3227 sub test {
3228 my ($self) = @_;
3229 push @{$self->calls}, 'original';
3230 return 'original';
3231 }
3232  
3233 after 'test', sub {
3234 my ($self) = @_;
3235 push @{$self->calls}, 'after';
3236 return 'ignored';
3237 };
3238  
3239 package main;
3240  
3241 my $example = Example->new;
3242 my $value = $example->test;
3243  
3244 # "original"
3245  
3246 =back
3247  
3248 =over 4
3249  
3250 =item after example 2
3251  
3252 package Example2;
3253  
3254 use Venus::Class 'after', 'attr';
3255  
3256 attr 'calls';
3257  
3258 sub BUILD {
3259 my ($self) = @_;
3260 $self->calls([]);
3261 }
3262  
3263 sub test {
3264 my ($self) = @_;
3265 push @{$self->calls}, 'original';
3266 return $self;
3267 }
3268  
3269 after 'test', sub {
3270 my ($self) = @_;
3271 push @{$self->calls}, 'after';
3272 return $self;
3273 };
3274  
3275 package main;
3276  
3277 my $example = Example2->new;
3278 $example->test;
3279 my $calls = $example->calls;
3280  
3281 # ['original', 'after']
3282  
3283 =back
3284  
3285 =cut
3286  
3287 =head2 all
3288  
3289 all(arrayref | hashref | consumes[Venus::Role::Mappable] $lvalue, any $rvalue) (boolean)
3290  
3291 The all function accepts an arrayref, hashref, or
3292 L<"mappable"|Venus::Role::Mappable> and returns true if the rvalue is a
3293 callback and returns true for all items in the collection. If the rvalue
3294 provided is not a coderef that value's type and value will be used as the
3295 criteria.
3296  
3297 I<Since C<4.15>>
3298  
3299 =over 4
3300  
3301 =item all example 1
3302  
3303 # given: synopsis
3304  
3305 package main;
3306  
3307 use Venus 'all';
3308  
3309 my $all = all [1, '1'], 1;
3310  
3311 # false
3312  
3313 =back
3314  
3315 =over 4
3316  
3317 =item all example 2
3318  
3319 # given: synopsis
3320  
3321 package main;
3322  
3323 use Venus 'all';
3324  
3325 my $all = all [1, 1], 1;
3326  
3327 # true
3328  
3329 =back
3330  
3331 =over 4
3332  
3333 =item all example 3
3334  
3335 # given: synopsis
3336  
3337 package main;
3338  
3339 use Venus 'all';
3340  
3341 my $all = all {1, 2}, 1;
3342  
3343 # false
3344  
3345 =back
3346  
3347 =over 4
3348  
3349 =item all example 4
3350  
3351 # given: synopsis
3352  
3353 package main;
3354  
3355 use Venus 'all';
3356  
3357 my $all = all {1, 1}, 1;
3358  
3359 # true
3360  
3361 =back
3362  
3363 =over 4
3364  
3365 =item all example 5
3366  
3367 # given: synopsis
3368  
3369 package main;
3370  
3371 use Venus 'all';
3372  
3373 my $all = all [[1], [1]], [1];
3374  
3375 # true
3376  
3377 =back
3378  
3379 =over 4
3380  
3381 =item all example 6
3382  
3383 # given: synopsis
3384  
3385 package main;
3386  
3387 use Venus 'all';
3388  
3389 my $all = all [1, '1', 2..4], sub{$_ > 0};
3390  
3391 # true
3392  
3393 =back
3394  
3395 =over 4
3396  
3397 =item all example 7
3398  
3399 # given: synopsis
3400  
3401 package main;
3402  
3403 use Venus 'all';
3404  
3405 my $all = all [1, '1', 2..4], sub{$_ > 1};
3406  
3407 # false
3408  
3409 =back
3410  
3411 =cut
3412  
3413 =head2 any
3414  
3415 any(arrayref | hashref | consumes[Venus::Role::Mappable] $lvalue, any $rvalue) (boolean)
3416  
3417 The any function accepts an arrayref, hashref, or
3418 L<"mappable"|Venus::Role::Mappable> and returns true if the rvalue is a
3419 callback and returns true for any items in the collection. If the rvalue
3420 provided is not a coderef that value's type and value will be used as the
3421 criteria.
3422  
3423 I<Since C<4.15>>
3424  
3425 =over 4
3426  
3427 =item any example 1
3428  
3429 # given: synopsis
3430  
3431 package main;
3432  
3433 use Venus 'any';
3434  
3435 my $any = any [1, '1'], 1;
3436  
3437 # true
3438  
3439 =back
3440  
3441 =over 4
3442  
3443 =item any example 2
3444  
3445 # given: synopsis
3446  
3447 package main;
3448  
3449 use Venus 'any';
3450  
3451 my $any = any [1, 1], 0;
3452  
3453 # false
3454  
3455 =back
3456  
3457 =over 4
3458  
3459 =item any example 3
3460  
3461 # given: synopsis
3462  
3463 package main;
3464  
3465 use Venus 'any';
3466  
3467 my $any = any {1, 2}, 1;
3468  
3469 # false
3470  
3471 =back
3472  
3473 =over 4
3474  
3475 =item any example 4
3476  
3477 # given: synopsis
3478  
3479 package main;
3480  
3481 use Venus 'any';
3482  
3483 my $any = any {1, 1}, 1;
3484  
3485 # true
3486  
3487 =back
3488  
3489 =over 4
3490  
3491 =item any example 5
3492  
3493 # given: synopsis
3494  
3495 package main;
3496  
3497 use Venus 'any';
3498  
3499 my $any = any [[0], [1]], [1];
3500  
3501 # true
3502  
3503 =back
3504  
3505 =over 4
3506  
3507 =item any example 6
3508  
3509 # given: synopsis
3510  
3511 package main;
3512  
3513 use Venus 'any';
3514  
3515 my $any = any [1, '1', 2..4], sub{!defined};
3516  
3517 # false
3518  
3519 =back
3520  
3521 =over 4
3522  
3523 =item any example 7
3524  
3525 # given: synopsis
3526  
3527 package main;
3528  
3529 use Venus 'any';
3530  
3531 my $any = any [1, '1', 2..4, undef], sub{!defined};
3532  
3533 # true
3534  
3535 =back
3536  
3537 =cut
3538  
3539 =head2 args
3540  
3541 args(arrayref $value, string | coderef $code, any @args) (any)
3542  
3543 The args function builds and returns a L<Venus::Args> object, or dispatches to
3544 the coderef or method provided.
3545  
3546 I<Since C<3.10>>
3547  
3548 =over 4
3549  
3550 =item args example 1
3551  
3552 package main;
3553  
3554 use Venus 'args';
3555  
3556 my $args = args ['--resource', 'users'];
3557  
3558 # bless({...}, 'Venus::Args')
3559  
3560 =back
3561  
3562 =over 4
3563  
3564 =item args example 2
3565  
3566 package main;
3567  
3568 use Venus 'args';
3569  
3570 my $args = args ['--resource', 'users'], 'indexed';
3571  
3572 # {0 => '--resource', 1 => 'users'}
3573  
3574 =back
3575  
3576 =cut
3577  
3578 =head2 around
3579  
3580 around(string $name, coderef $code) (coderef)
3581  
3582 The around function installs a method modifier that wraps around the original
3583 method, giving you complete control over its execution. The modifier receives
3584 the original method as its first argument, followed by the method's arguments,
3585 and must explicitly call the original method if desired.
3586  
3587 I<Since C<4.15>>
3588  
3589 =over 4
3590  
3591 =item around example 1
3592  
3593 package Example3;
3594  
3595 use Venus::Class 'around', 'attr';
3596  
3597 sub test {
3598 my ($self, $value) = @_;
3599 return $value;
3600 }
3601  
3602 around 'test', sub {
3603 my ($orig, $self, $value) = @_;
3604 my $result = $self->$orig($value);
3605 return $result * 2;
3606 };
3607  
3608 package main;
3609  
3610 my $result = Example3->new->test(5);
3611  
3612 # 10
3613  
3614 =back
3615  
3616 =over 4
3617  
3618 =item around example 2
3619  
3620 package Example4;
3621  
3622 use Venus::Class 'around', 'attr';
3623  
3624 attr 'calls';
3625  
3626 sub BUILD {
3627 my ($self) = @_;
3628 $self->calls([]);
3629 }
3630  
3631 sub test {
3632 my ($self) = @_;
3633 push @{$self->calls}, 'original';
3634 return $self;
3635 }
3636  
3637 around 'test', sub {
3638 my ($orig, $self) = @_;
3639 push @{$self->calls}, 'before';
3640 $self->$orig;
3641 push @{$self->calls}, 'after';
3642 return $self;
3643 };
3644  
3645 package main;
3646  
3647 my $example = Example4->new;
3648 $example->test;
3649 my $calls = $example->calls;
3650  
3651 # ['before', 'original', 'after']
3652  
3653 =back
3654  
3655 =cut
3656  
3657 =head2 array
3658  
3659 array(arrayref | hashref $value, string | coderef $code, any @args) (any)
3660  
3661 The array function builds and returns a L<Venus::Array> object, or dispatches
3662 to the coderef or method provided.
3663  
3664 I<Since C<2.55>>
3665  
3666 =over 4
3667  
3668 =item array example 1
3669  
3670 package main;
3671  
3672 use Venus 'array';
3673  
3674 my $array = array [];
3675  
3676 # bless({...}, 'Venus::Array')
3677  
3678 =back
3679  
3680 =over 4
3681  
3682 =item array example 2
3683  
3684 package main;
3685  
3686 use Venus 'array';
3687  
3688 my $array = array [1..4], 'push', 5..9;
3689  
3690 # [1..9]
3691  
3692 =back
3693  
3694 =cut
3695  
3696 =head2 arrayref
3697  
3698 arrayref(any @args) (arrayref)
3699  
3700 The arrayref function takes a list of arguments and returns a arrayref.
3701  
3702 I<Since C<3.10>>
3703  
3704 =over 4
3705  
3706 =item arrayref example 1
3707  
3708 package main;
3709  
3710 use Venus 'arrayref';
3711  
3712 my $arrayref = arrayref(content => 'example');
3713  
3714 # [content => "example"]
3715  
3716 =back
3717  
3718 =over 4
3719  
3720 =item arrayref example 2
3721  
3722 package main;
3723  
3724 use Venus 'arrayref';
3725  
3726 my $arrayref = arrayref([content => 'example']);
3727  
3728 # [content => "example"]
3729  
3730 =back
3731  
3732 =over 4
3733  
3734 =item arrayref example 3
3735  
3736 package main;
3737  
3738 use Venus 'arrayref';
3739  
3740 my $arrayref = arrayref('content');
3741  
3742 # ['content']
3743  
3744 =back
3745  
3746 =cut
3747  
3748 =head2 assert
3749  
3750 assert(any $data, string $expr) (any)
3751  
3752 The assert function builds a L<Venus::Assert> object and returns the result of
3753 a L<Venus::Assert/validate> operation.
3754  
3755 I<Since C<2.40>>
3756  
3757 =over 4
3758  
3759 =item assert example 1
3760  
3761 package main;
3762  
3763 use Venus 'assert';
3764  
3765 my $assert = assert(1234567890, 'number');
3766  
3767 # 1234567890
3768  
3769 =back
3770  
3771 =over 4
3772  
3773 =item assert example 2
3774  
3775 package main;
3776  
3777 use Venus 'assert';
3778  
3779 my $assert = assert(1234567890, 'float');
3780  
3781 # Exception! (isa Venus::Check::Error)
3782  
3783 =back
3784  
3785 =over 4
3786  
3787 =item assert example 3
3788  
3789 package main;
3790  
3791 use Venus 'assert';
3792  
3793 my $assert = assert(1234567890, 'number | float');
3794  
3795 # 1234567890
3796  
3797 =back
3798  
3799 =cut
3800  
3801 =head2 async
3802  
3803 async(coderef $code, any @args) (Venus::Future)
3804  
3805 The async function accepts a callback and executes it asynchronously via
3806 L<Venus::Process/future>. This function returns a L<Venus::Future> object which
3807 can be fulfilled via L<Venus::Future/wait>.
3808  
3809 I<Since C<3.40>>
3810  
3811 =over 4
3812  
3813 =item async example 1
3814  
3815 package main;
3816  
3817 use Venus 'async';
3818  
3819 my $async = async sub{
3820 'done'
3821 };
3822  
3823 # bless({...}, 'Venus::Future')
3824  
3825 =back
3826  
3827 =cut
3828  
3829 =head2 atom
3830  
3831 atom(any $value) (Venus::Atom)
3832  
3833 The atom function builds and returns a L<Venus::Atom> object.
3834  
3835 I<Since C<3.55>>
3836  
3837 =over 4
3838  
3839 =item atom example 1
3840  
3841 package main;
3842  
3843 use Venus 'atom';
3844  
3845 my $atom = atom 'super-admin';
3846  
3847 # bless({scope => sub{...}}, "Venus::Atom")
3848  
3849 # "$atom"
3850  
3851 # "super-admin"
3852  
3853 =back
3854  
3855 =cut
3856  
3857 =head2 await
3858  
3859 await(Venus::Future $future, number $timeout) (any)
3860  
3861 The await function accepts a L<Venus::Future> object and eventually returns a
3862 value (or values) for it. The value(s) returned are the return values or
3863 emissions from the asychronous callback executed with L</async> which produced
3864 the process object.
3865  
3866 I<Since C<3.40>>
3867  
3868 =over 4
3869  
3870 =item await example 1
3871  
3872 package main;
3873  
3874 use Venus 'async', 'await';
3875  
3876 my $process;
3877  
3878 my $async = async sub{
3879 return 'done';
3880 };
3881  
3882 my $await = await $async;
3883  
3884 # bless(..., "Venus::Future")
3885  
3886 =back
3887  
3888 =cut
3889  
3890 =head2 before
3891  
3892 before(string $name, coderef $code) (coderef)
3893  
3894 The before function installs a method modifier that executes before the
3895 original method, allowing you to perform actions before a method call. B<Note:>
3896 The return value of the modifier routine is ignored; the wrapped method always
3897 returns the value from the original method. Modifiers are executed in the order
3898 they are stacked. This function is always exported unless a routine of the same
3899 name already exists.
3900  
3901 I<Since C<4.15>>
3902  
3903 =over 4
3904  
3905 =item before example 1
3906  
3907 package Example5;
3908  
3909 use Venus::Class 'attr', 'before';
3910  
3911 attr 'calls';
3912  
3913 sub BUILD {
3914 my ($self) = @_;
3915 $self->calls([]);
3916 }
3917  
3918 sub test {
3919 my ($self) = @_;
3920 push @{$self->calls}, 'original';
3921 return $self;
3922 }
3923  
3924 before 'test', sub {
3925 my ($self) = @_;
3926 push @{$self->calls}, 'before';
3927 return $self;
3928 };
3929  
3930 package main;
3931  
3932 my $example = Example5->new;
3933 $example->test;
3934 my $calls = $example->calls;
3935  
3936 # ['before', 'original']
3937  
3938 =back
3939  
3940 =over 4
3941  
3942 =item before example 2
3943  
3944 package Example6;
3945  
3946 use Venus::Class 'attr', 'before';
3947  
3948 attr 'validated';
3949  
3950 sub test {
3951 my ($self, $value) = @_;
3952 return $value;
3953 }
3954  
3955 before 'test', sub {
3956 my ($self, $value) = @_;
3957 $self->validated(1) if $value > 0;
3958 return 'ignored';
3959 };
3960  
3961 package main;
3962  
3963 my $example = Example6->new;
3964 my $value = $example->test(5);
3965  
3966 # 5
3967  
3968 =back
3969  
3970 =cut
3971  
3972 =head2 bool
3973  
3974 bool(any $value) (Venus::Boolean)
3975  
3976 The bool function builds and returns a L<Venus::Boolean> object.
3977  
3978 I<Since C<2.55>>
3979  
3980 =over 4
3981  
3982 =item bool example 1
3983  
3984 package main;
3985  
3986 use Venus 'bool';
3987  
3988 my $bool = bool;
3989  
3990 # bless({value => 0}, 'Venus::Boolean')
3991  
3992 =back
3993  
3994 =over 4
3995  
3996 =item bool example 2
3997  
3998 package main;
3999  
4000 use Venus 'bool';
4001  
4002 my $bool = bool 1_000;
4003  
4004 # bless({value => 1}, 'Venus::Boolean')
4005  
4006 =back
4007  
4008 =cut
4009  
4010 =head2 box
4011  
4012 box(any $data) (Venus::Box)
4013  
4014 The box function returns a L<Venus::Box> object for the argument provided.
4015  
4016 I<Since C<2.32>>
4017  
4018 =over 4
4019  
4020 =item box example 1
4021  
4022 package main;
4023  
4024 use Venus 'box';
4025  
4026 my $box = box({});
4027  
4028 # bless({value => bless({value => {}}, 'Venus::Hash')}, 'Venus::Box')
4029  
4030 =back
4031  
4032 =over 4
4033  
4034 =item box example 2
4035  
4036 package main;
4037  
4038 use Venus 'box';
4039  
4040 my $box = box([]);
4041  
4042 # bless({value => bless({value => []}, 'Venus::Array')}, 'Venus::Box')
4043  
4044 =back
4045  
4046 =cut
4047  
4048 =head2 call
4049  
4050 call(string | object | coderef $data, any @args) (any)
4051  
4052 The call function dispatches function and method calls to a package and returns
4053 the result.
4054  
4055 I<Since C<2.32>>
4056  
4057 =over 4
4058  
4059 =item call example 1
4060  
4061 package main;
4062  
4063 use Venus 'call';
4064  
4065 require Digest::SHA;
4066  
4067 my $result = call(\'Digest::SHA', 'new');
4068  
4069 # bless(do{\(my $o = '...')}, 'digest::sha')
4070  
4071 =back
4072  
4073 =over 4
4074  
4075 =item call example 2
4076  
4077 package main;
4078  
4079 use Venus 'call';
4080  
4081 require Digest::SHA;
4082  
4083 my $result = call('Digest::SHA', 'sha1_hex');
4084  
4085 # "da39a3ee5e6b4b0d3255bfef95601890afd80709"
4086  
4087 =back
4088  
4089 =over 4
4090  
4091 =item call example 3
4092  
4093 package main;
4094  
4095 use Venus 'call';
4096  
4097 require Venus::Hash;
4098  
4099 my $result = call(sub{'Venus::Hash'->new(@_)}, {1..4});
4100  
4101 # bless({value => {1..4}}, 'Venus::Hash')
4102  
4103 =back
4104  
4105 =over 4
4106  
4107 =item call example 4
4108  
4109 package main;
4110  
4111 use Venus 'call';
4112  
4113 require Venus::Box;
4114  
4115 my $result = call(Venus::Box->new(value => {}), 'merge', {1..4});
4116  
4117 # bless({value => bless({value => {1..4}}, 'Venus::Hash')}, 'Venus::Box')
4118  
4119 =back
4120  
4121 =cut
4122  
4123 =head2 cast
4124  
4125 cast(any $data, string $type) (object)
4126  
4127 The cast function returns the argument provided as an object, promoting native
4128 Perl data types to data type objects. The optional second argument can be the
4129 name of the type for the object to cast to explicitly.
4130  
4131 I<Since C<1.40>>
4132  
4133 =over 4
4134  
4135 =item cast example 1
4136  
4137 package main;
4138  
4139 use Venus 'cast';
4140  
4141 my $undef = cast;
4142  
4143 # bless({value => undef}, "Venus::Undef")
4144  
4145 =back
4146  
4147 =over 4
4148  
4149 =item cast example 2
4150  
4151 package main;
4152  
4153 use Venus 'cast';
4154  
4155 my @booleans = map cast, true, false;
4156  
4157 # (bless({value => 1}, "Venus::Boolean"), bless({value => 0}, "Venus::Boolean"))
4158  
4159 =back
4160  
4161 =over 4
4162  
4163 =item cast example 3
4164  
4165 package main;
4166  
4167 use Venus 'cast';
4168  
4169 my $example = cast bless({}, "Example");
4170  
4171 # bless({value => 1}, "Example")
4172  
4173 =back
4174  
4175 =over 4
4176  
4177 =item cast example 4
4178  
4179 package main;
4180  
4181 use Venus 'cast';
4182  
4183 my $float = cast 1.23;
4184  
4185 # bless({value => "1.23"}, "Venus::Float")
4186  
4187 =back
4188  
4189 =cut
4190  
4191 =head2 catch
4192  
4193 catch(coderef $block) (Venus::Error, any)
4194  
4195 The catch function executes the code block trapping errors and returning the
4196 caught exception in scalar context, and also returning the result as a second
4197 argument in list context.
4198  
4199 I<Since C<0.01>>
4200  
4201 =over 4
4202  
4203 =item catch example 1
4204  
4205 package main;
4206  
4207 use Venus 'catch';
4208  
4209 my $error = catch {die};
4210  
4211 $error;
4212  
4213 # "Died at ..."
4214  
4215 =back
4216  
4217 =over 4
4218  
4219 =item catch example 2
4220  
4221 package main;
4222  
4223 use Venus 'catch';
4224  
4225 my ($error, $result) = catch {error};
4226  
4227 $error;
4228  
4229 # bless({...}, 'Venus::Error')
4230  
4231 =back
4232  
4233 =over 4
4234  
4235 =item catch example 3
4236  
4237 package main;
4238  
4239 use Venus 'catch';
4240  
4241 my ($error, $result) = catch {true};
4242  
4243 $result;
4244  
4245 # 1
4246  
4247 =back
4248  
4249 =cut
4250  
4251 =head2 caught
4252  
4253 caught(object $error, string | tuple[string, string] $identity, coderef $block) (any)
4254  
4255 The caught function evaluates the exception object provided and validates its
4256 identity and name (if provided) then executes the code block provided returning
4257 the result of the callback. If no callback is provided this function returns
4258 the exception object on success and C<undef> on failure.
4259  
4260 I<Since C<1.95>>
4261  
4262 =over 4
4263  
4264 =item caught example 1
4265  
4266 package main;
4267  
4268 use Venus 'catch', 'caught', 'error';
4269  
4270 my $error = catch { error };
4271  
4272 my $result = caught $error, 'Venus::Error';
4273  
4274 # bless(..., 'Venus::Error')
4275  
4276 =back
4277  
4278 =over 4
4279  
4280 =item caught example 2
4281  
4282 package main;
4283  
4284 use Venus 'catch', 'caught', 'raise';
4285  
4286 my $error = catch { raise 'Example::Error' };
4287  
4288 my $result = caught $error, 'Venus::Error';
4289  
4290 # bless(..., 'Venus::Error')
4291  
4292 =back
4293  
4294 =over 4
4295  
4296 =item caught example 3
4297  
4298 package main;
4299  
4300 use Venus 'catch', 'caught', 'raise';
4301  
4302 my $error = catch { raise 'Example::Error' };
4303  
4304 my $result = caught $error, 'Example::Error';
4305  
4306 # bless(..., 'Venus::Error')
4307  
4308 =back
4309  
4310 =over 4
4311  
4312 =item caught example 4
4313  
4314 package main;
4315  
4316 use Venus 'catch', 'caught', 'raise';
4317  
4318 my $error = catch { raise 'Example::Error', { name => 'on.test' } };
4319  
4320 my $result = caught $error, ['Example::Error', 'on.test'];
4321  
4322 # bless(..., 'Venus::Error')
4323  
4324 =back
4325  
4326 =over 4
4327  
4328 =item caught example 5
4329  
4330 package main;
4331  
4332 use Venus 'catch', 'caught', 'raise';
4333  
4334 my $error = catch { raise 'Example::Error', { name => 'on.recv' } };
4335  
4336 my $result = caught $error, ['Example::Error', 'on.send'];
4337  
4338 # undef
4339  
4340 =back
4341  
4342 =over 4
4343  
4344 =item caught example 6
4345  
4346 package main;
4347  
4348 use Venus 'catch', 'caught', 'error';
4349  
4350 my $error = catch { error };
4351  
4352 my $result = caught $error, ['Example::Error', 'on.send'];
4353  
4354 # undef
4355  
4356 =back
4357  
4358 =over 4
4359  
4360 =item caught example 7
4361  
4362 package main;
4363  
4364 use Venus 'catch', 'caught', 'error';
4365  
4366 my $error = catch { error };
4367  
4368 my $result = caught $error, ['Example::Error'];
4369  
4370 # undef
4371  
4372 =back
4373  
4374 =over 4
4375  
4376 =item caught example 8
4377  
4378 package main;
4379  
4380 use Venus 'catch', 'caught', 'error';
4381  
4382 my $error = catch { error };
4383  
4384 my $result = caught $error, 'Example::Error';
4385  
4386 # undef
4387  
4388 =back
4389  
4390 =over 4
4391  
4392 =item caught example 9
4393  
4394 package main;
4395  
4396 use Venus 'catch', 'caught', 'error';
4397  
4398 my $error = catch { error { name => 'on.send' } };
4399  
4400 my $result = caught $error, ['Venus::Error', 'on.send'];
4401  
4402 # bless(..., 'Venus::Error')
4403  
4404 =back
4405  
4406 =over 4
4407  
4408 =item caught example 10
4409  
4410 package main;
4411  
4412 use Venus 'catch', 'caught', 'error';
4413  
4414 my $error = catch { error { name => 'on.send.open' } };
4415  
4416 my $result = caught $error, ['Venus::Error', 'on.send'], sub {
4417 $error->stash('caught', true) if $error->is('on.send.open');
4418 return $error;
4419 };
4420  
4421 # bless(..., 'Venus::Error')
4422  
4423 =back
4424  
4425 =cut
4426  
4427 =head2 chain
4428  
4429 chain(string | object | coderef $self, string | within[arrayref, string] @args) (any)
4430  
4431 The chain function chains function and method calls to a package (and return
4432 values) and returns the result.
4433  
4434 I<Since C<2.32>>
4435  
4436 =over 4
4437  
4438 =item chain example 1
4439  
4440 package main;
4441  
4442 use Venus 'chain';
4443  
4444 my $result = chain('Venus::Path', ['new', 't'], 'exists');
4445  
4446 # 1
4447  
4448 =back
4449  
4450 =over 4
4451  
4452 =item chain example 2
4453  
4454 package main;
4455  
4456 use Venus 'chain';
4457  
4458 my $result = chain('Venus::Path', ['new', 't'], ['test', 'd']);
4459  
4460 # 1
4461  
4462 =back
4463  
4464 =cut
4465  
4466 =head2 check
4467  
4468 check(any $data, string $expr) (boolean)
4469  
4470 The check function builds a L<Venus::Assert> object and returns the result of
4471 a L<Venus::Assert/check> operation.
4472  
4473 I<Since C<2.40>>
4474  
4475 =over 4
4476  
4477 =item check example 1
4478  
4479 package main;
4480  
4481 use Venus 'check';
4482  
4483 my $check = check(rand, 'float');
4484  
4485 # true
4486  
4487 =back
4488  
4489 =over 4
4490  
4491 =item check example 2
4492  
4493 package main;
4494  
4495 use Venus 'check';
4496  
4497 my $check = check(rand, 'string');
4498  
4499 # false
4500  
4501 =back
4502  
4503 =cut
4504  
4505 =head2 clargs
4506  
4507 clargs(arrayref $args, arrayref $spec) (Venus::Args, Venus::Opts, Venus::Vars)
4508  
4509 The clargs function accepts a single arrayref of L<Getopt::Long> specs, or an
4510 arrayref of arguments followed by an arrayref of L<Getopt::Long> specs, and
4511 returns a three element list of L<Venus::Args>, L<Venus::Opts>, and
4512 L<Venus::Vars> objects. If only a single arrayref is provided, the arguments
4513 will be taken from C<@ARGV>. If this function is called in scalar context only
4514 the L<Venus::Opts> object will be returned.
4515  
4516 I<Since C<3.10>>
4517  
4518 =over 4
4519  
4520 =item clargs example 1
4521  
4522 package main;
4523  
4524 use Venus 'clargs';
4525  
4526 my ($args, $opts, $vars) = clargs;
4527  
4528 # (
4529 # bless(..., 'Venus::Args'),
4530 # bless(..., 'Venus::Opts'),
4531 # bless(..., 'Venus::Vars')
4532 # )
4533  
4534 =back
4535  
4536 =over 4
4537  
4538 =item clargs example 2
4539  
4540 package main;
4541  
4542 use Venus 'clargs';
4543  
4544 my ($args, $opts, $vars) = clargs ['resource|r=s', 'help|h'];
4545  
4546 # (
4547 # bless(..., 'Venus::Args'),
4548 # bless(..., 'Venus::Opts'),
4549 # bless(..., 'Venus::Vars')
4550 # )
4551  
4552 =back
4553  
4554 =over 4
4555  
4556 =item clargs example 3
4557  
4558 package main;
4559  
4560 use Venus 'clargs';
4561  
4562 my ($args, $opts, $vars) = clargs ['--resource', 'help'],
4563 ['resource|r=s', 'help|h'];
4564  
4565 # (
4566 # bless(..., 'Venus::Args'),
4567 # bless(..., 'Venus::Opts'),
4568 # bless(..., 'Venus::Vars')
4569 # )
4570  
4571 =back
4572  
4573 =over 4
4574  
4575 =item clargs example 4
4576  
4577 package main;
4578  
4579 use Venus 'clargs';
4580  
4581 my ($args, $opts, $vars) = clargs ['--help', 'how-to'],
4582 ['resource|r=s', 'help|h'];
4583  
4584 # (
4585 # bless(..., 'Venus::Args'),
4586 # bless(..., 'Venus::Opts'),
4587 # bless(..., 'Venus::Vars')
4588 # )
4589  
4590 =back
4591  
4592 =over 4
4593  
4594 =item clargs example 5
4595  
4596 package main;
4597  
4598 use Venus 'clargs';
4599  
4600 my $opts = clargs ['--help', 'how-to'], ['resource|r=s', 'help|h'];
4601  
4602 # bless(..., 'Venus::Opts'),
4603  
4604 =back
4605  
4606 =cut
4607  
4608 =head2 cli
4609  
4610 cli(arrayref $args) (Venus::Cli)
4611  
4612 The cli function builds and returns a L<Venus::Cli> object.
4613  
4614 I<Since C<2.55>>
4615  
4616 =over 4
4617  
4618 =item cli example 1
4619  
4620 package main;
4621  
4622 use Venus 'cli';
4623  
4624 my $cli = cli;
4625  
4626 # bless({...}, 'Venus::Cli')
4627  
4628 =back
4629  
4630 =over 4
4631  
4632 =item cli example 2
4633  
4634 package main;
4635  
4636 use Venus 'cli';
4637  
4638 my $cli = cli 'mycli';
4639  
4640 # bless({...}, 'Venus::Cli')
4641  
4642 # $cli->boolean('option', 'help');
4643  
4644 # $cli->parse('--help');
4645  
4646 # $cli->option_value('help');
4647  
4648 # 1
4649  
4650 =back
4651  
4652 =cut
4653  
4654 =head2 clone
4655  
4656 clone(ref $value) (ref)
4657  
4658 The clone function uses L<Storable/dclone> to perform a deep clone of the
4659 reference provided and returns a copy.
4660  
4661 I<Since C<3.55>>
4662  
4663 =over 4
4664  
4665 =item clone example 1
4666  
4667 package main;
4668  
4669 use Venus 'clone';
4670  
4671 my $orig = {1..4};
4672  
4673 my $clone = clone $orig;
4674  
4675 $orig->{3} = 5;
4676  
4677 my $result = $clone;
4678  
4679 # {1..4}
4680  
4681 =back
4682  
4683 =over 4
4684  
4685 =item clone example 2
4686  
4687 package main;
4688  
4689 use Venus 'clone';
4690  
4691 my $orig = {1,2,3,{1..4}};
4692  
4693 my $clone = clone $orig;
4694  
4695 $orig->{3}->{3} = 5;
4696  
4697 my $result = $clone;
4698  
4699 # {1,2,3,{1..4}}
4700  
4701 =back
4702  
4703 =cut
4704  
4705 =head2 code
4706  
4707 code(coderef $value, string | coderef $code, any @args) (any)
4708  
4709 The code function builds and returns a L<Venus::Code> object, or dispatches
4710 to the coderef or method provided.
4711  
4712 I<Since C<2.55>>
4713  
4714 =over 4
4715  
4716 =item code example 1
4717  
4718 package main;
4719  
4720 use Venus 'code';
4721  
4722 my $code = code sub {};
4723  
4724 # bless({...}, 'Venus::Code')
4725  
4726 =back
4727  
4728 =over 4
4729  
4730 =item code example 2
4731  
4732 package main;
4733  
4734 use Venus 'code';
4735  
4736 my $code = code sub {[1, @_]}, 'curry', 2,3,4;
4737  
4738 # sub {...}
4739  
4740 =back
4741  
4742 =cut
4743  
4744 =head2 collect
4745  
4746 collect(any $value, coderef $code) (any)
4747  
4748 The collect function uses L<Venus::Collect> to iterate over the value and
4749 selectively transform or filter the data. The function supports both list-like
4750 and hash-like data structures, handling key/value iteration when applicable.
4751  
4752 I<Since C<4.15>>
4753  
4754 =over 4
4755  
4756 =item collect example 1
4757  
4758 package main;
4759  
4760 use Venus 'collect';
4761  
4762 my $collect = collect [];
4763  
4764 # []
4765  
4766 =back
4767  
4768 =over 4
4769  
4770 =item collect example 2
4771  
4772 package main;
4773  
4774 use Venus 'collect';
4775  
4776 my $collect = collect [1..4], sub{$_%2==0?(@_):()};
4777  
4778 # [2,4]
4779  
4780 =back
4781  
4782 =over 4
4783  
4784 =item collect example 3
4785  
4786 package main;
4787  
4788 use Venus 'collect';
4789  
4790 my $collect = collect {};
4791  
4792 # {}
4793  
4794 =back
4795  
4796 =over 4
4797  
4798 =item collect example 4
4799  
4800 package main;
4801  
4802 use Venus 'collect';
4803  
4804 my $collect = collect {1..8}, sub{$_%6==0?(@_):()};
4805  
4806 # {5,6}
4807  
4808 =back
4809  
4810 =cut
4811  
4812 =head2 concat
4813  
4814 concat(any @args) (string)
4815  
4816 The concat function stringifies and L<"joins"|perlfunc/join> multiple values delimited
4817 by a single space and returns the resulting string.
4818  
4819 I<Since C<4.15>>
4820  
4821 =over 4
4822  
4823 =item concat example 1
4824  
4825 # given: synopsis
4826  
4827 package main;
4828  
4829 use Venus 'concat';
4830  
4831 my $concat = concat;
4832  
4833 # ""
4834  
4835 =back
4836  
4837 =over 4
4838  
4839 =item concat example 2
4840  
4841 # given: synopsis
4842  
4843 package main;
4844  
4845 use Venus 'concat';
4846  
4847 my $concat = concat 'hello';
4848  
4849 # "hello"
4850  
4851 =back
4852  
4853 =over 4
4854  
4855 =item concat example 3
4856  
4857 # given: synopsis
4858  
4859 package main;
4860  
4861 use Venus 'concat';
4862  
4863 my $concat = concat 'hello', 'world';
4864  
4865 # "hello world"
4866  
4867 =back
4868  
4869 =over 4
4870  
4871 =item concat example 4
4872  
4873 # given: synopsis
4874  
4875 package main;
4876  
4877 use Venus 'concat';
4878  
4879 my $concat = concat 'value is', [1,2];
4880  
4881 # "value is [1,2]"
4882  
4883 =back
4884  
4885 =over 4
4886  
4887 =item concat example 5
4888  
4889 # given: synopsis
4890  
4891 package main;
4892  
4893 use Venus 'concat';
4894  
4895 my $concat = concat 'value is', [1,2], 'and', [3,4];
4896  
4897 # "value is [1,2] and [3,4]"
4898  
4899 =back
4900  
4901 =cut
4902  
4903 =head2 config
4904  
4905 config(hashref $value, string | coderef $code, any @args) (any)
4906  
4907 The config function builds and returns a L<Venus::Config> object, or dispatches
4908 to the coderef or method provided.
4909  
4910 I<Since C<2.55>>
4911  
4912 =over 4
4913  
4914 =item config example 1
4915  
4916 package main;
4917  
4918 use Venus 'config';
4919  
4920 my $config = config {};
4921  
4922 # bless({...}, 'Venus::Config')
4923  
4924 =back
4925  
4926 =over 4
4927  
4928 =item config example 2
4929  
4930 package main;
4931  
4932 use Venus 'config';
4933  
4934 my $config = config {}, 'read_perl', '{"data"=>1}';
4935  
4936 # bless({...}, 'Venus::Config')
4937  
4938 =back
4939  
4940 =cut
4941  
4942 =head2 cop
4943  
4944 cop(string | object | coderef $self, string $name) (coderef)
4945  
4946 The cop function attempts to curry the given subroutine on the object or class
4947 and if successful returns a closure.
4948  
4949 I<Since C<2.32>>
4950  
4951 =over 4
4952  
4953 =item cop example 1
4954  
4955 package main;
4956  
4957 use Venus 'cop';
4958  
4959 my $coderef = cop('Digest::SHA', 'sha1_hex');
4960  
4961 # sub { ... }
4962  
4963 =back
4964  
4965 =over 4
4966  
4967 =item cop example 2
4968  
4969 package main;
4970  
4971 use Venus 'cop';
4972  
4973 require Digest::SHA;
4974  
4975 my $coderef = cop(Digest::SHA->new, 'digest');
4976  
4977 # sub { ... }
4978  
4979 =back
4980  
4981 =cut
4982  
4983 =head2 data
4984  
4985 data(any $value, string | coderef $code, any @args) (any)
4986  
4987 The data function builds and returns a L<Venus::Data> object, or dispatches to
4988 the coderef or method provided.
4989  
4990 I<Since C<4.15>>
4991  
4992 =over 4
4993  
4994 =item data example 1
4995  
4996 package main;
4997  
4998 use Venus 'data';
4999  
5000 my $data = data {value => {name => 'Elliot'}};
5001  
5002 # bless({...}, 'Venus::Data')
5003  
5004 =back
5005  
5006 =over 4
5007  
5008 =item data example 2
5009  
5010 package main;
5011  
5012 use Venus 'data';
5013  
5014 my $data = data {value => {name => 'Elliot'}}, 'valid';
5015  
5016 # 1
5017  
5018 =back
5019  
5020 =over 4
5021  
5022 =item data example 3
5023  
5024 package main;
5025  
5026 use Venus 'data';
5027  
5028 my $data = data {value => {name => 'Elliot'}}, 'shorthand', ['name!' => 'string'];
5029  
5030 # bless({...}, 'Venus::Data')
5031  
5032 # $data->valid;
5033  
5034 # 1
5035  
5036 =back
5037  
5038 =over 4
5039  
5040 =item data example 4
5041  
5042 package main;
5043  
5044 use Venus 'data';
5045  
5046 my $data = data {value => {name => undef}}, 'shorthand', ['name!' => 'string'];
5047  
5048 # bless({...}, 'Venus::Data')
5049  
5050 # $data->valid;
5051  
5052 # 0
5053  
5054 =back
5055  
5056 =cut
5057  
5058 =head2 date
5059  
5060 date(number $value, string | coderef $code, any @args) (any)
5061  
5062 The date function builds and returns a L<Venus::Date> object, or dispatches to
5063 the coderef or method provided.
5064  
5065 I<Since C<2.40>>
5066  
5067 =over 4
5068  
5069 =item date example 1
5070  
5071 package main;
5072  
5073 use Venus 'date';
5074  
5075 my $date = date time, 'string';
5076  
5077 # '0000-00-00T00:00:00Z'
5078  
5079 =back
5080  
5081 =over 4
5082  
5083 =item date example 2
5084  
5085 package main;
5086  
5087 use Venus 'date';
5088  
5089 my $date = date time, 'reset', 570672000;
5090  
5091 # bless({...}, 'Venus::Date')
5092  
5093 # $date->string;
5094  
5095 # '1988-02-01T00:00:00Z'
5096  
5097 =back
5098  
5099 =over 4
5100  
5101 =item date example 3
5102  
5103 package main;
5104  
5105 use Venus 'date';
5106  
5107 my $date = date time;
5108  
5109 # bless({...}, 'Venus::Date')
5110  
5111 =back
5112  
5113 =cut
5114  
5115 =head2 enum
5116  
5117 enum(arrayref | hashref $value) (Venus::Enum)
5118  
5119 The enum function builds and returns a L<Venus::Enum> object.
5120  
5121 I<Since C<3.55>>
5122  
5123 =over 4
5124  
5125 =item enum example 1
5126  
5127 package main;
5128  
5129 use Venus 'enum';
5130  
5131 my $themes = enum ['light', 'dark'];
5132  
5133 # bless({scope => sub{...}}, "Venus::Enum")
5134  
5135 # my $result = $themes->get('dark');
5136  
5137 # bless({scope => sub{...}}, "Venus::Enum")
5138  
5139 # "$result"
5140  
5141 # "dark"
5142  
5143 =back
5144  
5145 =over 4
5146  
5147 =item enum example 2
5148  
5149 package main;
5150  
5151 use Venus 'enum';
5152  
5153 my $themes = enum {
5154 light => 'light_theme',
5155 dark => 'dark_theme',
5156 };
5157  
5158 # bless({scope => sub{...}}, "Venus::Enum")
5159  
5160 # my $result = $themes->get('dark');
5161  
5162 # bless({scope => sub{...}}, "Venus::Enum")
5163  
5164 # "$result"
5165  
5166 # "dark_theme"
5167  
5168 =back
5169  
5170 =cut
5171  
5172 =head2 error
5173  
5174 error(maybe[hashref] $args) (Venus::Error)
5175  
5176 The error function throws a L<Venus::Error> exception object using the
5177 exception object arguments provided.
5178  
5179 I<Since C<0.01>>
5180  
5181 =over 4
5182  
5183 =item error example 1
5184  
5185 package main;
5186  
5187 use Venus 'error';
5188  
5189 my $error = error;
5190  
5191 # bless({...}, 'Venus::Error')
5192  
5193 =back
5194  
5195 =over 4
5196  
5197 =item error example 2
5198  
5199 package main;
5200  
5201 use Venus 'error';
5202  
5203 my $error = error {
5204 message => 'Something failed!',
5205 };
5206  
5207 # bless({message => 'Something failed!', ...}, 'Venus::Error')
5208  
5209 =back
5210  
5211 =cut
5212  
5213 =head2 factory
5214  
5215 factory(hashref $value, string | coderef $code, any @args) (any)
5216  
5217 The factory function builds and returns a L<Venus::Factory> object, or
5218 dispatches to the coderef or method provided.
5219  
5220 I<Since C<4.15>>
5221  
5222 =over 4
5223  
5224 =item factory example 1
5225  
5226 package main;
5227  
5228 use Venus 'factory';
5229  
5230 my $factory = factory {};
5231  
5232 # bless(..., 'Venus::Factory')
5233  
5234 =back
5235  
5236 =over 4
5237  
5238 =item factory example 2
5239  
5240 package main;
5241  
5242 use Venus 'factory';
5243  
5244 my $path = factory {name => 'path', value => ['/tmp/log']}, 'class', 'Venus::Path';
5245  
5246 # bless(..., 'Venus::Factory')
5247  
5248 # $path->build;
5249  
5250 # bless({value => '/tmp/log'}, 'Venus::Path')
5251  
5252 =back
5253  
5254 =cut
5255  
5256 =head2 false
5257  
5258 false() (boolean)
5259  
5260 The false function returns a falsy boolean value which is designed to be
5261 practically indistinguishable from the conventional numerical C<0> value.
5262  
5263 I<Since C<0.01>>
5264  
5265 =over 4
5266  
5267 =item false example 1
5268  
5269 package main;
5270  
5271 use Venus;
5272  
5273 my $false = false;
5274  
5275 # 0
5276  
5277 =back
5278  
5279 =over 4
5280  
5281 =item false example 2
5282  
5283 package main;
5284  
5285 use Venus;
5286  
5287 my $true = !false;
5288  
5289 # 1
5290  
5291 =back
5292  
5293 =cut
5294  
5295 =head2 fault
5296  
5297 fault(string $args) (Venus::Fault)
5298  
5299 The fault function throws a L<Venus::Fault> exception object and represents a
5300 system failure, and isn't meant to be caught.
5301  
5302 I<Since C<1.80>>
5303  
5304 =over 4
5305  
5306 =item fault example 1
5307  
5308 package main;
5309  
5310 use Venus 'fault';
5311  
5312 my $fault = fault;
5313  
5314 # bless({message => 'Exception!'}, 'Venus::Fault')
5315  
5316 =back
5317  
5318 =over 4
5319  
5320 =item fault example 2
5321  
5322 package main;
5323  
5324 use Venus 'fault';
5325  
5326 my $fault = fault 'Something failed!';
5327  
5328 # bless({message => 'Something failed!'}, 'Venus::Fault')
5329  
5330 =back
5331  
5332 =cut
5333  
5334 =head2 flat
5335  
5336 flat(any @args) (any)
5337  
5338 The flat function take a list of arguments and flattens them where possible and
5339 returns the list of flattened values. When a hashref is encountered, it will be
5340 flattened into key/value pairs. When an arrayref is encountered, it will be
5341 flattened into a list of items.
5342  
5343 I<Since C<4.15>>
5344  
5345 =over 4
5346  
5347 =item flat example 1
5348  
5349 package main;
5350  
5351 use Venus 'flat';
5352  
5353 my @flat = flat 1, 2, 3;
5354  
5355 # (1, 2, 3)
5356  
5357 =back
5358  
5359 =over 4
5360  
5361 =item flat example 2
5362  
5363 package main;
5364  
5365 use Venus 'flat';
5366  
5367 my @flat = flat 1, 2, 3, [1, 2, 3];
5368  
5369 # (1, 2, 3, 1, 2, 3)
5370  
5371 =back
5372  
5373 =over 4
5374  
5375 =item flat example 3
5376  
5377 package main;
5378  
5379 use Venus 'flat';
5380  
5381 my @flat = flat 1, 2, 3, [1, 2, 3], {1, 2};
5382  
5383 # (1, 2, 3, 1, 2, 3, 1, 2)
5384  
5385 =back
5386  
5387 =cut
5388  
5389 =head2 float
5390  
5391 float(string $value, string | coderef $code, any @args) (any)
5392  
5393 The float function builds and returns a L<Venus::Float> object, or dispatches
5394 to the coderef or method provided.
5395  
5396 I<Since C<2.55>>
5397  
5398 =over 4
5399  
5400 =item float example 1
5401  
5402 package main;
5403  
5404 use Venus 'float';
5405  
5406 my $float = float 1.23;
5407  
5408 # bless({...}, 'Venus::Float')
5409  
5410 =back
5411  
5412 =over 4
5413  
5414 =item float example 2
5415  
5416 package main;
5417  
5418 use Venus 'float';
5419  
5420 my $float = float 1.23, 'int';
5421  
5422 # 1
5423  
5424 =back
5425  
5426 =cut
5427  
5428 =head2 future
5429  
5430 future(coderef $code) (Venus::Future)
5431  
5432 The future function builds and returns a L<Venus::Future> object.
5433  
5434 I<Since C<3.55>>
5435  
5436 =over 4
5437  
5438 =item future example 1
5439  
5440 package main;
5441  
5442 use Venus 'future';
5443  
5444 my $future = future(sub{
5445 my ($resolve, $reject) = @_;
5446  
5447 return int(rand(2)) ? $resolve->result('pass') : $reject->result('fail');
5448 });
5449  
5450 # bless(..., "Venus::Future")
5451  
5452 # $future->is_pending;
5453  
5454 # false
5455  
5456 =back
5457  
5458 =cut
5459  
5460 =head2 gather
5461  
5462 gather(any $value, coderef $callback) (any)
5463  
5464 The gather function builds a L<Venus::Gather> object, passing it and the value
5465 provided to the callback provided, and returns the return value from
5466 L<Venus::Gather/result>.
5467  
5468 I<Since C<2.50>>
5469  
5470 =over 4
5471  
5472 =item gather example 1
5473  
5474 package main;
5475  
5476 use Venus 'gather';
5477  
5478 my $gather = gather ['a'..'d'];
5479  
5480 # bless({...}, 'Venus::Gather')
5481  
5482 # $gather->result;
5483  
5484 # undef
5485  
5486 =back
5487  
5488 =over 4
5489  
5490 =item gather example 2
5491  
5492 package main;
5493  
5494 use Venus 'gather';
5495  
5496 my $gather = gather ['a'..'d'], sub {{
5497 a => 1,
5498 b => 2,
5499 c => 3,
5500 }};
5501  
5502 # [1..3]
5503  
5504 =back
5505  
5506 =over 4
5507  
5508 =item gather example 3
5509  
5510 package main;
5511  
5512 use Venus 'gather';
5513  
5514 my $gather = gather ['e'..'h'], sub {{
5515 a => 1,
5516 b => 2,
5517 c => 3,
5518 }};
5519  
5520 # []
5521  
5522 =back
5523  
5524 =over 4
5525  
5526 =item gather example 4
5527  
5528 package main;
5529  
5530 use Venus 'gather';
5531  
5532 my $gather = gather ['a'..'d'], sub {
5533 my ($case) = @_;
5534  
5535 $case->when(sub{lc($_) eq 'a'})->then('a -> A');
5536 $case->when(sub{lc($_) eq 'b'})->then('b -> B');
5537 };
5538  
5539 # ['a -> A', 'b -> B']
5540  
5541 =back
5542  
5543 =over 4
5544  
5545 =item gather example 5
5546  
5547 package main;
5548  
5549 use Venus 'gather';
5550  
5551 my $gather = gather ['a'..'d'], sub {
5552  
5553 $_->when(sub{lc($_) eq 'a'})->then('a -> A');
5554 $_->when(sub{lc($_) eq 'b'})->then('b -> B');
5555 };
5556  
5557 # ['a -> A', 'b -> B']
5558  
5559 =back
5560  
5561 =cut
5562  
5563 =head2 gets
5564  
5565 gets(string @args) (arrayref)
5566  
5567 The gets function select values from within the underlying data structure using
5568 L<Venus::Array/path> or L<Venus::Hash/path>, where each argument is a selector,
5569 returns all the values selected. Returns a list in list context.
5570  
5571 I<Since C<4.15>>
5572  
5573 =over 4
5574  
5575 =item gets example 1
5576  
5577 package main;
5578  
5579 use Venus 'gets';
5580  
5581 my $data = {'foo' => {'bar' => 'baz'}, 'bar' => ['baz']};
5582  
5583 my $gets = gets $data, 'bar', 'foo.bar';
5584  
5585 # [['baz'], 'baz']
5586  
5587 =back
5588  
5589 =over 4
5590  
5591 =item gets example 2
5592  
5593 package main;
5594  
5595 use Venus 'gets';
5596  
5597 my $data = {'foo' => {'bar' => 'baz'}, 'bar' => ['baz']};
5598  
5599 my ($bar, $foo_bar) = gets $data, 'bar', 'foo.bar';
5600  
5601 # (['baz'], 'baz')
5602  
5603 =back
5604  
5605 =over 4
5606  
5607 =item gets example 3
5608  
5609 package main;
5610  
5611 use Venus 'gets';
5612  
5613 my $data = ['foo', {'bar' => 'baz'}, 'bar', ['baz']];
5614  
5615 my $gets = gets $data, '3', '1.bar';
5616  
5617 # [['baz'], 'baz']
5618  
5619 =back
5620  
5621 =over 4
5622  
5623 =item gets example 4
5624  
5625 package main;
5626  
5627 use Venus 'gets';
5628  
5629 my $data = ['foo', {'bar' => 'baz'}, 'bar', ['baz']];
5630  
5631 my ($baz, $one_bar) = gets $data, '3', '1.bar';
5632  
5633 # (['baz'], 'baz')
5634  
5635 =back
5636  
5637 =cut
5638  
5639 =head2 handle
5640  
5641 handle(string $name, coderef $code) (coderef)
5642  
5643 The handle function installs a method modifier that wraps a method similar to
5644 L</around>, but is the low-level implementation. The modifier receives the
5645 original method as its first argument (which may be undef if the method doesn't
5646 exist), followed by the method's arguments. This is the foundation for the
5647 other method modifiers.
5648  
5649 I<Since C<4.15>>
5650  
5651 =over 4
5652  
5653 =item handle example 1
5654  
5655 package Example7;
5656  
5657 use Venus::Class 'handle';
5658  
5659 sub test {
5660 my ($self, $value) = @_;
5661 return $value;
5662 }
5663  
5664 handle 'test', sub {
5665 my ($orig, $self, $value) = @_;
5666 return $orig ? $self->$orig($value * 2) : 0;
5667 };
5668  
5669 package main;
5670  
5671 my $result = Example7->new->test(5);
5672  
5673 # 10
5674  
5675 =back
5676  
5677 =over 4
5678  
5679 =item handle example 2
5680  
5681 package Example8;
5682  
5683 use Venus::Class 'handle';
5684  
5685 handle 'missing', sub {
5686 my ($orig, $self) = @_;
5687 return 'method does not exist';
5688 };
5689  
5690 package main;
5691  
5692 my $result = Example8->new->missing;
5693  
5694 # "method does not exist"
5695  
5696 =back
5697  
5698 =cut
5699  
5700 =head2 hash
5701  
5702 hash(hashref $value, string | coderef $code, any @args) (any)
5703  
5704 The hash function builds and returns a L<Venus::Hash> object, or dispatches
5705 to the coderef or method provided.
5706  
5707 I<Since C<2.55>>
5708  
5709 =over 4
5710  
5711 =item hash example 1
5712  
5713 package main;
5714  
5715 use Venus 'hash';
5716  
5717 my $hash = hash {1..4};
5718  
5719 # bless({...}, 'Venus::Hash')
5720  
5721 =back
5722  
5723 =over 4
5724  
5725 =item hash example 2
5726  
5727 package main;
5728  
5729 use Venus 'hash';
5730  
5731 my $hash = hash {1..8}, 'pairs';
5732  
5733 # [[1, 2], [3, 4], [5, 6], [7, 8]]
5734  
5735 =back
5736  
5737 =cut
5738  
5739 =head2 hashref
5740  
5741 hashref(any @args) (hashref)
5742  
5743 The hashref function takes a list of arguments and returns a hashref.
5744  
5745 I<Since C<3.10>>
5746  
5747 =over 4
5748  
5749 =item hashref example 1
5750  
5751 package main;
5752  
5753 use Venus 'hashref';
5754  
5755 my $hashref = hashref(content => 'example');
5756  
5757 # {content => "example"}
5758  
5759 =back
5760  
5761 =over 4
5762  
5763 =item hashref example 2
5764  
5765 package main;
5766  
5767 use Venus 'hashref';
5768  
5769 my $hashref = hashref({content => 'example'});
5770  
5771 # {content => "example"}
5772  
5773 =back
5774  
5775 =over 4
5776  
5777 =item hashref example 3
5778  
5779 package main;
5780  
5781 use Venus 'hashref';
5782  
5783 my $hashref = hashref('content');
5784  
5785 # {content => undef}
5786  
5787 =back
5788  
5789 =over 4
5790  
5791 =item hashref example 4
5792  
5793 package main;
5794  
5795 use Venus 'hashref';
5796  
5797 my $hashref = hashref('content', 'example', 'algorithm');
5798  
5799 # {content => "example", algorithm => undef}
5800  
5801 =back
5802  
5803 =cut
5804  
5805 =head2 hook
5806  
5807 hook(string $type, string $name, coderef $code) (coderef)
5808  
5809 The hook function is a specialized method modifier helper that applies a
5810 modifier (after, around, before, or handle) to a lifecycle hook method. It
5811 automatically uppercases the hook name, making it convenient for modifying
5812 Venus lifecycle hooks like BUILD, BLESS, BUILDARGS, and AUDIT.
5813  
5814 I<Since C<4.15>>
5815  
5816 =over 4
5817  
5818 =item hook example 1
5819  
5820 package Example9;
5821  
5822 use Venus::Class 'attr', 'hook';
5823  
5824 attr 'startup';
5825  
5826 sub BUILD {
5827 my ($self, $args) = @_;
5828 $self->startup('original');
5829 }
5830  
5831 hook 'after', 'build', sub {
5832 my ($self) = @_;
5833 $self->startup('modified');
5834 };
5835  
5836 package main;
5837  
5838 my $result = Example9->new->startup;
5839  
5840 # "modified"
5841  
5842 =back
5843  
5844 =over 4
5845  
5846 =item hook example 2
5847  
5848 package Example10;
5849  
5850 use Venus::Class 'attr', 'hook';
5851  
5852 attr 'calls';
5853  
5854 sub BUILD {
5855 my ($self, $args) = @_;
5856 $self->calls([]) if !$self->calls;
5857 push @{$self->calls}, 'BUILD';
5858 }
5859  
5860 hook 'before', 'build', sub {
5861 my ($self) = @_;
5862 $self->calls([]) if !$self->calls;
5863 push @{$self->calls}, 'before';
5864 };
5865  
5866 package main;
5867  
5868 my $example = Example10->new;
5869 my $calls = $example->calls;
5870  
5871 # ['before', 'BUILD']
5872  
5873 =back
5874  
5875 =cut
5876  
5877 =head2 in
5878  
5879 in(arrayref | hashref | consumes[Venus::Role::Mappable] $lvalue, any $rvalue) (boolean)
5880  
5881 The in function accepts an arrayref, hashref, or
5882 L<"mappable"|Venus::Role::Mappable> and returns true if the type and value of
5883 the rvalue is the same for any items in the collection.
5884  
5885 I<Since C<4.15>>
5886  
5887 =over 4
5888  
5889 =item in example 1
5890  
5891 # given: synopsis
5892  
5893 package main;
5894  
5895 use Venus 'in';
5896  
5897 my $in = in [1, '1'], 1;
5898  
5899 # true
5900  
5901 =back
5902  
5903 =over 4
5904  
5905 =item in example 2
5906  
5907 # given: synopsis
5908  
5909 package main;
5910  
5911 use Venus 'in';
5912  
5913 my $in = in [1, 1], 0;
5914  
5915 # false
5916  
5917 =back
5918  
5919 =over 4
5920  
5921 =item in example 3
5922  
5923 # given: synopsis
5924  
5925 package main;
5926  
5927 use Venus 'in';
5928  
5929 my $in = in {1, 2}, 1;
5930  
5931 # false
5932  
5933 =back
5934  
5935 =over 4
5936  
5937 =item in example 4
5938  
5939 # given: synopsis
5940  
5941 package main;
5942  
5943 use Venus 'in';
5944  
5945 my $in = in {1, 1}, 1;
5946  
5947 # true
5948  
5949 =back
5950  
5951 =over 4
5952  
5953 =item in example 5
5954  
5955 # given: synopsis
5956  
5957 package main;
5958  
5959 use Venus 'in';
5960  
5961 my $in = in [[0], [1]], [1];
5962  
5963 # true
5964  
5965 =back
5966  
5967 =cut
5968  
5969 =head2 is
5970  
5971 is(any $lvalue, any $rvalue) (boolean)
5972  
5973 The is function returns true if the lvalue and rvalue are identical, i.e.
5974 refers to the same memory address, otherwise returns false.
5975  
5976 I<Since C<4.15>>
5977  
5978 =over 4
5979  
5980 =item is example 1
5981  
5982 # given: synopsis
5983  
5984 package main;
5985  
5986 use Venus 'is';
5987  
5988 my $is = is 1, 1;
5989  
5990 # false
5991  
5992 =back
5993  
5994 =over 4
5995  
5996 =item is example 2
5997  
5998 # given: synopsis
5999  
6000 package main;
6001  
6002 use Venus 'is', 'number';
6003  
6004 my $a = number 1;
6005  
6006 my $is = is $a, 1;
6007  
6008 # false
6009  
6010 =back
6011  
6012 =over 4
6013  
6014 =item is example 3
6015  
6016 # given: synopsis
6017  
6018 package main;
6019  
6020 use Venus 'is', 'number';
6021  
6022 my $a = number 1;
6023  
6024 my $is = is $a, $a;
6025  
6026 # true
6027  
6028 =back
6029  
6030 =over 4
6031  
6032 =item is example 4
6033  
6034 # given: synopsis
6035  
6036 package main;
6037  
6038 use Venus 'is', 'number';
6039  
6040 my $a = number 1;
6041 my $b = number 1;
6042  
6043 my $is = is $a, $b;
6044  
6045 # false
6046  
6047 =back
6048  
6049 =cut
6050  
6051 =head2 is_blessed
6052  
6053 is_blessed(any $data) (boolean)
6054  
6055 The is_blessed function uses L</check> to validate that the data provided is an
6056 object returns true, otherwise returns false.
6057  
6058 I<Since C<4.15>>
6059  
6060 =over 4
6061  
6062 =item is_blessed example 1
6063  
6064 # given: synopsis
6065  
6066 package main;
6067  
6068 use Venus 'is_blessed';
6069  
6070 my $is_blessed = is_blessed bless {};
6071  
6072 # true
6073  
6074 =back
6075  
6076 =over 4
6077  
6078 =item is_blessed example 2
6079  
6080 # given: synopsis
6081  
6082 package main;
6083  
6084 use Venus 'is_blessed';
6085  
6086 my $is_blessed = is_blessed {};
6087  
6088 # false
6089  
6090 =back
6091  
6092 =cut
6093  
6094 =head2 is_boolean
6095  
6096 is_boolean(any $data) (boolean)
6097  
6098 The is_boolean function uses L</check> to validate that the data provided is a
6099 boolean returns true, otherwise returns false.
6100  
6101 I<Since C<4.15>>
6102  
6103 =over 4
6104  
6105 =item is_boolean example 1
6106  
6107 # given: synopsis
6108  
6109 package main;
6110  
6111 use Venus 'is_boolean';
6112  
6113 my $is_boolean = is_boolean true;
6114  
6115 # true
6116  
6117 =back
6118  
6119 =over 4
6120  
6121 =item is_boolean example 2
6122  
6123 # given: synopsis
6124  
6125 package main;
6126  
6127 use Venus 'is_boolean';
6128  
6129 my $is_boolean = is_boolean 1;
6130  
6131 # false
6132  
6133 =back
6134  
6135 =cut
6136  
6137 =head2 is_coderef
6138  
6139 is_coderef(any $data) (boolean)
6140  
6141 The is_coderef function uses L</check> to validate that the data provided is a
6142 coderef returns true, otherwise returns false.
6143  
6144 I<Since C<4.15>>
6145  
6146 =over 4
6147  
6148 =item is_coderef example 1
6149  
6150 # given: synopsis
6151  
6152 package main;
6153  
6154 use Venus 'is_coderef';
6155  
6156 my $is_coderef = is_coderef sub{};
6157  
6158 # true
6159  
6160 =back
6161  
6162 =over 4
6163  
6164 =item is_coderef example 2
6165  
6166 # given: synopsis
6167  
6168 package main;
6169  
6170 use Venus 'is_coderef';
6171  
6172 my $is_coderef = is_coderef {};
6173  
6174 # false
6175  
6176 =back
6177  
6178 =cut
6179  
6180 =head2 is_dirhandle
6181  
6182 is_dirhandle(any $data) (boolean)
6183  
6184 The is_dirhandle function uses L</check> to validate that the data provided is
6185 a dirhandle returns true, otherwise returns false.
6186  
6187 I<Since C<4.15>>
6188  
6189 =over 4
6190  
6191 =item is_dirhandle example 1
6192  
6193 # given: synopsis
6194  
6195 package main;
6196  
6197 use Venus 'is_dirhandle';
6198  
6199 opendir my $dh, 't';
6200  
6201 my $is_dirhandle = is_dirhandle $dh;
6202  
6203 # true
6204  
6205 =back
6206  
6207 =over 4
6208  
6209 =item is_dirhandle example 2
6210  
6211 # given: synopsis
6212  
6213 package main;
6214  
6215 use Venus 'is_dirhandle';
6216  
6217 open my $fh, '<', 't/data/moon';
6218  
6219 my $is_dirhandle = is_dirhandle $fh;
6220  
6221 # false
6222  
6223 =back
6224  
6225 =cut
6226  
6227 =head2 is_enum
6228  
6229 is_enum(any $data, value @args) (boolean)
6230  
6231 The is_enum function uses L</check> to validate that the data provided is an
6232 enum returns true, otherwise returns false.
6233  
6234 I<Since C<4.15>>
6235  
6236 =over 4
6237  
6238 =item is_enum example 1
6239  
6240 # given: synopsis
6241  
6242 package main;
6243  
6244 use Venus 'is_enum';
6245  
6246 my $is_enum = is_enum 'yes', 'yes', 'no'
6247  
6248 # true
6249  
6250 =back
6251  
6252 =over 4
6253  
6254 =item is_enum example 2
6255  
6256 # given: synopsis
6257  
6258 package main;
6259  
6260 use Venus 'is_enum';
6261  
6262 my $is_enum = is_enum 'yes', 'Yes', 'No';
6263  
6264 # false
6265  
6266 =back
6267  
6268 =cut
6269  
6270 =head2 is_error
6271  
6272 is_error(any $data, string | coderef $code, any @args) (boolean)
6273  
6274 The is_error function accepts a scalar value and returns true if the value is
6275 (or is derived from) L<Venus::Error>. This function can dispatch method calls
6276 and execute callbacks, and returns true of the return value from the callback
6277 is truthy, and false otherwise.
6278  
6279 I<Since C<4.15>>
6280  
6281 =over 4
6282  
6283 =item is_error example 1
6284  
6285 package main;
6286  
6287 use Venus 'is_error';
6288  
6289 my $is_error = is_error 0;
6290  
6291 # false
6292  
6293 =back
6294  
6295 =over 4
6296  
6297 =item is_error example 2
6298  
6299 package main;
6300  
6301 use Venus 'is_error';
6302  
6303 my $is_error = is_error 1;
6304  
6305 # false
6306  
6307 =back
6308  
6309 =over 4
6310  
6311 =item is_error example 3
6312  
6313 package main;
6314  
6315 use Venus 'catch', 'fault', 'is_error';
6316  
6317 my $fault = catch {fault};
6318  
6319 my $is_error = is_error $fault;
6320  
6321 # false
6322  
6323 =back
6324  
6325 =over 4
6326  
6327 =item is_error example 4
6328  
6329 package main;
6330  
6331 use Venus 'catch', 'error', 'is_error';
6332  
6333 my $error = catch {error};
6334  
6335 my $is_error = is_error $error;
6336  
6337 # true
6338  
6339 =back
6340  
6341 =over 4
6342  
6343 =item is_error example 5
6344  
6345 package main;
6346  
6347 use Venus 'catch', 'error', 'is_error';
6348  
6349 my $error = catch {error {verbose => true}};
6350  
6351 my $is_error = is_error $error, 'verbose';
6352  
6353 # true
6354  
6355 =back
6356  
6357 =over 4
6358  
6359 =item is_error example 6
6360  
6361 package main;
6362  
6363 use Venus 'catch', 'error', 'is_error';
6364  
6365 my $error = catch {error {verbose => false}};
6366  
6367 my $is_error = is_error $error, 'verbose';
6368  
6369 # false
6370  
6371 =back
6372  
6373 =cut
6374  
6375 =head2 is_false
6376  
6377 is_false(any $data, string | coderef $code, any @args) (boolean)
6378  
6379 The is_false function accepts a scalar value and returns true if the value is
6380 falsy. This function can dispatch method calls and execute callbacks.
6381  
6382 I<Since C<3.04>>
6383  
6384 =over 4
6385  
6386 =item is_false example 1
6387  
6388 package main;
6389  
6390 use Venus 'is_false';
6391  
6392 my $is_false = is_false 0;
6393  
6394 # true
6395  
6396 =back
6397  
6398 =over 4
6399  
6400 =item is_false example 2
6401  
6402 package main;
6403  
6404 use Venus 'is_false';
6405  
6406 my $is_false = is_false 1;
6407  
6408 # false
6409  
6410 =back
6411  
6412 =over 4
6413  
6414 =item is_false example 3
6415  
6416 package main;
6417  
6418 use Venus 'array', 'is_false';
6419  
6420 my $array = array [];
6421  
6422 my $is_false = is_false $array;
6423  
6424 # false
6425  
6426 =back
6427  
6428 =over 4
6429  
6430 =item is_false example 4
6431  
6432 package main;
6433  
6434 use Venus 'array', 'is_false';
6435  
6436 my $array = array [];
6437  
6438 my $is_false = is_false $array, 'count';
6439  
6440 # true
6441  
6442 =back
6443  
6444 =over 4
6445  
6446 =item is_false example 5
6447  
6448 package main;
6449  
6450 use Venus 'array', 'is_false';
6451  
6452 my $array = array [1];
6453  
6454 my $is_false = is_false $array, 'count';
6455  
6456 # false
6457  
6458 =back
6459  
6460 =over 4
6461  
6462 =item is_false example 6
6463  
6464 package main;
6465  
6466 use Venus 'is_false';
6467  
6468 my $array = undef;
6469  
6470 my $is_false = is_false $array, 'count';
6471  
6472 # true
6473  
6474 =back
6475  
6476 =cut
6477  
6478 =head2 is_fault
6479  
6480 is_fault(any $data) (boolean)
6481  
6482 The is_fault function accepts a scalar value and returns true if the value is
6483 (or is derived from) L<Venus::Fault>.
6484  
6485 I<Since C<4.15>>
6486  
6487 =over 4
6488  
6489 =item is_fault example 1
6490  
6491 package main;
6492  
6493 use Venus 'is_fault';
6494  
6495 my $is_fault = is_fault 0;
6496  
6497 # false
6498  
6499 =back
6500  
6501 =over 4
6502  
6503 =item is_fault example 2
6504  
6505 package main;
6506  
6507 use Venus 'is_fault';
6508  
6509 my $is_fault = is_fault 1;
6510  
6511 # false
6512  
6513 =back
6514  
6515 =over 4
6516  
6517 =item is_fault example 3
6518  
6519 package main;
6520  
6521 use Venus 'catch', 'fault', 'is_fault';
6522  
6523 my $fault = catch {fault};
6524  
6525 my $is_fault = is_fault $fault;
6526  
6527 # true
6528  
6529 =back
6530  
6531 =over 4
6532  
6533 =item is_fault example 4
6534  
6535 package main;
6536  
6537 use Venus 'catch', 'error', 'is_fault';
6538  
6539 my $error = catch {error};
6540  
6541 my $is_fault = is_fault $error;
6542  
6543 # false
6544  
6545 =back
6546  
6547 =cut
6548  
6549 =head2 is_filehandle
6550  
6551 is_filehandle(any $data) (boolean)
6552  
6553 The is_filehandle function uses L</check> to validate that the data provided is
6554 a filehandle returns true, otherwise returns false.
6555  
6556 I<Since C<4.15>>
6557  
6558 =over 4
6559  
6560 =item is_filehandle example 1
6561  
6562 # given: synopsis
6563  
6564 package main;
6565  
6566 use Venus 'is_filehandle';
6567  
6568 open my $fh, '<', 't/data/moon';
6569  
6570 my $is_filehandle = is_filehandle $fh;
6571  
6572 # true
6573  
6574 =back
6575  
6576 =over 4
6577  
6578 =item is_filehandle example 2
6579  
6580 # given: synopsis
6581  
6582 package main;
6583  
6584 use Venus 'is_filehandle';
6585  
6586 opendir my $dh, 't';
6587  
6588 my $is_filehandle = is_filehandle $dh;
6589  
6590 # false
6591  
6592 =back
6593  
6594 =cut
6595  
6596 =head2 is_float
6597  
6598 is_float(any $data) (boolean)
6599  
6600 The is_float function uses L</check> to validate that the data provided is a
6601 float returns true, otherwise returns false.
6602  
6603 I<Since C<4.15>>
6604  
6605 =over 4
6606  
6607 =item is_float example 1
6608  
6609 # given: synopsis
6610  
6611 package main;
6612  
6613 use Venus 'is_float';
6614  
6615 my $is_float = is_float .123;
6616  
6617 # true
6618  
6619 =back
6620  
6621 =over 4
6622  
6623 =item is_float example 2
6624  
6625 # given: synopsis
6626  
6627 package main;
6628  
6629 use Venus 'is_float';
6630  
6631 my $is_float = is_float 123;
6632  
6633 # false
6634  
6635 =back
6636  
6637 =cut
6638  
6639 =head2 is_glob
6640  
6641 is_glob(any $data) (boolean)
6642  
6643 The is_glob function uses L</check> to validate that the data provided is a
6644 glob returns true, otherwise returns false.
6645  
6646 I<Since C<4.15>>
6647  
6648 =over 4
6649  
6650 =item is_glob example 1
6651  
6652 # given: synopsis
6653  
6654 package main;
6655  
6656 use Venus 'is_glob';
6657  
6658 my $is_glob = is_glob \*main;
6659  
6660 # true
6661  
6662 =back
6663  
6664 =over 4
6665  
6666 =item is_glob example 2
6667  
6668 # given: synopsis
6669  
6670 package main;
6671  
6672 use Venus 'is_glob';
6673  
6674 my $is_glob = is_glob *::main;
6675  
6676 # false
6677  
6678 =back
6679  
6680 =cut
6681  
6682 =head2 is_hashref
6683  
6684 is_hashref(any $data) (boolean)
6685  
6686 The is_hashref function uses L</check> to validate that the data provided is a
6687 hashref returns true, otherwise returns false.
6688  
6689 I<Since C<4.15>>
6690  
6691 =over 4
6692  
6693 =item is_hashref example 1
6694  
6695 # given: synopsis
6696  
6697 package main;
6698  
6699 use Venus 'is_hashref';
6700  
6701 my $is_hashref = is_hashref {};
6702  
6703 # true
6704  
6705 =back
6706  
6707 =over 4
6708  
6709 =item is_hashref example 2
6710  
6711 # given: synopsis
6712  
6713 package main;
6714  
6715 use Venus 'is_hashref';
6716  
6717 my $is_hashref = is_hashref [];
6718  
6719 # false
6720  
6721 =back
6722  
6723 =cut
6724  
6725 =head2 is_number
6726  
6727 is_number(any $data) (boolean)
6728  
6729 The is_number function uses L</check> to validate that the data provided is a
6730 number returns true, otherwise returns false.
6731  
6732 I<Since C<4.15>>
6733  
6734 =over 4
6735  
6736 =item is_number example 1
6737  
6738 # given: synopsis
6739  
6740 package main;
6741  
6742 use Venus 'is_number';
6743  
6744 my $is_number = is_number 0;
6745  
6746 # true
6747  
6748 =back
6749  
6750 =over 4
6751  
6752 =item is_number example 2
6753  
6754 # given: synopsis
6755  
6756 package main;
6757  
6758 use Venus 'is_number';
6759  
6760 my $is_number = is_number '0';
6761  
6762 # false
6763  
6764 =back
6765  
6766 =cut
6767  
6768 =head2 is_object
6769  
6770 is_object(any $data) (boolean)
6771  
6772 The is_object function uses L</check> to validate that the data provided is an
6773 object returns true, otherwise returns false.
6774  
6775 I<Since C<4.15>>
6776  
6777 =over 4
6778  
6779 =item is_object example 1
6780  
6781 # given: synopsis
6782  
6783 package main;
6784  
6785 use Venus 'is_object';
6786  
6787 my $is_object = is_object bless {};
6788  
6789 # true
6790  
6791 =back
6792  
6793 =over 4
6794  
6795 =item is_object example 2
6796  
6797 # given: synopsis
6798  
6799 package main;
6800  
6801 use Venus 'is_object';
6802  
6803 my $is_object = is_object {};
6804  
6805 # false
6806  
6807 =back
6808  
6809 =cut
6810  
6811 =head2 is_package
6812  
6813 is_package(any $data) (boolean)
6814  
6815 The is_package function uses L</check> to validate that the data provided is a
6816 package returns true, otherwise returns false.
6817  
6818 I<Since C<4.15>>
6819  
6820 =over 4
6821  
6822 =item is_package example 1
6823  
6824 # given: synopsis
6825  
6826 package main;
6827  
6828 use Venus 'is_package';
6829  
6830 my $is_package = is_package 'Venus';
6831  
6832 # true
6833  
6834 =back
6835  
6836 =over 4
6837  
6838 =item is_package example 2
6839  
6840 # given: synopsis
6841  
6842 package main;
6843  
6844 use Venus 'is_package';
6845  
6846 my $is_package = is_package 'MyApp';
6847  
6848 # false
6849  
6850 =back
6851  
6852 =cut
6853  
6854 =head2 is_reference
6855  
6856 is_reference(any $data) (boolean)
6857  
6858 The is_reference function uses L</check> to validate that the data provided is
6859 a reference returns true, otherwise returns false.
6860  
6861 I<Since C<4.15>>
6862  
6863 =over 4
6864  
6865 =item is_reference example 1
6866  
6867 # given: synopsis
6868  
6869 package main;
6870  
6871 use Venus 'is_reference';
6872  
6873 my $is_reference = is_reference \0;
6874  
6875 # true
6876  
6877 =back
6878  
6879 =over 4
6880  
6881 =item is_reference example 2
6882  
6883 # given: synopsis
6884  
6885 package main;
6886  
6887 use Venus 'is_reference';
6888  
6889 my $is_reference = is_reference 0;
6890  
6891 # false
6892  
6893 =back
6894  
6895 =cut
6896  
6897 =head2 is_regexp
6898  
6899 is_regexp(any $data) (boolean)
6900  
6901 The is_regexp function uses L</check> to validate that the data provided is a
6902 regexp returns true, otherwise returns false.
6903  
6904 I<Since C<4.15>>
6905  
6906 =over 4
6907  
6908 =item is_regexp example 1
6909  
6910 # given: synopsis
6911  
6912 package main;
6913  
6914 use Venus 'is_regexp';
6915  
6916 my $is_regexp = is_regexp qr/hello/;
6917  
6918 # true
6919  
6920 =back
6921  
6922 =over 4
6923  
6924 =item is_regexp example 2
6925  
6926 # given: synopsis
6927  
6928 package main;
6929  
6930 use Venus 'is_regexp';
6931  
6932 my $is_regexp = is_regexp 'hello';
6933  
6934 # false
6935  
6936 =back
6937  
6938 =cut
6939  
6940 =head2 is_scalarref
6941  
6942 is_scalarref(any $data) (boolean)
6943  
6944 The is_scalarref function uses L</check> to validate that the data provided is
6945 a scalarref returns true, otherwise returns false.
6946  
6947 I<Since C<4.15>>
6948  
6949 =over 4
6950  
6951 =item is_scalarref example 1
6952  
6953 # given: synopsis
6954  
6955 package main;
6956  
6957 use Venus 'is_scalarref';
6958  
6959 my $is_scalarref = is_scalarref \1;
6960  
6961 # true
6962  
6963 =back
6964  
6965 =over 4
6966  
6967 =item is_scalarref example 2
6968  
6969 # given: synopsis
6970  
6971 package main;
6972  
6973 use Venus 'is_scalarref';
6974  
6975 my $is_scalarref = is_scalarref 1;
6976  
6977 # false
6978  
6979 =back
6980  
6981 =cut
6982  
6983 =head2 is_string
6984  
6985 is_string(any $data) (boolean)
6986  
6987 The is_string function uses L</check> to validate that the data provided is a
6988 string returns true, otherwise returns false.
6989  
6990 I<Since C<4.15>>
6991  
6992 =over 4
6993  
6994 =item is_string example 1
6995  
6996 # given: synopsis
6997  
6998 package main;
6999  
7000 use Venus 'is_string';
7001  
7002 my $is_string = is_string '0';
7003  
7004 # true
7005  
7006 =back
7007  
7008 =over 4
7009  
7010 =item is_string example 2
7011  
7012 # given: synopsis
7013  
7014 package main;
7015  
7016 use Venus 'is_string';
7017  
7018 my $is_string = is_string 0;
7019  
7020 # false
7021  
7022 =back
7023  
7024 =cut
7025  
7026 =head2 is_true
7027  
7028 is_true(any $data, string | coderef $code, any @args) (boolean)
7029  
7030 The is_true function accepts a scalar value and returns true if the value is
7031 truthy. This function can dispatch method calls and execute callbacks.
7032  
7033 I<Since C<3.04>>
7034  
7035 =over 4
7036  
7037 =item is_true example 1
7038  
7039 package main;
7040  
7041 use Venus 'is_true';
7042  
7043 my $is_true = is_true 1;
7044  
7045 # true
7046  
7047 =back
7048  
7049 =over 4
7050  
7051 =item is_true example 2
7052  
7053 package main;
7054  
7055 use Venus 'is_true';
7056  
7057 my $is_true = is_true 0;
7058  
7059 # false
7060  
7061 =back
7062  
7063 =over 4
7064  
7065 =item is_true example 3
7066  
7067 package main;
7068  
7069 use Venus 'array', 'is_true';
7070  
7071 my $array = array [];
7072  
7073 my $is_true = is_true $array;
7074  
7075 # true
7076  
7077 =back
7078  
7079 =over 4
7080  
7081 =item is_true example 4
7082  
7083 package main;
7084  
7085 use Venus 'array', 'is_true';
7086  
7087 my $array = array [];
7088  
7089 my $is_true = is_true $array, 'count';
7090  
7091 # false
7092  
7093 =back
7094  
7095 =over 4
7096  
7097 =item is_true example 5
7098  
7099 package main;
7100  
7101 use Venus 'array', 'is_true';
7102  
7103 my $array = array [1];
7104  
7105 my $is_true = is_true $array, 'count';
7106  
7107 # true
7108  
7109 =back
7110  
7111 =over 4
7112  
7113 =item is_true example 6
7114  
7115 package main;
7116  
7117 use Venus 'is_true';
7118  
7119 my $array = undef;
7120  
7121 my $is_true = is_true $array, 'count';
7122  
7123 # false
7124  
7125 =back
7126  
7127 =cut
7128  
7129 =head2 is_undef
7130  
7131 is_undef(any $data) (boolean)
7132  
7133 The is_undef function uses L</check> to validate that the data provided is an
7134 undef returns true, otherwise returns false.
7135  
7136 I<Since C<4.15>>
7137  
7138 =over 4
7139  
7140 =item is_undef example 1
7141  
7142 # given: synopsis
7143  
7144 package main;
7145  
7146 use Venus 'is_undef';
7147  
7148 my $is_undef = is_undef undef;
7149  
7150 # true
7151  
7152 =back
7153  
7154 =over 4
7155  
7156 =item is_undef example 2
7157  
7158 # given: synopsis
7159  
7160 package main;
7161  
7162 use Venus 'is_undef';
7163  
7164 my $is_undef = is_undef '';
7165  
7166 # false
7167  
7168 =back
7169  
7170 =cut
7171  
7172 =head2 is_value
7173  
7174 is_value(any $data) (boolean)
7175  
7176 The is_value function uses L</check> to validate that the data provided is an
7177 value returns true, otherwise returns false.
7178  
7179 I<Since C<4.15>>
7180  
7181 =over 4
7182  
7183 =item is_value example 1
7184  
7185 # given: synopsis
7186  
7187 package main;
7188  
7189 use Venus 'is_value';
7190  
7191 my $is_value = is_value 0;
7192  
7193 # true
7194  
7195 =back
7196  
7197 =over 4
7198  
7199 =item is_value example 2
7200  
7201 # given: synopsis
7202  
7203 package main;
7204  
7205 use Venus 'is_value';
7206  
7207 my $is_value = is_value sub{};
7208  
7209 # false
7210  
7211 =back
7212  
7213 =cut
7214  
7215 =head2 is_yesno
7216  
7217 is_yesno(any $data) (boolean)
7218  
7219 The is_yesno function uses L</check> to validate that the data provided is a
7220 yesno returns true, otherwise returns false.
7221  
7222 I<Since C<4.15>>
7223  
7224 =over 4
7225  
7226 =item is_yesno example 1
7227  
7228 # given: synopsis
7229  
7230 package main;
7231  
7232 use Venus 'is_yesno';
7233  
7234 my $is_yesno = is_yesno 0;
7235  
7236 # true
7237  
7238 =back
7239  
7240 =over 4
7241  
7242 =item is_yesno example 2
7243  
7244 # given: synopsis
7245  
7246 package main;
7247  
7248 use Venus 'is_yesno';
7249  
7250 my $is_yesno = is_yesno undef;
7251  
7252 # false
7253  
7254 =back
7255  
7256 =cut
7257  
7258 =head2 json
7259  
7260 json(string $call, any $data) (any)
7261  
7262 The json function builds a L<Venus::Json> object and will either
7263 L<Venus::Json/decode> or L<Venus::Json/encode> based on the argument provided
7264 and returns the result.
7265  
7266 I<Since C<2.40>>
7267  
7268 =over 4
7269  
7270 =item json example 1
7271  
7272 package main;
7273  
7274 use Venus 'json';
7275  
7276 my $decode = json 'decode', '{"codename":["Ready","Robot"],"stable":true}';
7277  
7278 # { codename => ["Ready", "Robot"], stable => 1 }
7279  
7280 =back
7281  
7282 =over 4
7283  
7284 =item json example 2
7285  
7286 package main;
7287  
7288 use Venus 'json';
7289  
7290 my $encode = json 'encode', { codename => ["Ready", "Robot"], stable => true };
7291  
7292 # '{"codename":["Ready","Robot"],"stable":true}'
7293  
7294 =back
7295  
7296 =over 4
7297  
7298 =item json example 3
7299  
7300 package main;
7301  
7302 use Venus 'json';
7303  
7304 my $json = json;
7305  
7306 # bless({...}, 'Venus::Json')
7307  
7308 =back
7309  
7310 =over 4
7311  
7312 =item json example 4
7313  
7314 package main;
7315  
7316 use Venus 'json';
7317  
7318 my $json = json 'class', {data => "..."};
7319  
7320 # Exception! (isa Venus::Fault)
7321  
7322 =back
7323  
7324 =cut
7325  
7326 =head2 kvargs
7327  
7328 kvargs(any @args) (hashref)
7329  
7330 The kvargs function takes a list of arguments and returns a hashref. If a
7331 single hashref is provided, it is returned as-is. Otherwise, the arguments are
7332 treated as key-value pairs. If an odd number of arguments is provided, the last
7333 key will have C<undef> as its value.
7334  
7335 I<Since C<5.00>>
7336  
7337 =over 4
7338  
7339 =item kvargs example 1
7340  
7341 package main;
7342  
7343 use Venus 'kvargs';
7344  
7345 my $kvargs = kvargs {name => 'Elliot'};
7346  
7347 # {name => 'Elliot'}
7348  
7349 =back
7350  
7351 =over 4
7352  
7353 =item kvargs example 2
7354  
7355 package main;
7356  
7357 use Venus 'kvargs';
7358  
7359 my $kvargs = kvargs name => 'Elliot', role => 'hacker';
7360  
7361 # {name => 'Elliot', role => 'hacker'}
7362  
7363 =back
7364  
7365 =over 4
7366  
7367 =item kvargs example 3
7368  
7369 package main;
7370  
7371 use Venus 'kvargs';
7372  
7373 my $kvargs = kvargs name => 'Elliot', 'role';
7374  
7375 # {name => 'Elliot', role => undef}
7376  
7377 =back
7378  
7379 =over 4
7380  
7381 =item kvargs example 4
7382  
7383 package main;
7384  
7385 use Venus 'kvargs';
7386  
7387 my $kvargs = kvargs;
7388  
7389 # {}
7390  
7391 =back
7392  
7393 =cut
7394  
7395 =head2 list
7396  
7397 list(any @args) (any)
7398  
7399 The list function accepts a list of values and flattens any arrayrefs,
7400 returning a list of scalars.
7401  
7402 I<Since C<3.04>>
7403  
7404 =over 4
7405  
7406 =item list example 1
7407  
7408 package main;
7409  
7410 use Venus 'list';
7411  
7412 my @list = list 1..4;
7413  
7414 # (1..4)
7415  
7416 =back
7417  
7418 =over 4
7419  
7420 =item list example 2
7421  
7422 package main;
7423  
7424 use Venus 'list';
7425  
7426 my @list = list [1..4];
7427  
7428 # (1..4)
7429  
7430 =back
7431  
7432 =over 4
7433  
7434 =item list example 3
7435  
7436 package main;
7437  
7438 use Venus 'list';
7439  
7440 my @list = list [1..4], 5, [6..10];
7441  
7442 # (1..10)
7443  
7444 =back
7445  
7446 =cut
7447  
7448 =head2 load
7449  
7450 load(any $name) (Venus::Space)
7451  
7452 The load function loads the package provided and returns a L<Venus::Space> object.
7453  
7454 I<Since C<2.32>>
7455  
7456 =over 4
7457  
7458 =item load example 1
7459  
7460 package main;
7461  
7462 use Venus 'load';
7463  
7464 my $space = load 'Venus::Scalar';
7465  
7466 # bless({value => 'Venus::Scalar'}, 'Venus::Space')
7467  
7468 =back
7469  
7470 =cut
7471  
7472 =head2 log
7473  
7474 log(any @args) (Venus::Log)
7475  
7476 The log function prints the arguments provided to STDOUT, stringifying complex
7477 values, and returns a L<Venus::Log> object. If the first argument is a log
7478 level name, e.g. C<debug>, C<error>, C<fatal>, C<info>, C<trace>, or C<warn>,
7479 it will be used when emitting the event. The desired log level is specified by
7480 the C<VENUS_LOG_LEVEL> environment variable and defaults to C<trace>.
7481  
7482 I<Since C<2.40>>
7483  
7484 =over 4
7485  
7486 =item log example 1
7487  
7488 package main;
7489  
7490 use Venus 'log';
7491  
7492 my $log = log;
7493  
7494 # bless({...}, 'Venus::Log')
7495  
7496 # log time, rand, 1..9;
7497  
7498 # 00000000 0.000000, 1..9
7499  
7500 =back
7501  
7502 =cut
7503  
7504 =head2 make
7505  
7506 make(string $package, any @args) (any)
7507  
7508 The make function L<"calls"|Venus/call> the C<new> routine on the invocant and
7509 returns the result which should be a package string or an object.
7510  
7511 I<Since C<2.32>>
7512  
7513 =over 4
7514  
7515 =item make example 1
7516  
7517 package main;
7518  
7519 use Venus 'make';
7520  
7521 my $made = make('Digest::SHA');
7522  
7523 # bless(do{\(my $o = '...')}, 'Digest::SHA')
7524  
7525 =back
7526  
7527 =over 4
7528  
7529 =item make example 2
7530  
7531 package main;
7532  
7533 use Venus 'make';
7534  
7535 my $made = make('Digest', 'SHA');
7536  
7537 # bless(do{\(my $o = '...')}, 'Digest::SHA')
7538  
7539 =back
7540  
7541 =cut
7542  
7543 =head2 map
7544  
7545 map(hashref $value) (Venus::Map)
7546  
7547 The map function returns a L<Venus::Map> object for the hashref provided.
7548  
7549 I<Since C<4.15>>
7550  
7551 =over 4
7552  
7553 =item map example 1
7554  
7555 package main;
7556  
7557 use Venus;
7558  
7559 my $map = Venus::map {1..4};
7560  
7561 # bless(..., 'Venus::Map')
7562  
7563 =back
7564  
7565 =over 4
7566  
7567 =item map example 2
7568  
7569 package main;
7570  
7571 use Venus;
7572  
7573 my $map = Venus::map {1..4}, 'count';
7574  
7575 # 2
7576  
7577 =back
7578  
7579 =cut
7580  
7581 =head2 match
7582  
7583 match(any $value, coderef $callback) (any)
7584  
7585 The match function builds a L<Venus::Match> object, passing it and the value
7586 provided to the callback provided, and returns the return value from
7587 L<Venus::Match/result>.
7588  
7589 I<Since C<2.50>>
7590  
7591 =over 4
7592  
7593 =item match example 1
7594  
7595 package main;
7596  
7597 use Venus 'match';
7598  
7599 my $match = match 5;
7600  
7601 # bless({...}, 'Venus::Match')
7602  
7603 # $match->result;
7604  
7605 # undef
7606  
7607 =back
7608  
7609 =over 4
7610  
7611 =item match example 2
7612  
7613 package main;
7614  
7615 use Venus 'match';
7616  
7617 my $match = match 5, sub {{
7618 1 => 'one',
7619 2 => 'two',
7620 5 => 'five',
7621 }};
7622  
7623 # 'five'
7624  
7625 =back
7626  
7627 =over 4
7628  
7629 =item match example 3
7630  
7631 package main;
7632  
7633 use Venus 'match';
7634  
7635 my $match = match 5, sub {{
7636 1 => 'one',
7637 2 => 'two',
7638 3 => 'three',
7639 }};
7640  
7641 # undef
7642  
7643 =back
7644  
7645 =over 4
7646  
7647 =item match example 4
7648  
7649 package main;
7650  
7651 use Venus 'match';
7652  
7653 my $match = match 5, sub {
7654 my ($case) = @_;
7655  
7656 $case->when(sub{$_ < 5})->then('< 5');
7657 $case->when(sub{$_ > 5})->then('> 5');
7658 };
7659  
7660 # undef
7661  
7662 =back
7663  
7664 =over 4
7665  
7666 =item match example 5
7667  
7668 package main;
7669  
7670 use Venus 'match';
7671  
7672 my $match = match 6, sub {
7673 my ($case, $data) = @_;
7674  
7675 $case->when(sub{$_ < 5})->then("$data < 5");
7676 $case->when(sub{$_ > 5})->then("$data > 5");
7677 };
7678  
7679 # '6 > 5'
7680  
7681 =back
7682  
7683 =over 4
7684  
7685 =item match example 6
7686  
7687 package main;
7688  
7689 use Venus 'match';
7690  
7691 my $match = match 4, sub {
7692  
7693 $_->when(sub{$_ < 5})->then("$_[1] < 5");
7694 $_->when(sub{$_ > 5})->then("$_[1] > 5");
7695 };
7696  
7697 # '4 < 5'
7698  
7699 =back
7700  
7701 =cut
7702  
7703 =head2 merge
7704  
7705 merge(any @args) (any)
7706  
7707 The merge function returns a value which is a merger of all of the arguments
7708 provided. This function is an alias for L</merge_join> given the principle of
7709 least surprise.
7710  
7711 I<Since C<2.32>>
7712  
7713 =over 4
7714  
7715 =item merge example 1
7716  
7717 package main;
7718  
7719 use Venus 'merge';
7720  
7721 my $merged = merge({1..4}, {5, 6});
7722  
7723 # {1..6}
7724  
7725 =back
7726  
7727 =over 4
7728  
7729 =item merge example 2
7730  
7731 package main;
7732  
7733 use Venus 'merge';
7734  
7735 my $merged = merge({1..4}, {5, 6}, {7, 8, 9, 0});
7736  
7737 # {1..9, 0}
7738  
7739 =back
7740  
7741 =cut
7742  
7743 =head2 merge_flat
7744  
7745 merge_flat(any @args) (any)
7746  
7747 The merge_flat function merges two (or more) values and returns a new values
7748 based on the types of the inputs:
7749  
7750 B<Note:> This function appends hashref values to an arrayref when encountered.
7751  
7752 =over 4
7753  
7754 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "scalar" we
7755 keep the C<rvalue>.
7756  
7757 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "arrayref" we
7758 keep the C<rvalue>.
7759  
7760 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "hashref" we
7761 keep the C<rvalue>.
7762  
7763 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "scalar" we
7764 append the C<rvalue> to the C<lvalue>.
7765  
7766 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "arrayref"
7767 we append the items in C<rvalue> to the C<lvalue>.
7768  
7769 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "hashref" we
7770 append the values in C<rvalue> to the C<lvalue>.
7771  
7772 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "scalar" we
7773 keep the C<rvalue>.
7774  
7775 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "arrayref" we
7776 keep the C<rvalue>.
7777  
7778 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "hashref" we
7779 append the keys and values in C<rvalue> to the C<lvalue>, overwriting existing
7780 keys where there's overlap.
7781  
7782 =back
7783  
7784 I<Since C<4.15>>
7785  
7786 =over 4
7787  
7788 =item merge_flat example 1
7789  
7790 # given: synopsis
7791  
7792 package main;
7793  
7794 use Venus 'merge_flat';
7795  
7796 my $merge_flat = merge_flat;
7797  
7798 # undef
7799  
7800 =back
7801  
7802 =over 4
7803  
7804 =item merge_flat example 2
7805  
7806 # given: synopsis
7807  
7808 package main;
7809  
7810 use Venus 'merge_flat';
7811  
7812 my $merge_flat = merge_flat 1;
7813  
7814 # 1
7815  
7816 =back
7817  
7818 =over 4
7819  
7820 =item merge_flat example 3
7821  
7822 # given: synopsis
7823  
7824 package main;
7825  
7826 use Venus 'merge_flat';
7827  
7828 my $merge_flat = merge_flat 1, 2;
7829  
7830 # 2
7831  
7832 =back
7833  
7834 =over 4
7835  
7836 =item merge_flat example 4
7837  
7838 # given: synopsis
7839  
7840 package main;
7841  
7842 use Venus 'merge_flat';
7843  
7844 my $merge_flat = merge_flat 1, [2, 3];
7845  
7846 # [2, 3]
7847  
7848 =back
7849  
7850 =over 4
7851  
7852 =item merge_flat example 5
7853  
7854 # given: synopsis
7855  
7856 package main;
7857  
7858 use Venus 'merge_flat';
7859  
7860 my $merge_flat = merge_flat 1, {a => 1};
7861  
7862 # {a => 1}
7863  
7864 =back
7865  
7866 =over 4
7867  
7868 =item merge_flat example 6
7869  
7870 # given: synopsis
7871  
7872 package main;
7873  
7874 use Venus 'merge_flat';
7875  
7876 my $merge_flat = merge_flat [1, 2], 3;
7877  
7878 # [1, 2, 3]
7879  
7880 =back
7881  
7882 =over 4
7883  
7884 =item merge_flat example 7
7885  
7886 # given: synopsis
7887  
7888 package main;
7889  
7890 use Venus 'merge_flat';
7891  
7892 my $merge_flat = merge_flat [1, 2], {a => 3, b => 4};
7893  
7894 # [1, 2, 3, 4]
7895  
7896 =back
7897  
7898 =over 4
7899  
7900 =item merge_flat example 8
7901  
7902 # given: synopsis
7903  
7904 package main;
7905  
7906 use Venus 'merge_flat';
7907  
7908 my $merge_flat = merge_flat(
7909 {
7910 a => 1,
7911 b => {x => 10},
7912 d => 0,
7913 g => [4],
7914 },
7915 {
7916 b => {y => 20},
7917 c => 3,
7918 e => [5],
7919 f => [6]
7920 },
7921 {
7922 b => {z => 456},
7923 c => {z => 123},
7924 d => 2,
7925 e => [6, 7],
7926 f => {7, 8},
7927 g => 5,
7928 },
7929 );
7930  
7931 # {
7932 # a => 1,
7933 # b => {
7934 # x => 10,
7935 # y => 20,
7936 # z => 456
7937 # },
7938 # c => {z => 123},
7939 # d => 2,
7940 # e => [5, 6, 7],
7941 # f => [6, 8],
7942 # g => [4, 5],
7943 # }
7944  
7945 =back
7946  
7947 =cut
7948  
7949 =head2 merge_flat_mutate
7950  
7951 merge_flat_mutate(any @args) (any)
7952  
7953 The merge_flat_mutate performs a merge operaiton in accordance with
7954 L</merge_flat> except that it mutates the values being merged and returns the
7955 mutated value.
7956  
7957 I<Since C<4.15>>
7958  
7959 =over 4
7960  
7961 =item merge_flat_mutate example 1
7962  
7963 # given: synopsis
7964  
7965 package main;
7966  
7967 use Venus 'merge_flat_mutate';
7968  
7969 my $merge_flat_mutate = merge_flat_mutate;
7970  
7971 # undef
7972  
7973 =back
7974  
7975 =over 4
7976  
7977 =item merge_flat_mutate example 2
7978  
7979 # given: synopsis
7980  
7981 package main;
7982  
7983 use Venus 'merge_flat_mutate';
7984  
7985 my $merge_flat_mutate = merge_flat_mutate 1;
7986  
7987 # 1
7988  
7989 =back
7990  
7991 =over 4
7992  
7993 =item merge_flat_mutate example 3
7994  
7995 # given: synopsis
7996  
7997 package main;
7998  
7999 use Venus 'merge_flat_mutate';
8000  
8001 $result = 1;
8002  
8003 my $merge_flat_mutate = merge_flat_mutate $result, 2;
8004  
8005 # 2
8006  
8007 $result;
8008  
8009 # 2
8010  
8011 =back
8012  
8013 =over 4
8014  
8015 =item merge_flat_mutate example 4
8016  
8017 # given: synopsis
8018  
8019 package main;
8020  
8021 use Venus 'merge_flat_mutate';
8022  
8023 $result = 1;
8024  
8025 my $merge_flat_mutate = merge_flat_mutate $result, [2, 3];
8026  
8027 # [2, 3]
8028  
8029 $result;
8030  
8031 # [2, 3]
8032  
8033 =back
8034  
8035 =over 4
8036  
8037 =item merge_flat_mutate example 5
8038  
8039 # given: synopsis
8040  
8041 package main;
8042  
8043 use Venus 'merge_flat_mutate';
8044  
8045 $result = 1;
8046  
8047 my $merge_flat_mutate = merge_flat_mutate $result, {a => 1};
8048  
8049 # {a => 1}
8050  
8051 $result;
8052  
8053 # {a => 1}
8054  
8055 =back
8056  
8057 =over 4
8058  
8059 =item merge_flat_mutate example 6
8060  
8061 # given: synopsis
8062  
8063 package main;
8064  
8065 use Venus 'merge_flat_mutate';
8066  
8067 $result = [1, 2];
8068  
8069 my $merge_flat_mutate = merge_flat_mutate $result, 3;
8070  
8071 # [1, 2, 3]
8072  
8073 $result;
8074  
8075 # [1, 2, 3]
8076  
8077 =back
8078  
8079 =over 4
8080  
8081 =item merge_flat_mutate example 7
8082  
8083 # given: synopsis
8084  
8085 package main;
8086  
8087 use Venus 'merge_flat_mutate';
8088  
8089 $result = [1, 2];
8090  
8091 my $merge_flat_mutate = merge_flat_mutate $result, {a => 3, b => 4};
8092  
8093 # [1, 2, 3, 4]
8094  
8095 $result;
8096  
8097 # [1, 2, 3, 4]
8098  
8099 =back
8100  
8101 =cut
8102  
8103 =head2 merge_join
8104  
8105 merge_join(any @args) (any)
8106  
8107 The merge_join merges two (or more) values and returns a new values based on
8108 the types of the inputs:
8109  
8110 B<Note:> This function merges hashrefs with hashrefs, and appends arrayrefs
8111 with arrayrefs.
8112  
8113 =over 4
8114  
8115 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "scalar" we
8116 keep the C<rvalue>.
8117  
8118 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "arrayref" we
8119 keep the C<rvalue>.
8120  
8121 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "hashref" we
8122 keep the C<rvalue>.
8123  
8124 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "scalar" we
8125 append the C<rvalue> to the C<lvalue>.
8126  
8127 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "arrayref"
8128 we append the items in C<rvalue> to the C<lvalue>.
8129  
8130 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "hashref" we
8131 append the C<rvalue> to the C<lvalue>.
8132  
8133 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "scalar" we
8134 keep the C<rvalue>.
8135  
8136 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "arrayref" we
8137 keep the C<rvalue>.
8138  
8139 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "hashref" we
8140 append the keys and values in C<rvalue> to the C<lvalue>, overwriting existing
8141 keys where there's overlap.
8142  
8143 =back
8144  
8145 I<Since C<4.15>>
8146  
8147 =over 4
8148  
8149 =item merge_join example 1
8150  
8151 # given: synopsis
8152  
8153 package main;
8154  
8155 use Venus 'merge_join';
8156  
8157 my $merge_join = merge_join;
8158  
8159 # undef
8160  
8161 =back
8162  
8163 =over 4
8164  
8165 =item merge_join example 2
8166  
8167 # given: synopsis
8168  
8169 package main;
8170  
8171 use Venus 'merge_join';
8172  
8173 my $merge_join = merge_join 1;
8174  
8175 # 1
8176  
8177 =back
8178  
8179 =over 4
8180  
8181 =item merge_join example 3
8182  
8183 # given: synopsis
8184  
8185 package main;
8186  
8187 use Venus 'merge_join';
8188  
8189 my $merge_join = merge_join 1, 2;
8190  
8191 # 2
8192  
8193 =back
8194  
8195 =over 4
8196  
8197 =item merge_join example 4
8198  
8199 # given: synopsis
8200  
8201 package main;
8202  
8203 use Venus 'merge_join';
8204  
8205 my $merge_join = merge_join 1, [2, 3];
8206  
8207 # [2, 3]
8208  
8209 =back
8210  
8211 =over 4
8212  
8213 =item merge_join example 5
8214  
8215 # given: synopsis
8216  
8217 package main;
8218  
8219 use Venus 'merge_join';
8220  
8221 my $merge_join = merge_join [1, 2], 3;
8222  
8223 # [1, 2, 3]
8224  
8225 =back
8226  
8227 =over 4
8228  
8229 =item merge_join example 6
8230  
8231 # given: synopsis
8232  
8233 package main;
8234  
8235 use Venus 'merge_join';
8236  
8237 my $merge_join = merge_join [1, 2], [3, 4];
8238  
8239 # [1, 2, 3, 4]
8240  
8241 =back
8242  
8243 =over 4
8244  
8245 =item merge_join example 7
8246  
8247 # given: synopsis
8248  
8249 package main;
8250  
8251 use Venus 'merge_join';
8252  
8253 my $merge_join = merge_join {a => 1}, {a => 2, b => 3};
8254  
8255 # {a => 2, b => 3}
8256  
8257 =back
8258  
8259 =over 4
8260  
8261 =item merge_join example 8
8262  
8263 # given: synopsis
8264  
8265 package main;
8266  
8267 use Venus 'merge_join';
8268  
8269 my $merge_join = merge_join(
8270 {
8271 a => 1,
8272 b => {x => 10},
8273 d => 0,
8274 g => [4],
8275 },
8276 {
8277 b => {y => 20},
8278 c => 3,
8279 e => [5],
8280 f => [6]
8281 },
8282 {
8283 b => {z => 456},
8284 c => {z => 123},
8285 d => 2,
8286 e => [6, 7],
8287 f => {7, 8},
8288 g => 5,
8289 },
8290 );
8291  
8292 # {
8293 # a => 1,
8294 # b => {
8295 # x => 10,
8296 # y => 20,
8297 # z => 456
8298 # },
8299 # c => {z => 123},
8300 # d => 2,
8301 # e => [5, 6, 7],
8302 # f => [6, {7, 8}],
8303 # g => [4, 5],
8304 # }
8305  
8306 =back
8307  
8308 =cut
8309  
8310 =head2 merge_join_mutate
8311  
8312 merge_join_mutate(any @args) (any)
8313  
8314 The merge_join_mutate performs a merge operaiton in accordance with
8315 L</merge_join> except that it mutates the values being merged and returns the
8316 mutated value.
8317  
8318 I<Since C<4.15>>
8319  
8320 =over 4
8321  
8322 =item merge_join_mutate example 1
8323  
8324 # given: synopsis
8325  
8326 package main;
8327  
8328 use Venus 'merge_join_mutate';
8329  
8330 my $merge_join_mutate = merge_join_mutate;
8331  
8332 # undef
8333  
8334 =back
8335  
8336 =over 4
8337  
8338 =item merge_join_mutate example 2
8339  
8340 # given: synopsis
8341  
8342 package main;
8343  
8344 use Venus 'merge_join_mutate';
8345  
8346 my $merge_join_mutate = merge_join_mutate 1;
8347  
8348 # 1
8349  
8350 =back
8351  
8352 =over 4
8353  
8354 =item merge_join_mutate example 3
8355  
8356 # given: synopsis
8357  
8358 package main;
8359  
8360 use Venus 'merge_join_mutate';
8361  
8362 $result = 1;
8363  
8364 my $merge_join_mutate = merge_join_mutate $result, 2;
8365  
8366 # 2
8367  
8368 $result;
8369  
8370 # 2
8371  
8372 =back
8373  
8374 =over 4
8375  
8376 =item merge_join_mutate example 4
8377  
8378 # given: synopsis
8379  
8380 package main;
8381  
8382 use Venus 'merge_join_mutate';
8383  
8384 $result = 1;
8385  
8386 my $merge_join_mutate = merge_join_mutate $result, [2, 3];
8387  
8388 # [2, 3]
8389  
8390 $result;
8391  
8392 # [2, 3]
8393  
8394 =back
8395  
8396 =over 4
8397  
8398 =item merge_join_mutate example 5
8399  
8400 # given: synopsis
8401  
8402 package main;
8403  
8404 use Venus 'merge_join_mutate';
8405  
8406 $result = [1, 2];
8407  
8408 my $merge_join_mutate = merge_join_mutate $result, 3;
8409  
8410 # [1, 2, 3]
8411  
8412 $result;
8413  
8414 # [1, 2, 3]
8415  
8416 =back
8417  
8418 =over 4
8419  
8420 =item merge_join_mutate example 6
8421  
8422 # given: synopsis
8423  
8424 package main;
8425  
8426 use Venus 'merge_join_mutate';
8427  
8428 $result = [1, 2];
8429  
8430 my $merge_join_mutate = merge_join_mutate $result, [3, 4];
8431  
8432 # [1, 2, 3, 4]
8433  
8434 $result;
8435  
8436 # [1, 2, 3, 4]
8437  
8438 =back
8439  
8440 =over 4
8441  
8442 =item merge_join_mutate example 7
8443  
8444 # given: synopsis
8445  
8446 package main;
8447  
8448 use Venus 'merge_join_mutate';
8449  
8450 $result = {a => 1};
8451  
8452 my $merge_join_mutate = merge_join_mutate $result, {a => 2, b => 3};
8453  
8454 # {a => 2, b => 3}
8455  
8456 $result;
8457  
8458 # {a => 2, b => 3}
8459  
8460 =back
8461  
8462 =cut
8463  
8464 =head2 merge_keep
8465  
8466 merge_keep(any @args) (any)
8467  
8468 The merge_keep function merges two (or more) values and returns a new values
8469 based on the types of the inputs:
8470  
8471 B<Note:> This function retains the existing data, appends arrayrefs with
8472 arrayrefs, and only merges new keys and values when merging hashrefs with
8473 hashrefs.
8474  
8475 =over 4
8476  
8477 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "scalar" we
8478 keep the C<lvalue>.
8479  
8480 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "arrayref" we
8481 keep the C<lvalue>.
8482  
8483 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "hashref" we
8484 keep the C<lvalue>.
8485  
8486 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "scalar" we
8487 append the C<rvalue> to the C<lvalue>.
8488  
8489 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "arrayref"
8490 we append the items in C<rvalue> to the C<lvalue>.
8491  
8492 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "hashref" we
8493 append the C<rvalue> to the C<lvalue>.
8494  
8495 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "scalar" we
8496 keep the C<lvalue>.
8497  
8498 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "arrayref" we
8499 keep the C<lvalue>.
8500  
8501 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "hashref" we
8502 append the keys and values in C<rvalue> to the C<lvalue>, but without
8503 overwriting existing keys if there's overlap.
8504  
8505 =back
8506  
8507 I<Since C<4.15>>
8508  
8509 =over 4
8510  
8511 =item merge_keep example 1
8512  
8513 # given: synopsis
8514  
8515 package main;
8516  
8517 use Venus 'merge_keep';
8518  
8519 my $merge_keep = merge_keep;
8520  
8521 # undef
8522  
8523 =back
8524  
8525 =over 4
8526  
8527 =item merge_keep example 2
8528  
8529 # given: synopsis
8530  
8531 package main;
8532  
8533 use Venus 'merge_keep';
8534  
8535 my $merge_keep = merge_keep 1;
8536  
8537 # 1
8538  
8539 =back
8540  
8541 =over 4
8542  
8543 =item merge_keep example 3
8544  
8545 # given: synopsis
8546  
8547 package main;
8548  
8549 use Venus 'merge_keep';
8550  
8551 my $merge_keep = merge_keep 1, 2;
8552  
8553 # 1
8554  
8555 =back
8556  
8557 =over 4
8558  
8559 =item merge_keep example 4
8560  
8561 # given: synopsis
8562  
8563 package main;
8564  
8565 use Venus 'merge_keep';
8566  
8567 my $merge_keep = merge_keep 1, [2, 3];
8568  
8569 # 1
8570  
8571 =back
8572  
8573 =over 4
8574  
8575 =item merge_keep example 5
8576  
8577 # given: synopsis
8578  
8579 package main;
8580  
8581 use Venus 'merge_keep';
8582  
8583 my $merge_keep = merge_keep [1, 2], 3;
8584  
8585 # [1, 2, 3]
8586  
8587 =back
8588  
8589 =over 4
8590  
8591 =item merge_keep example 6
8592  
8593 # given: synopsis
8594  
8595 package main;
8596  
8597 use Venus 'merge_keep';
8598  
8599 my $merge_keep = merge_keep [1, 2], [3, 4];
8600  
8601 # [1, 2, 3, 4]
8602  
8603 =back
8604  
8605 =over 4
8606  
8607 =item merge_keep example 7
8608  
8609 # given: synopsis
8610  
8611 package main;
8612  
8613 use Venus 'merge_keep';
8614  
8615 my $merge_keep = merge_keep {a => 1}, {a => 2, b => 3};
8616  
8617 # {a => 1, b => 3}
8618  
8619 =back
8620  
8621 =over 4
8622  
8623 =item merge_keep example 8
8624  
8625 # given: synopsis
8626  
8627 package main;
8628  
8629 use Venus 'merge_keep';
8630  
8631 my $merge_keep = merge_keep(
8632 {
8633 a => 1,
8634 b => {x => 10},
8635 d => 0,
8636 g => [4],
8637 },
8638 {
8639 b => {y => 20},
8640 c => 3,
8641 e => [5],
8642 f => [6]
8643 },
8644 {
8645 b => {y => 30, z => 456},
8646 c => {z => 123},
8647 d => 2,
8648 e => [6, 7],
8649 f => {7, 8},
8650 g => 5,
8651 },
8652 );
8653  
8654 # {
8655 # a => 1,
8656 # b => {
8657 # x => 10,
8658 # y => 20,
8659 # z => 456
8660 # },
8661 # c => 3,
8662 # d => 0,
8663 # e => [5, 6, 7],
8664 # f => [6, {7, 8}],
8665 # g => [4, 5],
8666 # }
8667  
8668 =back
8669  
8670 =cut
8671  
8672 =head2 merge_keep_mutate
8673  
8674 merge_keep_mutate(any @args) (any)
8675  
8676 The merge_keep_mutate performs a merge operaiton in accordance with
8677 L</merge_keep> except that it mutates the values being merged and returns the
8678 mutated value.
8679  
8680 I<Since C<4.15>>
8681  
8682 =over 4
8683  
8684 =item merge_keep_mutate example 1
8685  
8686 # given: synopsis
8687  
8688 package main;
8689  
8690 use Venus 'merge_keep_mutate';
8691  
8692 my $merge_keep_mutate = merge_keep_mutate;
8693  
8694 # undef
8695  
8696 =back
8697  
8698 =over 4
8699  
8700 =item merge_keep_mutate example 2
8701  
8702 # given: synopsis
8703  
8704 package main;
8705  
8706 use Venus 'merge_keep_mutate';
8707  
8708 my $merge_keep_mutate = merge_keep_mutate 1;
8709  
8710 # 1
8711  
8712 =back
8713  
8714 =over 4
8715  
8716 =item merge_keep_mutate example 3
8717  
8718 # given: synopsis
8719  
8720 package main;
8721  
8722 use Venus 'merge_keep_mutate';
8723  
8724 $result = 1;
8725  
8726 my $merge_keep_mutate = merge_keep_mutate $result, 2;
8727  
8728 # 1
8729  
8730 $result;
8731  
8732 # 1
8733  
8734 =back
8735  
8736 =over 4
8737  
8738 =item merge_keep_mutate example 4
8739  
8740 # given: synopsis
8741  
8742 package main;
8743  
8744 use Venus 'merge_keep_mutate';
8745  
8746 $result = 1;
8747  
8748 my $merge_keep_mutate = merge_keep_mutate $result, [2, 3];
8749  
8750 # 1
8751  
8752 $result;
8753  
8754 # 1
8755  
8756 =back
8757  
8758 =over 4
8759  
8760 =item merge_keep_mutate example 5
8761  
8762 # given: synopsis
8763  
8764 package main;
8765  
8766 use Venus 'merge_keep_mutate';
8767  
8768 $result = [1, 2];
8769  
8770 my $merge_keep_mutate = merge_keep_mutate $result, 3;
8771  
8772 # [1, 2, 3]
8773  
8774 $result;
8775  
8776 # [1, 2, 3]
8777  
8778 =back
8779  
8780 =over 4
8781  
8782 =item merge_keep_mutate example 6
8783  
8784 # given: synopsis
8785  
8786 package main;
8787  
8788 use Venus 'merge_keep_mutate';
8789  
8790 $result = [1, 2];
8791  
8792 my $merge_keep_mutate = merge_keep_mutate $result, [3, 4];
8793  
8794 # [1, 2, 3, 4]
8795  
8796 $result;
8797  
8798 # [1, 2, 3, 4]
8799  
8800 =back
8801  
8802 =over 4
8803  
8804 =item merge_keep_mutate example 7
8805  
8806 # given: synopsis
8807  
8808 package main;
8809  
8810 use Venus 'merge_keep_mutate';
8811  
8812 $result = {a => 1};
8813  
8814 my $merge_keep_mutate = merge_keep_mutate $result, {a => 2, b => 3};
8815  
8816 # {a => 1, b => 3}
8817  
8818 $result;
8819  
8820 # {a => 1, b => 3}
8821  
8822 =back
8823  
8824 =cut
8825  
8826 =head2 merge_swap
8827  
8828 merge_swap(any @args) (any)
8829  
8830 The merge_swap function merges two (or more) values and returns a new values
8831 based on the types of the inputs:
8832  
8833 B<Note:> This function replaces the existing data, including when merging
8834 hashrefs with hashrefs, and overwrites values (instead of appending) when
8835 merging arrayrefs with arrayrefs.
8836  
8837 =over 4
8838  
8839 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "scalar" we
8840 keep the C<rvalue>.
8841  
8842 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "arrayref" we
8843 keep the C<rvalue>.
8844  
8845 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "hashref" we
8846 keep the C<rvalue>.
8847  
8848 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "scalar" we
8849 append the C<rvalue> to the C<lvalue>.
8850  
8851 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "arrayref"
8852 we replace each items in C<lvalue> with the value at the corresponding position
8853 in the C<rvalue>.
8854  
8855 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "hashref" we
8856 append the C<rvalue> to the C<lvalue>.
8857  
8858 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "scalar" we
8859 keep the C<rvalue>.
8860  
8861 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "arrayref" we
8862 keep the C<rvalue>.
8863  
8864 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "hashref" we
8865 append the keys and values in C<rvalue> to the C<lvalue>, overwriting existing
8866 keys if there's overlap.
8867  
8868 =back
8869  
8870 I<Since C<4.15>>
8871  
8872 =over 4
8873  
8874 =item merge_swap example 1
8875  
8876 # given: synopsis
8877  
8878 package main;
8879  
8880 use Venus 'merge_swap';
8881  
8882 my $merge_swap = merge_swap;
8883  
8884 # undef
8885  
8886 =back
8887  
8888 =over 4
8889  
8890 =item merge_swap example 2
8891  
8892 # given: synopsis
8893  
8894 package main;
8895  
8896 use Venus 'merge_swap';
8897  
8898 my $merge_swap = merge_swap 1;
8899  
8900 # 1
8901  
8902 =back
8903  
8904 =over 4
8905  
8906 =item merge_swap example 3
8907  
8908 # given: synopsis
8909  
8910 package main;
8911  
8912 use Venus 'merge_swap';
8913  
8914 my $merge_swap = merge_swap 1, 2;
8915  
8916 # 2
8917  
8918 =back
8919  
8920 =over 4
8921  
8922 =item merge_swap example 4
8923  
8924 # given: synopsis
8925  
8926 package main;
8927  
8928 use Venus 'merge_swap';
8929  
8930 my $merge_swap = merge_swap 1, [2, 3];
8931  
8932 # [2, 3]
8933  
8934 =back
8935  
8936 =over 4
8937  
8938 =item merge_swap example 5
8939  
8940 # given: synopsis
8941  
8942 package main;
8943  
8944 use Venus 'merge_swap';
8945  
8946 my $merge_swap = merge_swap [1, 2], 3;
8947  
8948 # [1, 2, 3]
8949  
8950 =back
8951  
8952 =over 4
8953  
8954 =item merge_swap example 6
8955  
8956 # given: synopsis
8957  
8958 package main;
8959  
8960 use Venus 'merge_swap';
8961  
8962 my $merge_swap = merge_swap [1, 2, 3], [4, 5];
8963  
8964 # [4, 5, 3]
8965  
8966 =back
8967  
8968 =over 4
8969  
8970 =item merge_swap example 7
8971  
8972 # given: synopsis
8973  
8974 package main;
8975  
8976 use Venus 'merge_swap';
8977  
8978 my $merge_swap = merge_swap {a => 1}, {a => 2, b => 3};
8979  
8980 # {a => 2, b => 3}
8981  
8982 =back
8983  
8984 =over 4
8985  
8986 =item merge_swap example 8
8987  
8988 # given: synopsis
8989  
8990 package main;
8991  
8992 use Venus 'merge_swap';
8993  
8994 my $merge_swap = merge_swap(
8995 {
8996 a => 1,
8997 b => {x => 10},
8998 d => 0,
8999 g => [4],
9000 },
9001 {
9002 b => {y => 20},
9003 c => 3,
9004 e => [5],
9005 f => [6]
9006 },
9007 {
9008 b => {y => 30, z => 456},
9009 c => {z => 123},
9010 d => 2,
9011 e => [6, 7],
9012 f => {7, 8},
9013 g => 5,
9014 },
9015 );
9016  
9017 # {
9018 # a => 1,
9019 # b => {
9020 # x => 10,
9021 # y => 30,
9022 # z => 456
9023 # },
9024 # c => {z => 123},
9025 # d => 2,
9026 # e => [6, 7],
9027 # f => [6, {7, 8}],
9028 # g => [4, 5],
9029 # }
9030  
9031 =back
9032  
9033 =cut
9034  
9035 =head2 merge_swap_mutate
9036  
9037 merge_swap_mutate(any @args) (any)
9038  
9039 The merge_swap_mutate performs a merge operaiton in accordance with
9040 L</merge_swap> except that it mutates the values being merged and returns the
9041 mutated value.
9042  
9043 I<Since C<4.15>>
9044  
9045 =over 4
9046  
9047 =item merge_swap_mutate example 1
9048  
9049 # given: synopsis
9050  
9051 package main;
9052  
9053 use Venus 'merge_swap_mutate';
9054  
9055 $result = undef;
9056  
9057 my $merge_swap_mutate = merge_swap_mutate $result;
9058  
9059 # undef
9060  
9061 $result;
9062  
9063 # undef
9064  
9065 =back
9066  
9067 =over 4
9068  
9069 =item merge_swap_mutate example 2
9070  
9071 # given: synopsis
9072  
9073 package main;
9074  
9075 use Venus 'merge_swap_mutate';
9076  
9077 $result = 1;
9078  
9079 my $merge_swap_mutate = merge_swap_mutate $result;
9080  
9081 # 1
9082  
9083 $result;
9084  
9085 # 1
9086  
9087 =back
9088  
9089 =over 4
9090  
9091 =item merge_swap_mutate example 3
9092  
9093 # given: synopsis
9094  
9095 package main;
9096  
9097 use Venus 'merge_swap_mutate';
9098  
9099 $result = 1;
9100  
9101 my $merge_swap_mutate = merge_swap_mutate $result, 2;
9102  
9103 # 2
9104  
9105 $result;
9106  
9107 # 2
9108  
9109 =back
9110  
9111 =over 4
9112  
9113 =item merge_swap_mutate example 4
9114  
9115 # given: synopsis
9116  
9117 package main;
9118  
9119 use Venus 'merge_swap_mutate';
9120  
9121 $result = 1;
9122  
9123 my $merge_swap_mutate = merge_swap_mutate $result, [2, 3];
9124  
9125 # [2, 3]
9126  
9127 $result;
9128  
9129 # [2, 3]
9130  
9131 =back
9132  
9133 =over 4
9134  
9135 =item merge_swap_mutate example 5
9136  
9137 # given: synopsis
9138  
9139 package main;
9140  
9141 use Venus 'merge_swap_mutate';
9142  
9143 $result = [1, 2];
9144  
9145 my $merge_swap_mutate = merge_swap_mutate $result, 3;
9146  
9147 # [1, 2, 3]
9148  
9149 $result;
9150  
9151 # [1, 2, 3]
9152  
9153 =back
9154  
9155 =over 4
9156  
9157 =item merge_swap_mutate example 6
9158  
9159 # given: synopsis
9160  
9161 package main;
9162  
9163 use Venus 'merge_swap_mutate';
9164  
9165 $result = [1, 2, 3];
9166  
9167 my $merge_swap_mutate = merge_swap_mutate $result, [4, 5];
9168  
9169 # [4, 5, 3]
9170  
9171 $result;
9172  
9173 # [4, 5, 3]
9174  
9175 =back
9176  
9177 =over 4
9178  
9179 =item merge_swap_mutate example 7
9180  
9181 # given: synopsis
9182  
9183 package main;
9184  
9185 use Venus 'merge_swap_mutate';
9186  
9187 $result = {a => 1};
9188  
9189 my $merge_swap_mutate = merge_swap_mutate $result, {a => 2, b => 3};
9190  
9191 # {a => 2, b => 3}
9192  
9193 $result;
9194  
9195 # {a => 2, b => 3}
9196  
9197 =back
9198  
9199 =cut
9200  
9201 =head2 merge_take
9202  
9203 merge_take(any @args) (any)
9204  
9205 The merge_take function merges two (or more) values and returns a new values
9206 based on the types of the inputs:
9207  
9208 B<Note:> This function always "takes" the new value, does not append arrayrefs,
9209 and overwrites keys and values when merging hashrefs with hashrefs.
9210  
9211 =over 4
9212  
9213 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "scalar" we
9214 keep the C<rvalue>.
9215  
9216 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "arrayref" we
9217 keep the C<rvalue>.
9218  
9219 =item * When the C<lvalue> is a "scalar" and the C<rvalue> is a "hashref" we
9220 keep the C<rvalue>.
9221  
9222 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "scalar" we
9223 keep the C<rvalue>.
9224  
9225 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "arrayref"
9226 we keep the C<rvalue>.
9227  
9228 =item * When the C<lvalue> is a "arrayref" and the C<rvalue> is a "hashref" we
9229 keep the C<rvalue>.
9230  
9231 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "scalar" we
9232 keep the C<rvalue>.
9233  
9234 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "arrayref" we
9235 keep the C<rvalue>.
9236  
9237 =item * When the C<lvalue> is a "hashref" and the C<rvalue> is a "hashref" we
9238 append the keys and values in C<rvalue> to the C<lvalue>, overwriting existing
9239 keys if there's overlap.
9240  
9241 =back
9242  
9243 I<Since C<4.15>>
9244  
9245 =over 4
9246  
9247 =item merge_take example 1
9248  
9249 # given: synopsis
9250  
9251 package main;
9252  
9253 use Venus 'merge_take';
9254  
9255 my $merge_take = merge_take;
9256  
9257 # undef
9258  
9259 =back
9260  
9261 =over 4
9262  
9263 =item merge_take example 2
9264  
9265 # given: synopsis
9266  
9267 package main;
9268  
9269 use Venus 'merge_take';
9270  
9271 my $merge_take = merge_take 1;
9272  
9273 # 1
9274  
9275 =back
9276  
9277 =over 4
9278  
9279 =item merge_take example 3
9280  
9281 # given: synopsis
9282  
9283 package main;
9284  
9285 use Venus 'merge_take';
9286  
9287 my $merge_take = merge_take 1, 2;
9288  
9289 # 2
9290  
9291 =back
9292  
9293 =over 4
9294  
9295 =item merge_take example 4
9296  
9297 # given: synopsis
9298  
9299 package main;
9300  
9301 use Venus 'merge_take';
9302  
9303 my $merge_take = merge_take [1], [2, 3];
9304  
9305 # [2, 3]
9306  
9307 =back
9308  
9309 =over 4
9310  
9311 =item merge_take example 5
9312  
9313 # given: synopsis
9314  
9315 package main;
9316  
9317 use Venus 'merge_take';
9318  
9319 my $merge_take = merge_take {a => 1, b => {x => 10}}, {b => {y => 20}, c => 3};
9320  
9321 # {a => 1, b => {x => 10, y => 20}, c => 3}
9322  
9323 =back
9324  
9325 =over 4
9326  
9327 =item merge_take example 6
9328  
9329 # given: synopsis
9330  
9331 package main;
9332  
9333 use Venus 'merge_take';
9334  
9335 my $merge_take = merge_take [1, 2], 3;
9336  
9337 # 3
9338  
9339 =back
9340  
9341 =over 4
9342  
9343 =item merge_take example 7
9344  
9345 # given: synopsis
9346  
9347 package main;
9348  
9349 use Venus 'merge_take';
9350  
9351 my $merge_take = merge_take {a => 1}, 2;
9352  
9353 # 2
9354  
9355 =back
9356  
9357 =over 4
9358  
9359 =item merge_take example 8
9360  
9361 # given: synopsis
9362  
9363 package main;
9364  
9365 use Venus 'merge_take';
9366  
9367 my $merge_take = merge_take(
9368 {
9369 a => 1,
9370 b => {x => 10},
9371 d => 0,
9372 g => [4],
9373 },
9374 {
9375 b => {y => 20},
9376 c => 3,
9377 e => [5],
9378 f => [6]
9379 },
9380 {
9381 b => {y => 30, z => 456},
9382 c => {z => 123},
9383 d => 2,
9384 e => [6, 7],
9385 f => {7, 8},
9386 g => 5,
9387 },
9388 );
9389  
9390 # {
9391 # a => 1,
9392 # b => {
9393 # x => 10,
9394 # y => 30,
9395 # z => 456
9396 # },
9397 # c => {z => 123},
9398 # d => 2,
9399 # e => [6, 7],
9400 # f => {7, 8},
9401 # g => 5,
9402 # }
9403  
9404 =back
9405  
9406 =cut
9407  
9408 =head2 merge_take_mutate
9409  
9410 merge_take_mutate(any @args) (any)
9411  
9412 The merge_take_mutate performs a merge operaiton in accordance with
9413 L</merge_take> except that it mutates the values being merged and returns the
9414 mutated value.
9415  
9416 I<Since C<4.15>>
9417  
9418 =over 4
9419  
9420 =item merge_take_mutate example 1
9421  
9422 # given: synopsis
9423  
9424 package main;
9425  
9426 use Venus 'merge_take_mutate';
9427  
9428 $result = undef;
9429  
9430 my $merge_take_mutate = merge_take_mutate $result;
9431  
9432 # undef
9433  
9434 $result;
9435  
9436 # undef
9437  
9438 =back
9439  
9440 =over 4
9441  
9442 =item merge_take_mutate example 2
9443  
9444 # given: synopsis
9445  
9446 package main;
9447  
9448 use Venus 'merge_take_mutate';
9449  
9450 $result = 1;
9451  
9452 my $merge_take_mutate = merge_take_mutate $result;
9453  
9454 # 1
9455  
9456 $result;
9457  
9458 # 1
9459  
9460 =back
9461  
9462 =over 4
9463  
9464 =item merge_take_mutate example 3
9465  
9466 # given: synopsis
9467  
9468 package main;
9469  
9470 use Venus 'merge_take_mutate';
9471  
9472 $result = 1;
9473  
9474 my $merge_take_mutate = merge_take_mutate $result, 2;
9475  
9476 # 2
9477  
9478 $result;
9479  
9480 # 2
9481  
9482 =back
9483  
9484 =over 4
9485  
9486 =item merge_take_mutate example 4
9487  
9488 # given: synopsis
9489  
9490 package main;
9491  
9492 use Venus 'merge_take_mutate';
9493  
9494 $result = [1];
9495  
9496 my $merge_take_mutate = merge_take_mutate $result, [2, 3];
9497  
9498 # [2, 3]
9499  
9500 $result;
9501  
9502 # [2, 3]
9503  
9504 =back
9505  
9506 =over 4
9507  
9508 =item merge_take_mutate example 5
9509  
9510 # given: synopsis
9511  
9512 package main;
9513  
9514 use Venus 'merge_take_mutate';
9515  
9516 $result = {a => 1, b => {x => 10}};
9517  
9518 my $merge_take_mutate = merge_take_mutate $result, {b => {y => 20}, c => 3};
9519  
9520 # {a => 1, b => {x => 10, y => 20}, c => 3}
9521  
9522 $result;
9523  
9524 # {a => 1, b => {x => 10, y => 20}, c => 3}
9525  
9526 =back
9527  
9528 =over 4
9529  
9530 =item merge_take_mutate example 6
9531  
9532 # given: synopsis
9533  
9534 package main;
9535  
9536 use Venus 'merge_take_mutate';
9537  
9538 $result = [1, 2];
9539  
9540 my $merge_take_mutate = merge_take_mutate $result, 3;
9541  
9542 # 3
9543  
9544 $result;
9545  
9546 # 3
9547  
9548 =back
9549  
9550 =over 4
9551  
9552 =item merge_take_mutate example 7
9553  
9554 # given: synopsis
9555  
9556 package main;
9557  
9558 use Venus 'merge_take_mutate';
9559  
9560 $result = {a => 1};
9561  
9562 my $merge_take_mutate = merge_take_mutate $result, 2;
9563  
9564 # 2
9565  
9566 $result;
9567  
9568 # 2
9569  
9570 =back
9571  
9572 =cut
9573  
9574 =head2 meta
9575  
9576 meta(string $value, string | coderef $code, any @args) (any)
9577  
9578 The meta function builds and returns a L<Venus::Meta> object, or dispatches to
9579 the coderef or method provided.
9580  
9581 I<Since C<2.55>>
9582  
9583 =over 4
9584  
9585 =item meta example 1
9586  
9587 package main;
9588  
9589 use Venus 'meta';
9590  
9591 my $meta = meta 'Venus';
9592  
9593 # bless({...}, 'Venus::Meta')
9594  
9595 =back
9596  
9597 =over 4
9598  
9599 =item meta example 2
9600  
9601 package main;
9602  
9603 use Venus 'meta';
9604  
9605 my $result = meta 'Venus', 'sub', 'meta';
9606  
9607 # 1
9608  
9609 =back
9610  
9611 =cut
9612  
9613 =head2 name
9614  
9615 name(string $value, string | coderef $code, any @args) (any)
9616  
9617 The name function builds and returns a L<Venus::Name> object, or dispatches to
9618 the coderef or method provided.
9619  
9620 I<Since C<2.55>>
9621  
9622 =over 4
9623  
9624 =item name example 1
9625  
9626 package main;
9627  
9628 use Venus 'name';
9629  
9630 my $name = name 'Foo/Bar';
9631  
9632 # bless({...}, 'Venus::Name')
9633  
9634 =back
9635  
9636 =over 4
9637  
9638 =item name example 2
9639  
9640 package main;
9641  
9642 use Venus 'name';
9643  
9644 my $name = name 'Foo/Bar', 'package';
9645  
9646 # "Foo::Bar"
9647  
9648 =back
9649  
9650 =cut
9651  
9652 =head2 number
9653  
9654 number(Num $value, string | coderef $code, any @args) (any)
9655  
9656 The number function builds and returns a L<Venus::Number> object, or dispatches
9657 to the coderef or method provided.
9658  
9659 I<Since C<2.55>>
9660  
9661 =over 4
9662  
9663 =item number example 1
9664  
9665 package main;
9666  
9667 use Venus 'number';
9668  
9669 my $number = number 1_000;
9670  
9671 # bless({...}, 'Venus::Number')
9672  
9673 =back
9674  
9675 =over 4
9676  
9677 =item number example 2
9678  
9679 package main;
9680  
9681 use Venus 'number';
9682  
9683 my $number = number 1_000, 'prepend', 1;
9684  
9685 # 11_000
9686  
9687 =back
9688  
9689 =cut
9690  
9691 =head2 opts
9692  
9693 opts(arrayref $value, string | coderef $code, any @args) (any)
9694  
9695 The opts function builds and returns a L<Venus::Opts> object, or dispatches to
9696 the coderef or method provided.
9697  
9698 I<Since C<2.55>>
9699  
9700 =over 4
9701  
9702 =item opts example 1
9703  
9704 package main;
9705  
9706 use Venus 'opts';
9707  
9708 my $opts = opts ['--resource', 'users'];
9709  
9710 # bless({...}, 'Venus::Opts')
9711  
9712 =back
9713  
9714 =over 4
9715  
9716 =item opts example 2
9717  
9718 package main;
9719  
9720 use Venus 'opts';
9721  
9722 my $opts = opts ['--resource', 'users'], 'reparse', ['resource|r=s', 'help|h'];
9723  
9724 # bless({...}, 'Venus::Opts')
9725  
9726 # my $resource = $opts->get('resource');
9727  
9728 # "users"
9729  
9730 =back
9731  
9732 =cut
9733  
9734 =head2 pairs
9735  
9736 pairs(any $data) (arrayref)
9737  
9738 The pairs function accepts an arrayref or hashref and returns an arrayref of
9739 arrayrefs holding keys (or indices) and values. The function returns an empty
9740 arrayref for all other values provided. Returns a list in list context.
9741  
9742 I<Since C<3.04>>
9743  
9744 =over 4
9745  
9746 =item pairs example 1
9747  
9748 package main;
9749  
9750 use Venus 'pairs';
9751  
9752 my $pairs = pairs [1..4];
9753  
9754 # [[0,1], [1,2], [2,3], [3,4]]
9755  
9756 =back
9757  
9758 =over 4
9759  
9760 =item pairs example 2
9761  
9762 package main;
9763  
9764 use Venus 'pairs';
9765  
9766 my $pairs = pairs {'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4};
9767  
9768 # [['a',1], ['b',2], ['c',3], ['d',4]]
9769  
9770 =back
9771  
9772 =over 4
9773  
9774 =item pairs example 3
9775  
9776 package main;
9777  
9778 use Venus 'pairs';
9779  
9780 my @pairs = pairs [1..4];
9781  
9782 # ([0,1], [1,2], [2,3], [3,4])
9783  
9784 =back
9785  
9786 =over 4
9787  
9788 =item pairs example 4
9789  
9790 package main;
9791  
9792 use Venus 'pairs';
9793  
9794 my @pairs = pairs {'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4};
9795  
9796 # (['a',1], ['b',2], ['c',3], ['d',4])
9797  
9798 =back
9799  
9800 =cut
9801  
9802 =head2 path
9803  
9804 path(string $value, string | coderef $code, any @args) (any)
9805  
9806 The path function builds and returns a L<Venus::Path> object, or dispatches
9807 to the coderef or method provided.
9808  
9809 I<Since C<2.55>>
9810  
9811 =over 4
9812  
9813 =item path example 1
9814  
9815 package main;
9816  
9817 use Venus 'path';
9818  
9819 my $path = path 't/data/planets';
9820  
9821 # bless({...}, 'Venus::Path')
9822  
9823 =back
9824  
9825 =over 4
9826  
9827 =item path example 2
9828  
9829 package main;
9830  
9831 use Venus 'path';
9832  
9833 my $path = path 't/data/planets', 'absolute';
9834  
9835 # bless({...}, 'Venus::Path')
9836  
9837 =back
9838  
9839 =cut
9840  
9841 =head2 perl
9842  
9843 perl(string $call, any $data) (any)
9844  
9845 The perl function builds a L<Venus::Dump> object and will either
9846 L<Venus::Dump/decode> or L<Venus::Dump/encode> based on the argument provided
9847 and returns the result.
9848  
9849 I<Since C<2.40>>
9850  
9851 =over 4
9852  
9853 =item perl example 1
9854  
9855 package main;
9856  
9857 use Venus 'perl';
9858  
9859 my $decode = perl 'decode', '{stable=>bless({},\'Venus::True\')}';
9860  
9861 # { stable => 1 }
9862  
9863 =back
9864  
9865 =over 4
9866  
9867 =item perl example 2
9868  
9869 package main;
9870  
9871 use Venus 'perl';
9872  
9873 my $encode = perl 'encode', { stable => true };
9874  
9875 # '{stable=>bless({},\'Venus::True\')}'
9876  
9877 =back
9878  
9879 =over 4
9880  
9881 =item perl example 3
9882  
9883 package main;
9884  
9885 use Venus 'perl';
9886  
9887 my $perl = perl;
9888  
9889 # bless({...}, 'Venus::Dump')
9890  
9891 =back
9892  
9893 =over 4
9894  
9895 =item perl example 4
9896  
9897 package main;
9898  
9899 use Venus 'perl';
9900  
9901 my $perl = perl 'class', {data => "..."};
9902  
9903 # Exception! (isa Venus::Fault)
9904  
9905 =back
9906  
9907 =cut
9908  
9909 =head2 process
9910  
9911 process(string | coderef $code, any @args) (any)
9912  
9913 The process function builds and returns a L<Venus::Process> object, or
9914 dispatches to the coderef or method provided.
9915  
9916 I<Since C<2.55>>
9917  
9918 =over 4
9919  
9920 =item process example 1
9921  
9922 package main;
9923  
9924 use Venus 'process';
9925  
9926 my $process = process;
9927  
9928 # bless({...}, 'Venus::Process')
9929  
9930 =back
9931  
9932 =over 4
9933  
9934 =item process example 2
9935  
9936 package main;
9937  
9938 use Venus 'process';
9939  
9940 my $process = process 'do', 'alarm', 10;
9941  
9942 # bless({...}, 'Venus::Process')
9943  
9944 =back
9945  
9946 =cut
9947  
9948 =head2 proto
9949  
9950 proto(hashref $value, string | coderef $code, any @args) (any)
9951  
9952 The proto function builds and returns a L<Venus::Prototype> object, or
9953 dispatches to the coderef or method provided.
9954  
9955 I<Since C<2.55>>
9956  
9957 =over 4
9958  
9959 =item proto example 1
9960  
9961 package main;
9962  
9963 use Venus 'proto';
9964  
9965 my $proto = proto {
9966 '$counter' => 0,
9967 };
9968  
9969 # bless({...}, 'Venus::Prototype')
9970  
9971 =back
9972  
9973 =over 4
9974  
9975 =item proto example 2
9976  
9977 package main;
9978  
9979 use Venus 'proto';
9980  
9981 my $proto = proto { '$counter' => 0 }, 'apply', {
9982 '&decrement' => sub { $_[0]->counter($_[0]->counter - 1) },
9983 '&increment' => sub { $_[0]->counter($_[0]->counter + 1) },
9984 };
9985  
9986 # bless({...}, 'Venus::Prototype')
9987  
9988 =back
9989  
9990 =cut
9991  
9992 =head2 puts
9993  
9994 puts(any @args) (arrayref)
9995  
9996 The puts function select values from within the underlying data structure using
9997 L<Venus::Array/path> or L<Venus::Hash/path>, optionally assigning the value to
9998 the preceeding scalar reference and returns all the values selected.
9999  
10000 I<Since C<3.20>>
10001  
10002 =over 4
10003  
10004 =item puts example 1
10005  
10006 package main;
10007  
10008 use Venus 'puts';
10009  
10010 my $data = {
10011 size => "small",
10012 fruit => "apple",
10013 meta => {
10014 expiry => '5d',
10015 },
10016 color => "red",
10017 };
10018  
10019 puts $data, (
10020 \my $fruit, 'fruit',
10021 \my $expiry, 'meta.expiry'
10022 );
10023  
10024 my $puts = [$fruit, $expiry];
10025  
10026 # ["apple", "5d"]
10027  
10028 =back
10029  
10030 =cut
10031  
10032 =head2 raise
10033  
10034 raise(string $class | tuple[string, string] $class, any @args) (Venus::Error)
10035  
10036 The raise function generates and throws a named exception object derived from
10037 L<Venus::Error>, or provided base class, using the exception object arguments
10038 provided.
10039  
10040 I<Since C<0.01>>
10041  
10042 =over 4
10043  
10044 =item raise example 1
10045  
10046 package main;
10047  
10048 use Venus 'raise';
10049  
10050 my $error = raise 'MyApp::Error';
10051  
10052 # bless({...}, 'MyApp::Error')
10053  
10054 =back
10055  
10056 =over 4
10057  
10058 =item raise example 2
10059  
10060 package main;
10061  
10062 use Venus 'raise';
10063  
10064 my $error = raise ['MyApp::Error', 'Venus::Error'];
10065  
10066 # bless({...}, 'MyApp::Error')
10067  
10068 =back
10069  
10070 =over 4
10071  
10072 =item raise example 3
10073  
10074 package main;
10075  
10076 use Venus 'raise';
10077  
10078 my $error = raise ['MyApp::Error', 'Venus::Error'], {
10079 message => 'Something failed!',
10080 };
10081  
10082 # bless({message => 'Something failed!', ...}, 'MyApp::Error')
10083  
10084 =back
10085  
10086 =over 4
10087  
10088 =item raise example 4
10089  
10090 package main;
10091  
10092 use Venus 'raise';
10093  
10094 my $error = raise 'MyApp::Error', message => 'Something failed!';
10095  
10096 # bless({message => 'Something failed!', ...}, 'MyApp::Error')
10097  
10098 =back
10099  
10100 =over 4
10101  
10102 =item raise example 5
10103  
10104 package main;
10105  
10106 use Venus 'raise';
10107  
10108 my $error = raise 'MyApp::Error', name => 'on.issue', message => 'Something failed!';
10109  
10110 # bless({message => 'Something failed!', ...}, 'MyApp::Error')
10111  
10112 =back
10113  
10114 =cut
10115  
10116 =head2 random
10117  
10118 random(string | coderef $code, any @args) (any)
10119  
10120 The random function builds and returns a L<Venus::Random> object, or dispatches
10121 to the coderef or method provided.
10122  
10123 I<Since C<2.55>>
10124  
10125 =over 4
10126  
10127 =item random example 1
10128  
10129 package main;
10130  
10131 use Venus 'random';
10132  
10133 my $random = random;
10134  
10135 # bless({...}, 'Venus::Random')
10136  
10137 =back
10138  
10139 =over 4
10140  
10141 =item random example 2
10142  
10143 package main;
10144  
10145 use Venus 'random';
10146  
10147 my $random = random 'collect', 10, 'letter';
10148  
10149 # "ryKUPbJHYT"
10150  
10151 =back
10152  
10153 =cut
10154  
10155 =head2 range
10156  
10157 range(number | string @args) (arrayref)
10158  
10159 The range function returns the result of a L<Venus::Array/range> operation.
10160  
10161 I<Since C<3.20>>
10162  
10163 =over 4
10164  
10165 =item range example 1
10166  
10167 package main;
10168  
10169 use Venus 'range';
10170  
10171 my $range = range [1..9], ':4';
10172  
10173 # [1..5]
10174  
10175 =back
10176  
10177 =over 4
10178  
10179 =item range example 2
10180  
10181 package main;
10182  
10183 use Venus 'range';
10184  
10185 my $range = range [1..9], '-4:-1';
10186  
10187 # [6..9]
10188  
10189 =back
10190  
10191 =cut
10192  
10193 =head2 read_env
10194  
10195 read_env(string $data) (Venus::Config)
10196  
10197 The read_env function returns a new L<Venus::Config> object based on the string
10198 of key/value pairs provided.
10199  
10200 I<Since C<4.15>>
10201  
10202 =over 4
10203  
10204 =item read_env example 1
10205  
10206 package main;
10207  
10208 use Venus 'read_env';
10209  
10210 my $read_env = read_env "APPNAME=Example\nAPPVER=0.01\n# Comment\n\n\nAPPTAG=\"Godzilla\"";
10211  
10212 # bless(..., 'Venus::Config')
10213  
10214 =back
10215  
10216 =cut
10217  
10218 =head2 read_env_file
10219  
10220 read_env_file(string $file) (Venus::Config)
10221  
10222 The read_env_file function uses L<Venus::Path> to return a new L<Venus::Config>
10223 object based on the file provided.
10224  
10225 I<Since C<4.15>>
10226  
10227 =over 4
10228  
10229 =item read_env_file example 1
10230  
10231 package main;
10232  
10233 use Venus 'read_env_file';
10234  
10235 my $config = read_env_file 't/conf/read.env';
10236  
10237 # bless(..., 'Venus::Config')
10238  
10239 =back
10240  
10241 =cut
10242  
10243 =head2 read_json
10244  
10245 read_json(string $data) (Venus::Config)
10246  
10247 The read_json function returns a new L<Venus::Config> object based on the JSON
10248 string provided.
10249  
10250 I<Since C<4.15>>
10251  
10252 =over 4
10253  
10254 =item read_json example 1
10255  
10256 package main;
10257  
10258 use Venus 'read_json';
10259  
10260 my $config = read_json q(
10261 {
10262 "$metadata": {
10263 "tmplog": "/tmp/log"
10264 },
10265 "$services": {
10266 "log": { "package": "Venus/Path", "argument": { "$metadata": "tmplog" } }
10267 }
10268 }
10269 );
10270  
10271 # bless(..., 'Venus::Config')
10272  
10273 =back
10274  
10275 =cut
10276  
10277 =head2 read_json_file
10278  
10279 read_json_file(string $file) (Venus::Config)
10280  
10281 The read_json_file function uses L<Venus::Path> to return a new
10282 L<Venus::Config> object based on the file provided.
10283  
10284 I<Since C<4.15>>
10285  
10286 =over 4
10287  
10288 =item read_json_file example 1
10289  
10290 package main;
10291  
10292 use Venus 'read_json_file';
10293  
10294 my $config = read_json_file 't/conf/read.json';
10295  
10296 # bless(..., 'Venus::Config')
10297  
10298 =back
10299  
10300 =cut
10301  
10302 =head2 read_perl
10303  
10304 read_perl(string $data) (Venus::Config)
10305  
10306 The read_perl function returns a new L<Venus::Config> object based on the Perl
10307 string provided.
10308  
10309 I<Since C<4.15>>
10310  
10311 =over 4
10312  
10313 =item read_perl example 1
10314  
10315 package main;
10316  
10317 use Venus 'read_perl';
10318  
10319 my $config = read_perl q(
10320 {
10321 '$metadata' => {
10322 tmplog => "/tmp/log"
10323 },
10324 '$services' => {
10325 log => { package => "Venus/Path", argument => { '$metadata' => "tmplog" } }
10326 }
10327 }
10328 );
10329  
10330 # bless(..., 'Venus::Config')
10331  
10332 =back
10333  
10334 =cut
10335  
10336 =head2 read_perl_file
10337  
10338 read_perl_file(string $file) (Venus::Config)
10339  
10340 The read_perl_file function uses L<Venus::Path> to return a new
10341 L<Venus::Config> object based on the file provided.
10342  
10343 I<Since C<4.15>>
10344  
10345 =over 4
10346  
10347 =item read_perl_file example 1
10348  
10349 package main;
10350  
10351 use Venus 'read_perl_file';
10352  
10353 my $config = read_perl_file 't/conf/read.perl';
10354  
10355 # bless(..., 'Venus::Config')
10356  
10357 =back
10358  
10359 =cut
10360  
10361 =head2 read_yaml
10362  
10363 read_yaml(string $data) (Venus::Config)
10364  
10365 The read_yaml function returns a new L<Venus::Config> object based on the YAML
10366 string provided.
10367  
10368 I<Since C<4.15>>
10369  
10370 =over 4
10371  
10372 =item read_yaml example 1
10373  
10374 package main;
10375  
10376 use Venus 'read_yaml';
10377  
10378 my $config = read_yaml q(
10379 '$metadata':
10380 tmplog: /tmp/log
10381 '$services':
10382 log:
10383 package: "Venus/Path"
10384 argument:
10385 '$metadata': tmplog
10386 );
10387  
10388 # bless(..., 'Venus::Config')
10389  
10390 =back
10391  
10392 =cut
10393  
10394 =head2 read_yaml_file
10395  
10396 read_yaml_file(string $file) (Venus::Config)
10397  
10398 The read_yaml_file function uses L<Venus::Path> to return a new
10399 L<Venus::Config> object based on the YAML string provided.
10400  
10401 I<Since C<4.15>>
10402  
10403 =over 4
10404  
10405 =item read_yaml_file example 1
10406  
10407 package main;
10408  
10409 use Venus 'read_yaml_file';
10410  
10411 my $config = read_yaml_file 't/conf/read.yaml';
10412  
10413 # bless(..., 'Venus::Config')
10414  
10415 =back
10416  
10417 =cut
10418  
10419 =head2 regexp
10420  
10421 regexp(string $value, string | coderef $code, any @args) (any)
10422  
10423 The regexp function builds and returns a L<Venus::Regexp> object, or dispatches
10424 to the coderef or method provided.
10425  
10426 I<Since C<2.55>>
10427  
10428 =over 4
10429  
10430 =item regexp example 1
10431  
10432 package main;
10433  
10434 use Venus 'regexp';
10435  
10436 my $regexp = regexp '[0-9]';
10437  
10438 # bless({...}, 'Venus::Regexp')
10439  
10440 =back
10441  
10442 =over 4
10443  
10444 =item regexp example 2
10445  
10446 package main;
10447  
10448 use Venus 'regexp';
10449  
10450 my $replace = regexp '[0-9]', 'replace', 'ID 12345', '0', 'g';
10451  
10452 # bless({...}, 'Venus::Replace')
10453  
10454 # $replace->get;
10455  
10456 # "ID 00000"
10457  
10458 =back
10459  
10460 =cut
10461  
10462 =head2 render
10463  
10464 render(string $data, hashref $args) (string)
10465  
10466 The render function accepts a string as a template and renders it using
10467 L<Venus::Template>, and returns the result.
10468  
10469 I<Since C<3.04>>
10470  
10471 =over 4
10472  
10473 =item render example 1
10474  
10475 package main;
10476  
10477 use Venus 'render';
10478  
10479 my $render = render 'hello {{name}}', {
10480 name => 'user',
10481 };
10482  
10483 # "hello user"
10484  
10485 =back
10486  
10487 =cut
10488  
10489 =head2 replace
10490  
10491 replace(arrayref $value, string | coderef $code, any @args) (any)
10492  
10493 The replace function builds and returns a L<Venus::Replace> object, or
10494 dispatches to the coderef or method provided.
10495  
10496 I<Since C<2.55>>
10497  
10498 =over 4
10499  
10500 =item replace example 1
10501  
10502 package main;
10503  
10504 use Venus 'replace';
10505  
10506 my $replace = replace ['hello world', 'world', 'universe'];
10507  
10508 # bless({...}, 'Venus::Replace')
10509  
10510 =back
10511  
10512 =over 4
10513  
10514 =item replace example 2
10515  
10516 package main;
10517  
10518 use Venus 'replace';
10519  
10520 my $replace = replace ['hello world', 'world', 'universe'], 'get';
10521  
10522 # "hello universe"
10523  
10524 =back
10525  
10526 =cut
10527  
10528 =head2 roll
10529  
10530 roll(string $name, any @args) (any)
10531  
10532 The roll function takes a list of arguments, assuming the first argument is
10533 invokable, and reorders the list such that the routine name provided comes
10534 after the invocant (i.e. the 1st argument), creating a list acceptable to the
10535 L</call> function.
10536  
10537 I<Since C<2.32>>
10538  
10539 =over 4
10540  
10541 =item roll example 1
10542  
10543 package main;
10544  
10545 use Venus 'roll';
10546  
10547 my @list = roll('sha1_hex', 'Digest::SHA');
10548  
10549 # ('Digest::SHA', 'sha1_hex');
10550  
10551 =back
10552  
10553 =over 4
10554  
10555 =item roll example 2
10556  
10557 package main;
10558  
10559 use Venus 'roll';
10560  
10561 my @list = roll('sha1_hex', call(\'Digest::SHA', 'new'));
10562  
10563 # (bless(do{\(my $o = '...')}, 'Digest::SHA'), 'sha1_hex');
10564  
10565 =back
10566  
10567 =cut
10568  
10569 =head2 schema
10570  
10571 schema(string | coderef $code, any @args) (Venus::Schema)
10572  
10573 The schema function builds and returns a L<Venus::Schema> object, or dispatches
10574 to the coderef or method provided.
10575  
10576 I<Since C<4.15>>
10577  
10578 =over 4
10579  
10580 =item schema example 1
10581  
10582 package main;
10583  
10584 use Venus 'schema';
10585  
10586 my $schema = schema;
10587  
10588 # bless({...}, "Venus::Schema")
10589  
10590 =back
10591  
10592 =over 4
10593  
10594 =item schema example 2
10595  
10596 package main;
10597  
10598 use Venus 'schema';
10599  
10600 my $schema = schema 'rule', {
10601 selector => 'handles',
10602 presence => 'required',
10603 executes => [['type', 'arrayref']],
10604 };
10605  
10606 # bless({...}, "Venus::Schema")
10607  
10608 =back
10609  
10610 =over 4
10611  
10612 =item schema example 3
10613  
10614 package main;
10615  
10616 use Venus 'schema';
10617  
10618 my $schema = schema 'rules', {
10619 selector => 'fname',
10620 presence => 'required',
10621 executes => ['string', 'trim', 'strip'],
10622 },{
10623 selector => 'lname',
10624 presence => 'required',
10625 executes => ['string', 'trim', 'strip'],
10626 };
10627  
10628 # bless({...}, "Venus::Schema")
10629  
10630 =back
10631  
10632 =cut
10633  
10634 =head2 search
10635  
10636 search(arrayref $value, string | coderef $code, any @args) (any)
10637  
10638 The search function builds and returns a L<Venus::Search> object, or dispatches
10639 to the coderef or method provided.
10640  
10641 I<Since C<2.55>>
10642  
10643 =over 4
10644  
10645 =item search example 1
10646  
10647 package main;
10648  
10649 use Venus 'search';
10650  
10651 my $search = search ['hello world', 'world'];
10652  
10653 # bless({...}, 'Venus::Search')
10654  
10655 =back
10656  
10657 =over 4
10658  
10659 =item search example 2
10660  
10661 package main;
10662  
10663 use Venus 'search';
10664  
10665 my $search = search ['hello world', 'world'], 'count';
10666  
10667 # 1
10668  
10669 =back
10670  
10671 =cut
10672  
10673 =head2 set
10674  
10675 set(arrayref $value) (Venus::Set)
10676  
10677 The set function returns a L<Venus::Set> object for the arrayref provided.
10678  
10679 I<Since C<4.11>>
10680  
10681 =over 4
10682  
10683 =item set example 1
10684  
10685 package main;
10686  
10687 use Venus;
10688  
10689 my $set = Venus::set [1..9];
10690  
10691 # bless(..., 'Venus::Set')
10692  
10693 =back
10694  
10695 =over 4
10696  
10697 =item set example 2
10698  
10699 package main;
10700  
10701 use Venus;
10702  
10703 my $set = Venus::set [1..9], 'count';
10704  
10705 # 9
10706  
10707 =back
10708  
10709 =cut
10710  
10711 =head2 sets
10712  
10713 sets(string @args) (arrayref)
10714  
10715 The sets function find values from within the underlying data structure using
10716 L<Venus::Array/path> or L<Venus::Hash/path>, where each argument pair is a
10717 selector and value, and returns all the values provided. Returns a list in list
10718 context. Note, nested data structures can be updated but not created.
10719  
10720 I<Since C<4.15>>
10721  
10722 =over 4
10723  
10724 =item sets example 1
10725  
10726 package main;
10727  
10728 use Venus 'sets';
10729  
10730 my $data = ['foo', {'bar' => 'baz'}, 'bar', ['baz']];
10731  
10732 my $sets = sets $data, '3' => 'bar', '1.bar' => 'bar';
10733  
10734 # ['bar', 'bar']
10735  
10736 =back
10737  
10738 =over 4
10739  
10740 =item sets example 2
10741  
10742 package main;
10743  
10744 use Venus 'sets';
10745  
10746 my $data = ['foo', {'bar' => 'baz'}, 'bar', ['baz']];
10747  
10748 my ($baz, $one_bar) = sets $data, '3' => 'bar', '1.bar' => 'bar';
10749  
10750 # ('bar', 'bar')
10751  
10752 =back
10753  
10754 =over 4
10755  
10756 =item sets example 3
10757  
10758 package main;
10759  
10760 use Venus 'sets';
10761  
10762 my $data = {'foo' => {'bar' => 'baz'}, 'bar' => ['baz']};
10763  
10764 my $sets = sets $data, 'bar' => 'bar', 'foo.bar' => 'bar';
10765  
10766 # ['bar', 'bar']
10767  
10768 =back
10769  
10770 =over 4
10771  
10772 =item sets example 4
10773  
10774 package main;
10775  
10776 use Venus 'sets';
10777  
10778 my $data = {'foo' => {'bar' => 'baz'}, 'bar' => ['baz']};
10779  
10780 my ($bar, $foo_bar) = sets $data, 'bar' => 'bar', 'foo.bar' => 'bar';
10781  
10782 # ('bar', 'bar')
10783  
10784 =back
10785  
10786 =cut
10787  
10788 =head2 sorts
10789  
10790 sorts(any @args) (any)
10791  
10792 The sorts function accepts a list of values, flattens any arrayrefs, and sorts
10793 it using the default C<sort(LIST)> call style exclusively.
10794  
10795 I<Since C<4.15>>
10796  
10797 =over 4
10798  
10799 =item sorts example 1
10800  
10801 package main;
10802  
10803 use Venus 'sorts';
10804  
10805 my @sorts = sorts 1..4;
10806  
10807 # (1..4)
10808  
10809 =back
10810  
10811 =over 4
10812  
10813 =item sorts example 2
10814  
10815 package main;
10816  
10817 use Venus 'sorts';
10818  
10819 my @sorts = sorts 4,3,2,1;
10820  
10821 # (1..4)
10822  
10823 =back
10824  
10825 =over 4
10826  
10827 =item sorts example 3
10828  
10829 package main;
10830  
10831 use Venus 'sorts';
10832  
10833 my @sorts = sorts [1..4], 5, [6..9];
10834  
10835 # (1..9)
10836  
10837 =back
10838  
10839 =cut
10840  
10841 =head2 space
10842  
10843 space(any $name) (Venus::Space)
10844  
10845 The space function returns a L<Venus::Space> object for the package provided.
10846  
10847 I<Since C<2.32>>
10848  
10849 =over 4
10850  
10851 =item space example 1
10852  
10853 package main;
10854  
10855 use Venus 'space';
10856  
10857 my $space = space 'Venus::Scalar';
10858  
10859 # bless({value => 'Venus::Scalar'}, 'Venus::Space')
10860  
10861 =back
10862  
10863 =cut
10864  
10865 =head2 string
10866  
10867 string(string $value, string | coderef $code, any @args) (any)
10868  
10869 The string function builds and returns a L<Venus::String> object, or dispatches
10870 to the coderef or method provided.
10871  
10872 I<Since C<2.55>>
10873  
10874 =over 4
10875  
10876 =item string example 1
10877  
10878 package main;
10879  
10880 use Venus 'string';
10881  
10882 my $string = string 'hello world';
10883  
10884 # bless({...}, 'Venus::String')
10885  
10886 =back
10887  
10888 =over 4
10889  
10890 =item string example 2
10891  
10892 package main;
10893  
10894 use Venus 'string';
10895  
10896 my $string = string 'hello world', 'camelcase';
10897  
10898 # "helloWorld"
10899  
10900 =back
10901  
10902 =cut
10903  
10904 =head2 syscall
10905  
10906 syscall(number | string @args) (any)
10907  
10908 The syscall function perlforms system call, i.e. a L<perlfunc/qx> operation,
10909 and returns C<true> if the command succeeds, otherwise returns C<false>. In
10910 list context, returns the output of the operation and the exit code.
10911  
10912 I<Since C<3.04>>
10913  
10914 =over 4
10915  
10916 =item syscall example 1
10917  
10918 package main;
10919  
10920 use Venus 'syscall';
10921  
10922 my $syscall = syscall 'perl', '-v';
10923  
10924 # true
10925  
10926 =back
10927  
10928 =over 4
10929  
10930 =item syscall example 2
10931  
10932 package main;
10933  
10934 use Venus 'syscall';
10935  
10936 my $syscall = syscall 'perl', '-z';
10937  
10938 # false
10939  
10940 =back
10941  
10942 =over 4
10943  
10944 =item syscall example 3
10945  
10946 package main;
10947  
10948 use Venus 'syscall';
10949  
10950 my ($data, $code) = syscall 'sun', '--heat-death';
10951  
10952 # ('done', 0)
10953  
10954 =back
10955  
10956 =over 4
10957  
10958 =item syscall example 4
10959  
10960 package main;
10961  
10962 use Venus 'syscall';
10963  
10964 my ($data, $code) = syscall 'earth', '--melt-icecaps';
10965  
10966 # ('', 127)
10967  
10968 =back
10969  
10970 =cut
10971  
10972 =head2 template
10973  
10974 template(string $value, string | coderef $code, any @args) (any)
10975  
10976 The template function builds and returns a L<Venus::Template> object, or
10977 dispatches to the coderef or method provided.
10978  
10979 I<Since C<2.55>>
10980  
10981 =over 4
10982  
10983 =item template example 1
10984  
10985 package main;
10986  
10987 use Venus 'template';
10988  
10989 my $template = template 'Hi {{name}}';
10990  
10991 # bless({...}, 'Venus::Template')
10992  
10993 =back
10994  
10995 =over 4
10996  
10997 =item template example 2
10998  
10999 package main;
11000  
11001 use Venus 'template';
11002  
11003 my $template = template 'Hi {{name}}', 'render', undef, {
11004 name => 'stranger',
11005 };
11006  
11007 # "Hi stranger"
11008  
11009 =back
11010  
11011 =cut
11012  
11013 =head2 test
11014  
11015 test(string $value, string | coderef $code, any @args) (any)
11016  
11017 The test function builds and returns a L<Venus::Test> object, or dispatches to
11018 the coderef or method provided.
11019  
11020 I<Since C<2.55>>
11021  
11022 =over 4
11023  
11024 =item test example 1
11025  
11026 package main;
11027  
11028 use Venus 'test';
11029  
11030 my $test = test 't/Venus.t';
11031  
11032 # bless({...}, 'Venus::Test')
11033  
11034 =back
11035  
11036 =over 4
11037  
11038 =item test example 2
11039  
11040 package main;
11041  
11042 use Venus 'test';
11043  
11044 my $test = test 't/Venus.t', 'for', 'synopsis';
11045  
11046 # bless({...}, 'Venus::Test')
11047  
11048 =back
11049  
11050 =cut
11051  
11052 =head2 text_pod
11053  
11054 text_pod(string $value, string | coderef $code, any @args) (any)
11055  
11056 The text_pod function builds and returns a L<Venus::Text::Pod> object, or
11057 dispatches to the coderef or method provided.
11058  
11059 I<Since C<4.15>>
11060  
11061 =over 4
11062  
11063 =item text_pod example 1
11064  
11065 package main;
11066  
11067 use Venus 'text_pod';
11068  
11069 my $text_pod = text_pod 't/data/sections';
11070  
11071 # bless({...}, 'Venus::Text::Pod')
11072  
11073 =back
11074  
11075 =over 4
11076  
11077 =item text_pod example 2
11078  
11079 package main;
11080  
11081 use Venus 'text_pod';
11082  
11083 my $text_pod = text_pod 't/data/sections', 'string', undef, 'name';
11084  
11085 # "Example #1\nExample #2"
11086  
11087 =back
11088  
11089 =cut
11090  
11091 =head2 text_pod_string
11092  
11093 text_pod_string(any @args) (any)
11094  
11095 The text_pod_string function builds a L<Venus::Text::Pod> object for the
11096 current file, i.e. L<perlfunc/__FILE__> or script, i.e. C<$0>, and returns the
11097 result of a L<Venus::Text::Pod/string> operation using the arguments provided.
11098  
11099 I<Since C<4.15>>
11100  
11101 =over 4
11102  
11103 =item text_pod_string example 1
11104  
11105 package main;
11106  
11107 use Venus 'text_pod_string';
11108  
11109 # =name
11110 #
11111 # Example #1
11112 #
11113 # =cut
11114 #
11115 # =name
11116 #
11117 # Example #2
11118 #
11119 # =cut
11120 #
11121 # =head1 NAME
11122 #
11123 # Example #1
11124 #
11125 # =cut
11126 #
11127 # =head1 NAME
11128 #
11129 # Example #2
11130 #
11131 # =cut
11132 #
11133 # =head1 ABSTRACT
11134 #
11135 # Example Abstract
11136 #
11137 # =cut
11138  
11139 my $text_pod_string = text_pod_string 'name';
11140  
11141 # "Example #1\nExample #2"
11142  
11143 =back
11144  
11145 =over 4
11146  
11147 =item text_pod_string example 2
11148  
11149 package main;
11150  
11151 use Venus 'text_pod_string';
11152  
11153 # =name
11154 #
11155 # Example #1
11156 #
11157 # =cut
11158 #
11159 # =name
11160 #
11161 # Example #2
11162 #
11163 # =cut
11164 #
11165 # =head1 NAME
11166 #
11167 # Example #1
11168 #
11169 # =cut
11170 #
11171 # =head1 NAME
11172 #
11173 # Example #2
11174 #
11175 # =cut
11176 #
11177 # =head1 ABSTRACT
11178 #
11179 # Example Abstract
11180 #
11181 # =cut
11182  
11183 my $text_pod_string = text_pod_string 'head1', 'ABSTRACT';
11184  
11185 # "Example Abstract"
11186  
11187 =back
11188  
11189 =cut
11190  
11191 =head2 text_tag
11192  
11193 text_tag(string $value, string | coderef $code, any @args) (any)
11194  
11195 The text_tag function builds and returns a L<Venus::Text::Tag> object, or
11196 dispatches to the coderef or method provided.
11197  
11198 I<Since C<4.15>>
11199  
11200 =over 4
11201  
11202 =item text_tag example 1
11203  
11204 package main;
11205  
11206 use Venus 'text_tag';
11207  
11208 my $text_tag = text_tag 't/data/sections';
11209  
11210 # bless({...}, 'Venus::Text::Tag')
11211  
11212 =back
11213  
11214 =over 4
11215  
11216 =item text_tag example 2
11217  
11218 package main;
11219  
11220 use Venus 'text_tag';
11221  
11222 my $text_tag = text_tag 't/data/sections', 'string', undef, 'name';
11223  
11224 # "Example Name"
11225  
11226 =back
11227  
11228 =cut
11229  
11230 =head2 text_tag_string
11231  
11232 text_tag_string(any @args) (any)
11233  
11234 The text_tag_string function builds a L<Venus::Text::Tag> object for the
11235 current file, i.e. L<perlfunc/__FILE__> or script, i.e. C<$0>, and returns the
11236 result of a L<Venus::Text::Tag/string> operation using the arguments provided.
11237  
11238 I<Since C<4.15>>
11239  
11240 =over 4
11241  
11242 =item text_tag_string example 1
11243  
11244 package main;
11245  
11246 use Venus 'text_tag_string';
11247  
11248 # @@ name
11249 #
11250 # Example Name
11251 #
11252 # @@ end
11253 #
11254 # @@ titles #1
11255 #
11256 # Example Title #1
11257 #
11258 # @@ end
11259 #
11260 # @@ titles #2
11261 #
11262 # Example Title #2
11263 #
11264 # @@ end
11265  
11266 my $text_tag_string = text_tag_string 'name';
11267  
11268 # "Example Name"
11269  
11270 =back
11271  
11272 =over 4
11273  
11274 =item text_tag_string example 2
11275  
11276 package main;
11277  
11278 use Venus 'text_tag_string';
11279  
11280 # @@ name
11281 #
11282 # Example Name
11283 #
11284 # @@ end
11285 #
11286 # @@ titles #1
11287 #
11288 # Example Title #1
11289 #
11290 # @@ end
11291 #
11292 # @@ titles #2
11293 #
11294 # Example Title #2
11295 #
11296 # @@ end
11297  
11298 my $text_tag_string = text_tag_string 'titles', '#1';
11299  
11300 # "Example Title #1"
11301  
11302 =back
11303  
11304 =over 4
11305  
11306 =item text_tag_string example 3
11307  
11308 package main;
11309  
11310 use Venus 'text_tag_string';
11311  
11312 # @@ name
11313 #
11314 # Example Name
11315 #
11316 # @@ end
11317 #
11318 # @@ titles #1
11319 #
11320 # Example Title #1
11321 #
11322 # @@ end
11323 #
11324 # @@ titles #2
11325 #
11326 # Example Title #2
11327 #
11328 # @@ end
11329  
11330 my $text_tag_string = text_tag_string undef, 'name';
11331  
11332 # "Example Name"
11333  
11334 =back
11335  
11336 =cut
11337  
11338 =head2 then
11339  
11340 then(string | object | coderef $self, any @args) (any)
11341  
11342 The then function proxies the call request to the L</call> function and returns
11343 the result as a list, prepended with the invocant.
11344  
11345 I<Since C<2.32>>
11346  
11347 =over 4
11348  
11349 =item then example 1
11350  
11351 package main;
11352  
11353 use Venus 'then';
11354  
11355 my @list = then('Digest::SHA', 'sha1_hex');
11356  
11357 # ("Digest::SHA", "da39a3ee5e6b4b0d3255bfef95601890afd80709")
11358  
11359 =back
11360  
11361 =cut
11362  
11363 =head2 throw
11364  
11365 throw(string | hashref $value, string | coderef $code, any @args) (any)
11366  
11367 The throw function builds and returns a L<Venus::Throw> object, or dispatches
11368 to the coderef or method provided.
11369  
11370 I<Since C<2.55>>
11371  
11372 =over 4
11373  
11374 =item throw example 1
11375  
11376 package main;
11377  
11378 use Venus 'throw';
11379  
11380 my $throw = throw 'Example::Error';
11381  
11382 # bless({...}, 'Venus::Throw')
11383  
11384 =back
11385  
11386 =over 4
11387  
11388 =item throw example 2
11389  
11390 package main;
11391  
11392 use Venus 'throw';
11393  
11394 my $throw = throw 'Example::Error', 'error';
11395  
11396 # bless({...}, 'Example::Error')
11397  
11398 =back
11399  
11400 =over 4
11401  
11402 =item throw example 3
11403  
11404 package main;
11405  
11406 use Venus 'throw';
11407  
11408 my $throw = throw {
11409 name => 'on.execute',
11410 package => 'Example::Error',
11411 capture => ['...'],
11412 stash => {
11413 time => time,
11414 },
11415 };
11416  
11417 # bless({...}, 'Venus::Throw')
11418  
11419 =back
11420  
11421 =cut
11422  
11423 =head2 true
11424  
11425 true() (boolean)
11426  
11427 The true function returns a truthy boolean value which is designed to be
11428 practically indistinguishable from the conventional numerical C<1> value.
11429  
11430 I<Since C<0.01>>
11431  
11432 =over 4
11433  
11434 =item true example 1
11435  
11436 package main;
11437  
11438 use Venus;
11439  
11440 my $true = true;
11441  
11442 # 1
11443  
11444 =back
11445  
11446 =over 4
11447  
11448 =item true example 2
11449  
11450 package main;
11451  
11452 use Venus;
11453  
11454 my $false = !true;
11455  
11456 # 0
11457  
11458 =back
11459  
11460 =cut
11461  
11462 =head2 try
11463  
11464 try(any $data, string | coderef $code, any @args) (any)
11465  
11466 The try function builds and returns a L<Venus::Try> object, or dispatches to
11467 the coderef or method provided.
11468  
11469 I<Since C<2.55>>
11470  
11471 =over 4
11472  
11473 =item try example 1
11474  
11475 package main;
11476  
11477 use Venus 'try';
11478  
11479 my $try = try sub {};
11480  
11481 # bless({...}, 'Venus::Try')
11482  
11483 # my $result = $try->result;
11484  
11485 # ()
11486  
11487 =back
11488  
11489 =over 4
11490  
11491 =item try example 2
11492  
11493 package main;
11494  
11495 use Venus 'try';
11496  
11497 my $try = try sub { die };
11498  
11499 # bless({...}, 'Venus::Try')
11500  
11501 # my $result = $try->result;
11502  
11503 # Exception! (isa Venus::Error)
11504  
11505 =back
11506  
11507 =over 4
11508  
11509 =item try example 3
11510  
11511 package main;
11512  
11513 use Venus 'try';
11514  
11515 my $try = try sub { die }, 'maybe';
11516  
11517 # bless({...}, 'Venus::Try')
11518  
11519 # my $result = $try->result;
11520  
11521 # undef
11522  
11523 =back
11524  
11525 =cut
11526  
11527 =head2 tv
11528  
11529 tv(any $lvalue, any $rvalue) (boolean)
11530  
11531 The tv function compares the lvalue and rvalue and returns true if they have
11532 the same type and value, otherwise returns false. b<Note:> Comparison of
11533 coderefs, filehandles, and blessed objects with private state are impossible.
11534 This function will only return true if these data types are L<"identical"|/is>.
11535 It's also impossible to know which blessed objects have private state and
11536 therefore could produce false-positives when comparing object in those cases.
11537  
11538 I<Since C<4.15>>
11539  
11540 =over 4
11541  
11542 =item tv example 1
11543  
11544 # given: synopsis
11545  
11546 package main;
11547  
11548 use Venus 'tv';
11549  
11550 my $tv = tv 1, 1;
11551  
11552 # true
11553  
11554 =back
11555  
11556 =over 4
11557  
11558 =item tv example 2
11559  
11560 # given: synopsis
11561  
11562 package main;
11563  
11564 use Venus 'tv';
11565  
11566 my $tv = tv '1', 1;
11567  
11568 # false
11569  
11570 =back
11571  
11572 =over 4
11573  
11574 =item tv example 3
11575  
11576 # given: synopsis
11577  
11578 package main;
11579  
11580 use Venus 'tv';
11581  
11582 my $tv = tv ['0', 1..4], ['0', 1..4];
11583  
11584 # true
11585  
11586 =back
11587  
11588 =over 4
11589  
11590 =item tv example 4
11591  
11592 # given: synopsis
11593  
11594 package main;
11595  
11596 use Venus 'tv';
11597  
11598 my $tv = tv ['0', 1..4], [0, 1..4];
11599  
11600 # false
11601  
11602 =back
11603  
11604 =over 4
11605  
11606 =item tv example 5
11607  
11608 # given: synopsis
11609  
11610 package main;
11611  
11612 use Venus 'tv';
11613  
11614 my $tv = tv undef, undef;
11615  
11616 # true
11617  
11618 =back
11619  
11620 =over 4
11621  
11622 =item tv example 6
11623  
11624 # given: synopsis
11625  
11626 package main;
11627  
11628 use Venus 'number', 'tv';
11629  
11630 my $a = number 1;
11631  
11632 my $tv = tv $a, undef;
11633  
11634 # false
11635  
11636 =back
11637  
11638 =over 4
11639  
11640 =item tv example 7
11641  
11642 # given: synopsis
11643  
11644 package main;
11645  
11646 use Venus 'number', 'tv';
11647  
11648 my $a = number 1;
11649  
11650 my $tv = tv $a, $a;
11651  
11652 # true
11653  
11654 =back
11655  
11656 =over 4
11657  
11658 =item tv example 8
11659  
11660 # given: synopsis
11661  
11662 package main;
11663  
11664 use Venus 'number', 'tv';
11665  
11666 my $a = number 1;
11667 my $b = number 1;
11668  
11669 my $tv = tv $a, $b;
11670  
11671 # true
11672  
11673 =back
11674  
11675 =over 4
11676  
11677 =item tv example 9
11678  
11679 # given: synopsis
11680  
11681 package main;
11682  
11683 use Venus 'number', 'tv';
11684  
11685 my $a = number 0;
11686 my $b = number 1;
11687  
11688 my $tv = tv $a, $b;
11689  
11690 # false
11691  
11692 =back
11693  
11694 =cut
11695  
11696 =head2 type
11697  
11698 type(string | coderef $code, any @args) (any)
11699  
11700 The type function builds and returns a L<Venus::Type> object, or dispatches to
11701 the coderef or method provided.
11702  
11703 I<Since C<4.15>>
11704  
11705 =over 4
11706  
11707 =item type example 1
11708  
11709 package main;
11710  
11711 use Venus 'type';
11712  
11713 my $type = type;
11714  
11715 # bless({...}, 'Venus::Type')
11716  
11717 =back
11718  
11719 =over 4
11720  
11721 =item type example 2
11722  
11723 package main;
11724  
11725 use Venus 'type';
11726  
11727 my $expression = type 'expression', 'string | number';
11728  
11729 # ["either", "string", "number"]
11730  
11731 =back
11732  
11733 =over 4
11734  
11735 =item type example 3
11736  
11737 package main;
11738  
11739 use Venus 'type';
11740  
11741 my $expression = type 'expression', ["either", "string", "number"];
11742  
11743 # "string | number"
11744  
11745 =back
11746  
11747 =cut
11748  
11749 =head2 unpack
11750  
11751 unpack(any @args) (Venus::Unpack)
11752  
11753 The unpack function builds and returns a L<Venus::Unpack> object.
11754  
11755 I<Since C<2.40>>
11756  
11757 =over 4
11758  
11759 =item unpack example 1
11760  
11761 package main;
11762  
11763 use Venus 'unpack';
11764  
11765 my $unpack = unpack;
11766  
11767 # bless({...}, 'Venus::Unpack')
11768  
11769 # $unpack->checks('string');
11770  
11771 # false
11772  
11773 # $unpack->checks('undef');
11774  
11775 # false
11776  
11777 =back
11778  
11779 =over 4
11780  
11781 =item unpack example 2
11782  
11783 package main;
11784  
11785 use Venus 'unpack';
11786  
11787 my $unpack = unpack rand;
11788  
11789 # bless({...}, 'Venus::Unpack')
11790  
11791 # $unpack->check('number');
11792  
11793 # false
11794  
11795 # $unpack->check('float');
11796  
11797 # true
11798  
11799 =back
11800  
11801 =cut
11802  
11803 =head2 vars
11804  
11805 vars(hashref $value, string | coderef $code, any @args) (any)
11806  
11807 The vars function builds and returns a L<Venus::Vars> object, or dispatches to
11808 the coderef or method provided.
11809  
11810 I<Since C<2.55>>
11811  
11812 =over 4
11813  
11814 =item vars example 1
11815  
11816 package main;
11817  
11818 use Venus 'vars';
11819  
11820 my $vars = vars {};
11821  
11822 # bless({...}, 'Venus::Vars')
11823  
11824 =back
11825  
11826 =over 4
11827  
11828 =item vars example 2
11829  
11830 package main;
11831  
11832 use Venus 'vars';
11833  
11834 my $path = vars {}, 'exists', 'path';
11835  
11836 # "..."
11837  
11838 =back
11839  
11840 =cut
11841  
11842 =head2 vns
11843  
11844 vns(string $name, args $args, string | coderef $callback, any @args) (any)
11845  
11846 The vns function build a L<Venus> package based on the name provided, loads and
11847 instantiates the package, and returns an instance of that package or dispatches
11848 to the method provided and returns the result.
11849  
11850 I<Since C<4.15>>
11851  
11852 =over 4
11853  
11854 =item vns example 1
11855  
11856 package main;
11857  
11858 use Venus 'vns';
11859  
11860 my $space = vns 'space';
11861  
11862 # bless({value => 'Venus'}, 'Venus::Space')
11863  
11864 =back
11865  
11866 =over 4
11867  
11868 =item vns example 2
11869  
11870 package main;
11871  
11872 use Venus 'vns';
11873  
11874 my $space = vns 'space', 'Venus::String';
11875  
11876 # bless({value => 'Venus::String'}, 'Venus::Space')
11877  
11878 =back
11879  
11880 =over 4
11881  
11882 =item vns example 3
11883  
11884 package main;
11885  
11886 use Venus 'vns';
11887  
11888 my $code = vns 'code', sub{};
11889  
11890 # bless({value => sub{...}}, 'Venus::Code')
11891  
11892 =back
11893  
11894 =cut
11895  
11896 =head2 what
11897  
11898 what(any $data, string | coderef $code, any @args) (any)
11899  
11900 The what function builds and returns a L<Venus::What> object, or dispatches to
11901 the coderef or method provided.
11902  
11903 I<Since C<4.11>>
11904  
11905 =over 4
11906  
11907 =item what example 1
11908  
11909 package main;
11910  
11911 use Venus 'what';
11912  
11913 my $what = what [1..4];
11914  
11915 # bless({...}, 'Venus::What')
11916  
11917 # $what->deduce;
11918  
11919 # bless({...}, 'Venus::Array')
11920  
11921 =back
11922  
11923 =over 4
11924  
11925 =item what example 2
11926  
11927 package main;
11928  
11929 use Venus 'what';
11930  
11931 my $what = what [1..4], 'deduce';
11932  
11933 # bless({...}, 'Venus::Array')
11934  
11935 =back
11936  
11937 =cut
11938  
11939 =head2 work
11940  
11941 work(coderef $callback) (Venus::Process)
11942  
11943 The work function builds a L<Venus::Process> object, forks the current process
11944 using the callback provided via the L<Venus::Process/work> operation, and
11945 returns an instance of L<Venus::Process> representing the current process.
11946  
11947 I<Since C<2.40>>
11948  
11949 =over 4
11950  
11951 =item work example 1
11952  
11953 package main;
11954  
11955 use Venus 'work';
11956  
11957 my $parent = work sub {
11958 my ($process) = @_;
11959 # in forked process ...
11960 $process->exit;
11961 };
11962  
11963 # bless({...}, 'Venus::Process')
11964  
11965 =back
11966  
11967 =cut
11968  
11969 =head2 wrap
11970  
11971 wrap(string $data, string $name) (coderef)
11972  
11973 The wrap function installs a wrapper function in the calling package which when
11974 called either returns the package string if no arguments are provided, or calls
11975 L</make> on the package with whatever arguments are provided and returns the
11976 result. Unless an alias is provided as a second argument, special characters
11977 are stripped from the package to create the function name.
11978  
11979 I<Since C<2.32>>
11980  
11981 =over 4
11982  
11983 =item wrap example 1
11984  
11985 package main;
11986  
11987 use Venus 'wrap';
11988  
11989 my $coderef = wrap('Digest::SHA');
11990  
11991 # sub { ... }
11992  
11993 # my $digest = DigestSHA();
11994  
11995 # "Digest::SHA"
11996  
11997 # my $digest = DigestSHA(1);
11998  
11999 # bless(do{\(my $o = '...')}, 'Digest::SHA')
12000  
12001 =back
12002  
12003 =over 4
12004  
12005 =item wrap example 2
12006  
12007 package main;
12008  
12009 use Venus 'wrap';
12010  
12011 my $coderef = wrap('Digest::SHA', 'SHA');
12012  
12013 # sub { ... }
12014  
12015 # my $digest = SHA();
12016  
12017 # "Digest::SHA"
12018  
12019 # my $digest = SHA(1);
12020  
12021 # bless(do{\(my $o = '...')}, 'Digest::SHA')
12022  
12023 =back
12024  
12025 =cut
12026  
12027 =head2 write_env
12028  
12029 write_env(hashref $data) (string)
12030  
12031 The write_env function returns a string representing environment variable
12032 key/value pairs based on the L</value> held by the underlying L<Venus::Config>
12033 object.
12034  
12035 I<Since C<4.15>>
12036  
12037 =over 4
12038  
12039 =item write_env example 1
12040  
12041 package main;
12042  
12043 use Venus 'write_env';
12044  
12045 my $write_env = write_env {
12046 APPNAME => "Example",
12047 APPTAG => "Godzilla",
12048 APPVER => 0.01,
12049 };
12050  
12051 # "APPNAME=Example\nAPPTAG=Godzilla\nAPPVER=0.01"
12052  
12053 =back
12054  
12055 =cut
12056  
12057 =head2 write_env_file
12058  
12059 write_env_file(string $path, hashref $data) (Venus::Config)
12060  
12061 The write_env_file function saves a environment configuration file and returns
12062 a new L<Venus::Config> object.
12063  
12064 I<Since C<4.15>>
12065  
12066 =over 4
12067  
12068 =item write_env_file example 1
12069  
12070 package main;
12071  
12072 use Venus 'write_env_file';
12073  
12074 my $write_env_file = write_env_file 't/conf/write.env', {
12075 APPNAME => "Example",
12076 APPTAG => "Godzilla",
12077 APPVER => 0.01,
12078 };
12079  
12080 # bless(..., 'Venus::Config')
12081  
12082 =back
12083  
12084 =cut
12085  
12086 =head2 write_json
12087  
12088 write_json(hashref $data) (string)
12089  
12090 The write_json function returns a JSON encoded string based on the L</value>
12091 held by the underlying L<Venus::Config> object.
12092  
12093 I<Since C<4.15>>
12094  
12095 =over 4
12096  
12097 =item write_json example 1
12098  
12099 package main;
12100  
12101 use Venus 'write_json';
12102  
12103 my $write_json = write_json {
12104 '$services' => {
12105 log => { package => "Venus::Path" },
12106 },
12107 };
12108  
12109 # '{ "$services":{ "log":{ "package":"Venus::Path" } } }'
12110  
12111 =back
12112  
12113 =cut
12114  
12115 =head2 write_json_file
12116  
12117 write_json_file(string $path, hashref $data) (Venus::Config)
12118  
12119 The write_json_file function saves a JSON configuration file and returns a new
12120 L<Venus::Config> object.
12121  
12122 I<Since C<4.15>>
12123  
12124 =over 4
12125  
12126 =item write_json_file example 1
12127  
12128 package main;
12129  
12130 use Venus 'write_json_file';
12131  
12132 my $write_json_file = write_json_file 't/conf/write.json', {
12133 '$services' => {
12134 log => { package => "Venus/Path", argument => { value => "." } }
12135 }
12136 };
12137  
12138 # bless(..., 'Venus::Config')
12139  
12140 =back
12141  
12142 =cut
12143  
12144 =head2 write_perl
12145  
12146 write_perl(hashref $data) (string)
12147  
12148 The write_perl function returns a FILE encoded string based on the L</value>
12149 held by the underlying L<Venus::Config> object.
12150  
12151 I<Since C<4.15>>
12152  
12153 =over 4
12154  
12155 =item write_perl example 1
12156  
12157 package main;
12158  
12159 use Venus 'write_perl';
12160  
12161 my $write_perl = write_perl {
12162 '$services' => {
12163 log => { package => "Venus::Path" },
12164 },
12165 };
12166  
12167 # '{ "\$services" => { log => { package => "Venus::Path" } } }'
12168  
12169 =back
12170  
12171 =cut
12172  
12173 =head2 write_perl_file
12174  
12175 write_perl_file(string $path, hashref $data) (Venus::Config)
12176  
12177 The write_perl_file function saves a Perl configuration file and returns a new
12178 L<Venus::Config> object.
12179  
12180 I<Since C<4.15>>
12181  
12182 =over 4
12183  
12184 =item write_perl_file example 1
12185  
12186 package main;
12187  
12188 use Venus 'write_perl_file';
12189  
12190 my $write_perl_file = write_perl_file 't/conf/write.perl', {
12191 '$services' => {
12192 log => { package => "Venus/Path", argument => { value => "." } }
12193 }
12194 };
12195  
12196 # bless(..., 'Venus::Config')
12197  
12198 =back
12199  
12200 =cut
12201  
12202 =head2 write_yaml
12203  
12204 write_yaml(hashref $data) (string)
12205  
12206 The write_yaml function returns a FILE encoded string based on the L</value>
12207 held by the underlying L<Venus::Config> object.
12208  
12209 I<Since C<4.15>>
12210  
12211 =over 4
12212  
12213 =item write_yaml example 1
12214  
12215 package main;
12216  
12217 use Venus 'write_yaml';
12218  
12219 my $write_yaml = write_yaml {
12220 '$services' => {
12221 log => { package => "Venus::Path" },
12222 },
12223 };
12224  
12225 # '---\n$services:\n\s\slog:\n\s\s\s\spackage:\sVenus::Path'
12226  
12227 =back
12228  
12229 =cut
12230  
12231 =head2 write_yaml_file
12232  
12233 write_yaml_file(string $path, hashref $data) (Venus::Config)
12234  
12235 The write_yaml_file function saves a YAML configuration file and returns a new
12236 L<Venus::Config> object.
12237  
12238 I<Since C<4.15>>
12239  
12240 =over 4
12241  
12242 =item write_yaml_file example 1
12243  
12244 package main;
12245  
12246 use Venus 'write_yaml_file';
12247  
12248 my $write_yaml_file = write_yaml_file 't/conf/write.yaml', {
12249 '$services' => {
12250 log => { package => "Venus/Path", argument => { value => "." } }
12251 }
12252 };
12253  
12254 # bless(..., 'Venus::Config')
12255  
12256 =back
12257  
12258 =cut
12259  
12260 =head2 yaml
12261  
12262 yaml(string $call, any $data) (any)
12263  
12264 The yaml function builds a L<Venus::Yaml> object and will either
12265 L<Venus::Yaml/decode> or L<Venus::Yaml/encode> based on the argument provided
12266 and returns the result.
12267  
12268 I<Since C<2.40>>
12269  
12270 =over 4
12271  
12272 =item yaml example 1
12273  
12274 package main;
12275  
12276 use Venus 'yaml';
12277  
12278 my $decode = yaml 'decode', "---\nname:\n- Ready\n- Robot\nstable: true\n";
12279  
12280 # { name => ["Ready", "Robot"], stable => 1 }
12281  
12282 =back
12283  
12284 =over 4
12285  
12286 =item yaml example 2
12287  
12288 package main;
12289  
12290 use Venus 'yaml';
12291  
12292 my $encode = yaml 'encode', { name => ["Ready", "Robot"], stable => true };
12293  
12294 # '---\nname:\n- Ready\n- Robot\nstable: true\n'
12295  
12296 =back
12297  
12298 =over 4
12299  
12300 =item yaml example 3
12301  
12302 package main;
12303  
12304 use Venus 'yaml';
12305  
12306 my $yaml = yaml;
12307  
12308 # bless({...}, 'Venus::Yaml')
12309  
12310 =back
12311  
12312 =over 4
12313  
12314 =item yaml example 4
12315  
12316 package main;
12317  
12318 use Venus 'yaml';
12319  
12320 my $yaml = yaml 'class', {data => "..."};
12321  
12322 # Exception! (isa Venus::Fault)
12323  
12324 =back
12325  
12326 =cut
12327  
12328 =head1 FEATURES
12329  
12330 This package provides the following features:
12331  
12332 =cut
12333  
12334 =over 4
12335  
12336 =item venus-args
12337  
12338 This library contains a L<Venus::Args> class which provides methods for
12339 accessing C<@ARGS> items.
12340  
12341 =back
12342  
12343 =over 4
12344  
12345 =item venus-array
12346  
12347 This library contains a L<Venus::Array> class which provides methods for
12348 manipulating array data.
12349  
12350 =back
12351  
12352 =over 4
12353  
12354 =item venus-assert
12355  
12356 This library contains a L<Venus::Assert> class which provides a mechanism for
12357 asserting type constraints and coercion.
12358  
12359 =back
12360  
12361 =over 4
12362  
12363 =item venus-atom
12364  
12365 This library contains a L<Venus::Atom> class which provides a write-once object
12366 representing a constant value.
12367  
12368 =back
12369  
12370 =over 4
12371  
12372 =item venus-boolean
12373  
12374 This library contains a L<Venus::Boolean> class which provides a representation
12375 for boolean values.
12376  
12377 =back
12378  
12379 =over 4
12380  
12381 =item venus-box
12382  
12383 This library contains a L<Venus::Box> class which provides a pure Perl boxing
12384 mechanism.
12385  
12386 =back
12387  
12388 =over 4
12389  
12390 =item venus-call
12391  
12392 This library contains a L<Venus::Call> class which provides a protocol for
12393 dynamically invoking methods with optional opt-in type safety.
12394  
12395 =back
12396  
12397 =over 4
12398  
12399 =item venus-check
12400  
12401 This library contains a L<Venus::Check> class which provides runtime dynamic type checking.
12402  
12403 =back
12404  
12405 =over 4
12406  
12407 =item venus-class
12408  
12409 This library contains a L<Venus::Class> class which provides a class builder.
12410  
12411 =back
12412  
12413 =over 4
12414  
12415 =item venus-cli
12416  
12417 This library contains a L<Venus::Cli> class which provides a superclass for
12418 creating CLIs.
12419  
12420 =back
12421  
12422 =over 4
12423  
12424 =item venus-code
12425  
12426 This library contains a L<Venus::Code> class which provides methods for
12427 manipulating subroutines.
12428  
12429 =back
12430  
12431 =over 4
12432  
12433 =item venus-coercion
12434  
12435 This library contains a L<Venus::Coercion> class which provides data type coercions via L<Venus::Check>.
12436  
12437 =back
12438  
12439 =over 4
12440  
12441 =item venus-collect
12442  
12443 This library contains a L<Venus::Collect> class which provides a mechanism for
12444 iterating over mappable values.
12445  
12446 =back
12447  
12448 =over 4
12449  
12450 =item venus-config
12451  
12452 This library contains a L<Venus::Config> class which provides methods for
12453 loading Perl, YAML, and JSON configuration data.
12454  
12455 =back
12456  
12457 =over 4
12458  
12459 =item venus-constraint
12460  
12461 This library contains a L<Venus::Constraint> class which provides data type
12462 constraints via L<Venus::Check>.
12463  
12464 =back
12465  
12466 =over 4
12467  
12468 =item venus-data
12469  
12470 This library contains a L<Venus::Data> class which provides value object for
12471 encapsulating data validation.
12472  
12473 =back
12474  
12475 =over 4
12476  
12477 =item venus-date
12478  
12479 This library contains a L<Venus::Date> class which provides methods for
12480 formatting, parsing, and manipulating dates.
12481  
12482 =back
12483  
12484 =over 4
12485  
12486 =item venus-dump
12487  
12488 This library contains a L<Venus::Dump> class which provides methods for reading
12489 and writing dumped Perl data.
12490  
12491 =back
12492  
12493 =over 4
12494  
12495 =item venus-enum
12496  
12497 This library contains a L<Venus::Enum> class which provides an interface for working with enumerations.
12498  
12499 =back
12500  
12501 =over 4
12502  
12503 =item venus-error
12504  
12505 This library contains a L<Venus::Error> class which represents a context-aware
12506 error (exception object).
12507  
12508 =back
12509  
12510 =over 4
12511  
12512 =item venus-factory
12513  
12514 This library contains a L<Venus::Factory> class which provides an object-oriented factory pattern for building objects.
12515  
12516 =back
12517  
12518 =over 4
12519  
12520 =item venus-false
12521  
12522 This library contains a L<Venus::False> class which provides the global
12523 C<false> value.
12524  
12525 =back
12526  
12527 =over 4
12528  
12529 =item venus-fault
12530  
12531 This library contains a L<Venus::Fault> class which represents a generic system
12532 error (exception object).
12533  
12534 =back
12535  
12536 =over 4
12537  
12538 =item venus-float
12539  
12540 This library contains a L<Venus::Float> class which provides methods for
12541 manipulating float data.
12542  
12543 =back
12544  
12545 =over 4
12546  
12547 =item venus-future
12548  
12549 This library contains a L<Venus::Future> class which provides a
12550 framework-agnostic implementation of the Future pattern.
12551  
12552 =back
12553  
12554 =over 4
12555  
12556 =item venus-gather
12557  
12558 This library contains a L<Venus::Gather> class which provides an
12559 object-oriented interface for complex pattern matching operations on
12560 collections of data, e.g. array references.
12561  
12562 =back
12563  
12564 =over 4
12565  
12566 =item venus-hash
12567  
12568 This library contains a L<Venus::Hash> class which provides methods for
12569 manipulating hash data.
12570  
12571 =back
12572  
12573 =over 4
12574  
12575 =item venus-json
12576  
12577 This library contains a L<Venus::Json> class which provides methods for reading
12578 and writing JSON data.
12579  
12580 =back
12581  
12582 =over 4
12583  
12584 =item venus-log
12585  
12586 This library contains a L<Venus::Log> class which provides methods for logging
12587 information using various log levels.
12588  
12589 =back
12590  
12591 =over 4
12592  
12593 =item venus-map
12594  
12595 This library contains a L<Venus::Map> class which provides a representation of
12596 a collection of ordered key/value pairs.
12597  
12598 =back
12599  
12600 =over 4
12601  
12602 =item venus-match
12603  
12604 This library contains a L<Venus::Match> class which provides an object-oriented
12605 interface for complex pattern matching operations on scalar values.
12606  
12607 =back
12608  
12609 =over 4
12610  
12611 =item venus-meta
12612  
12613 This library contains a L<Venus::Meta> class which provides configuration
12614 information for L<Venus> derived classes.
12615  
12616 =back
12617  
12618 =over 4
12619  
12620 =item venus-mixin
12621  
12622 This library contains a L<Venus::Mixin> class which provides a mixin builder.
12623  
12624 =back
12625  
12626 =over 4
12627  
12628 =item venus-name
12629  
12630 This library contains a L<Venus::Name> class which provides methods for parsing
12631 and formatting package namespaces.
12632  
12633 =back
12634  
12635 =over 4
12636  
12637 =item venus-number
12638  
12639 This library contains a L<Venus::Number> class which provides methods for
12640 manipulating number data.
12641  
12642 =back
12643  
12644 =over 4
12645  
12646 =item venus-opts
12647  
12648 This library contains a L<Venus::Opts> class which provides methods for
12649 handling command-line arguments.
12650  
12651 =back
12652  
12653 =over 4
12654  
12655 =item venus-os
12656  
12657 This library contains a L<Venus::Os> class which provides methods for
12658 determining the current operating system, as well as finding and executing
12659 files.
12660  
12661 =back
12662  
12663 =over 4
12664  
12665 =item venus-path
12666  
12667 This library contains a L<Venus::Path> class which provides methods for working
12668 with file system paths.
12669  
12670 =back
12671  
12672 =over 4
12673  
12674 =item venus-process
12675  
12676 This library contains a L<Venus::Process> class which provides methods for
12677 handling and forking processes.
12678  
12679 =back
12680  
12681 =over 4
12682  
12683 =item venus-prototype
12684  
12685 This library contains a L<Venus::Prototype> class which provides a simple
12686 construct for enabling prototype-base programming.
12687  
12688 =back
12689  
12690 =over 4
12691  
12692 =item venus-random
12693  
12694 This library contains a L<Venus::Random> class which provides an
12695 object-oriented interface for Perl's pseudo-random number generator.
12696  
12697 =back
12698  
12699 =over 4
12700  
12701 =item venus-range
12702  
12703 This library contains a L<Venus::Range> class which provides an object-oriented
12704 interface for selecting elements from an arrayref using range expressions.
12705  
12706 =back
12707  
12708 =over 4
12709  
12710 =item venus-regexp
12711  
12712 This library contains a L<Venus::Regexp> class which provides methods for
12713 manipulating regexp data.
12714  
12715 =back
12716  
12717 =over 4
12718  
12719 =item venus-replace
12720  
12721 This library contains a L<Venus::Replace> class which provides methods for
12722 manipulating regexp replacement data.
12723  
12724 =back
12725  
12726 =over 4
12727  
12728 =item venus-result
12729  
12730 This library contains a L<Venus::Result> class which provides a container for
12731 representing success and error states.
12732  
12733 =back
12734  
12735 =over 4
12736  
12737 =item venus-run
12738  
12739 This library contains a L<Venus::Run> class which provides a base class for
12740 providing a command execution system for creating CLIs (command-line
12741 interfaces).
12742  
12743 =back
12744  
12745 =over 4
12746  
12747 =item venus-scalar
12748  
12749 This library contains a L<Venus::Scalar> class which provides methods for
12750 manipulating scalar data.
12751  
12752 =back
12753  
12754 =over 4
12755  
12756 =item venus-schema
12757  
12758 This library contains a L<Venus::Schema> class which provides a mechanism for
12759 validating complex data structures.
12760  
12761 =back
12762  
12763 =over 4
12764  
12765 =item venus-sealed
12766  
12767 This library contains a L<Venus::Sealed> class which provides a mechanism for
12768 restricting access to the underlying data structure.
12769  
12770 =back
12771  
12772 =over 4
12773  
12774 =item venus-search
12775  
12776 This library contains a L<Venus::Search> class which provides methods for
12777 manipulating regexp search data.
12778  
12779 =back
12780  
12781 =over 4
12782  
12783 =item venus-set
12784  
12785 This library contains a L<Venus::Set> class which provides a representation of
12786 a collection of ordered key/value pairs.
12787  
12788 =back
12789  
12790 =over 4
12791  
12792 =item venus-space
12793  
12794 This library contains a L<Venus::Space> class which provides methods for
12795 parsing and manipulating package namespaces.
12796  
12797 =back
12798  
12799 =over 4
12800  
12801 =item venus-string
12802  
12803 This library contains a L<Venus::String> class which provides methods for
12804 manipulating string data.
12805  
12806 =back
12807  
12808 =over 4
12809  
12810 =item venus-task
12811  
12812 This library contains a L<Venus::Task> class which provides a base class for
12813 creating CLIs (command-line interfaces).
12814  
12815 =back
12816  
12817 =over 4
12818  
12819 =item venus-template
12820  
12821 This library contains a L<Venus::Template> class which provides a templating
12822 system, and methods for rendering template.
12823  
12824 =back
12825  
12826 =over 4
12827  
12828 =item venus-test
12829  
12830 This library contains a L<Venus::Test> class which aims to provide a standard
12831 for documenting L<Venus> derived software projects.
12832  
12833 =back
12834  
12835 =over 4
12836  
12837 =item venus-text
12838  
12839 This library contains a L<Venus::Text> class which provides methods for
12840 extracting C<DATA> sections and POD block.
12841  
12842 =back
12843  
12844 =over 4
12845  
12846 =item venus-text-pod
12847  
12848 This library contains a L<Venus::Text::Pod> class which provides methods for
12849 extracting POD blocks.
12850  
12851 =back
12852  
12853 =over 4
12854  
12855 =item venus-text-tag
12856  
12857 This library contains a L<Venus::Text::Tag> class which provides methods for
12858 extracting C<DATA> sections.
12859  
12860 =back
12861  
12862 =over 4
12863  
12864 =item venus-throw
12865  
12866 This library contains a L<Venus::Throw> class which provides a mechanism for
12867 generating and raising error objects.
12868  
12869 =back
12870  
12871 =over 4
12872  
12873 =item venus-true
12874  
12875 This library contains a L<Venus::True> class which provides the global C<true>
12876 value.
12877  
12878 =back
12879  
12880 =over 4
12881  
12882 =item venus-try
12883  
12884 This library contains a L<Venus::Try> class which provides an object-oriented
12885 interface for performing complex try/catch operations.
12886  
12887 =back
12888  
12889 =over 4
12890  
12891 =item venus-type
12892  
12893 This library contains a L<Venus::Type> class which provides a mechanism for
12894 parsing, generating, and validating data type expressions.
12895  
12896 =back
12897  
12898 =over 4
12899  
12900 =item venus-undef
12901  
12902 This library contains a L<Venus::Undef> class which provides methods for
12903 manipulating undef data.
12904  
12905 =back
12906  
12907 =over 4
12908  
12909 =item venus-unpack
12910  
12911 This library contains a L<Venus::Unpack> class which provides methods for
12912 validating, coercing, and otherwise operating on lists of arguments.
12913  
12914 =back
12915  
12916 =over 4
12917  
12918 =item venus-validate
12919  
12920 This library contains a L<Venus::Validate> class which provides a mechanism for
12921 performing data validation of simple and hierarchal data.
12922  
12923 =back
12924  
12925 =over 4
12926  
12927 =item venus-vars
12928  
12929 This library contains a L<Venus::Vars> class which provides methods for
12930 accessing C<%ENV> items.
12931  
12932 =back
12933  
12934 =over 4
12935  
12936 =item venus-what
12937  
12938 This library contains a L<Venus::What> class which provides methods for casting
12939 native data types to objects.
12940  
12941 =back
12942  
12943 =over 4
12944  
12945 =item venus-yaml
12946  
12947 This library contains a L<Venus::Yaml> class which provides methods for reading
12948 and writing YAML data.
12949  
12950 =back
12951  
12952 =head1 AUTHORS
12953  
12954 Awncorp, C<awncorp@cpan.org>
12955  
12956 =cut
12957  
12958 =head1 LICENSE
12959  
12960 Copyright (C) 2022, Awncorp, C<awncorp@cpan.org>.
12961  
12962 This program is free software, you can redistribute it and/or modify it under
12963 the terms of the Apache license version 2.0.
12964  
12965 =cut
« blib/lib/Venus/Text.pm ↑ Summary blib/lib/Venus/Boolean.pm »