blib/lib/Venus/Range.pm

filter: Statementstmt 97.9% 96 / 98 Branchbran 88.6% 39 / 44 Conditioncond 82.1% 23 / 28 MC/DCmcdc 68.7% 11 / 16 Subroutinesub 100% 15 / 15 Podpod 70.0% 7 / 10 totaltotal 90.5% 191 / 211 CC 34 SCAR 17.9
CC
34
Cov
93%
compute
11.3
parse
8.0
build_data
7.0
CRAP 6.0
« blib/lib/Venus/Role/Catchable.pm ↑ Summary blib/lib/Venus/Gather.pm »
1 package Venus::Range;
2  
3 12 ▶use 5.018;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 # IMPORTS
9  
10 12 ▶use Venus::Class 'attr', 'base', 'with';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 # INHERITS
13  
14 12 base 'Venus::Kind::Utility';
15  
16 # INTEGRATES
17  
18 12 with 'Venus::Role::Valuable';
19  
20 # ATTRIBUTES
21  
22 12 attr 'start';
23 12 attr 'stop';
24 12 attr 'step';
25  
26 # BUILDERS
27  
28 191 ▶sub build_data {
Subroutine build_data: called CC=7 SCAR=19.5
Pod undocumented
29 191 my ($self, $data) = @_;
30  
31 191 ▶ $data->{value} = [] if !$data->{value} || !ref $data->{value} || ref $data->{value} ne 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if not $data->{"value"} && ref $data->{"value"} or ref $data->{"value"} ne "ARRAY" 1 190 191
Condition66%4/6
not $data->{"value"} && ref $data->{"value"} or ref $data->{"value"} ne "ARRAY"
l!l&&r!l&&!r
10190
$data->{'value'} && ref $data->{'value'}
!ll&&!rl&&r
10190
MC/DC33%1/3
not $data->{"value"} && ref $data->{"value"} or ref $data->{"value"} ne "ARRAY"
$data->{'value'} ref $data->{'value'} ref $data->{"value"} ne "ARRAY"
Truth table50%2/4
not(A && B) or C
A= $data->{'value'}B= ref $data->{'value'}C= ref $data->{"value"} ne "ARRAY"
ABCresult
0XX1
10X1
1111
1100
32 191 ▶ $data->{start} //= 0;
Condition100%2/2
$data->{"start"} //= 0
l!l
16328
MC/DC100%1/1
$data->{"start"} //= 0
$data->{"start"}
Truth table100%2/2
A
A= $data->{"start"}
Aresult
11
00
33 191 ▶ $data->{stop} //= $#{$data->{value}};
Condition100%2/2
$data->{"stop"} //= $#{$$data{"value"};}
l!l
10784
MC/DC100%1/1
$data->{"stop"} //= $#{$$data{"value"};}
$data->{"stop"}
Truth table100%2/2
A
A= $data->{"stop"}
Aresult
11
00
34 191 ▶ $data->{step} //= 1;
Condition100%2/2
$data->{"step"} //= 1
l!l
16328
MC/DC100%1/1
$data->{"step"} //= 1
$data->{"step"}
Truth table100%2/2
A
A= $data->{"step"}
Aresult
11
00
35  
36 191 return $data;
37 }
38  
39 # METHODS
40  
41 8 ▶sub after {
Subroutine after: called CC=3 SCAR=11.0
Pod documented
42 8 my ($self, $pos) = @_;
43  
44 8 my $tail = $#{$self->value};
45  
46 8 ▶ my ($start, $stop) = defined $pos && $pos < $tail ? (($pos + 1), $tail) : (-1, 0);
Branch: 1 branch
BranchTrueFalseTotal
defined $pos && $pos < $tail ? : 7 1 8
Condition66%2/3
defined $pos and $pos < $tail
!ll&&!rl&&r
107
MC/DC50%1/2
defined $pos and $pos < $tail
defined $pos $pos < $tail
Truth table66%2/3
A and B
A= defined $posB= $pos < $tail
ABresult
0X0
100
111
47  
48 8 return $self->parse("${start}:${stop}", $self->value)->select;
49 }
50  
51 8 ▶sub before {
Subroutine before: called CC=3 SCAR=11.0
Pod documented
52 8 my ($self, $pos) = @_;
53  
54 8 my $head = 0;
55  
56 8 ▶ my ($start, $stop) = defined $pos && $pos > $head ? ($head, ($pos - 1)) : (-1, 0);
Branch: 1 branch
BranchTrueFalseTotal
defined $pos && $pos > $head ? : 3 5 8
Condition100%3/3
defined $pos and $pos > $head
!ll&&!rl&&r
143
MC/DC100%2/2
defined $pos and $pos > $head
defined $pos $pos > $head
Truth table100%3/3
A and B
A= defined $posB= $pos > $head
ABresult
0X0
100
111
57  
58 8 return $self->parse("${start}:${stop}", $self->value)->select;
59 }
60  
61 157 ▶sub compute {
Subroutine compute: called CC=11 SCAR=24.2
Pod undocumented
62 157 my ($self) = @_;
63  
64 157 my $start = $self->start;
65 157 my $stop = $self->stop;
66 157 my $step = $self->step;
67 157 my $length = $self->length;
68  
69 157 ▶ $start += $length if $start < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $start < 0 28 129 157
70 157 ▶ $stop += $length if defined $stop && $stop < 0;
Branch: 1 branch
BranchTrueFalseTotal
if defined $stop and $stop < 0 39 118 157
Condition66%2/3
defined $stop and $stop < 0
!ll&&!rl&&r
011839
MC/DC50%1/2
defined $stop and $stop < 0
defined $stop $stop < 0
Truth table66%2/3
A and B
A= defined $stopB= $stop < 0
ABresult
0X0
100
111
71  
72 157 ▶ $stop = $length - 1 unless defined $stop;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $stop 0 157 157
73  
74 157 ▶ return [] if $start > $stop;
Branch: 1 branch
BranchTrueFalseTotal
if $start > $stop 36 121 157
75  
76 121 ▶ $step = 1 unless $step;
Branch: 1 branch
BranchTrueFalseTotal
unless $step 0 121 121
77  
78 121 ▶ $step = $step * -1 if $step < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $step < 0 0 121 121
79  
80 121 my $range = [];
81  
82 121 ▶ for (my $i = $start; $i <= $stop; $i += $step) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $stop) 359 121 480
83 359 ▶ push @{$range}, $i if $i >= 0 && $i < $length;
Branch: 1 branch
BranchTrueFalseTotal
if $i >= 0 and $i < $length 352 7 359
Condition66%2/3
$i >= 0 and $i < $length
!ll&&!rl&&r
07352
MC/DC50%1/2
$i >= 0 and $i < $length
$i >= 0 $i < $length
Truth table66%2/3
A and B
A= $i >= 0B= $i < $length
ABresult
0X0
100
111
84 }
85  
86 121 return $range;
87 }
88  
89 2 ▶sub iterate {
Subroutine iterate: called CC=1 SCAR=0.0
Pod documented
90 2 my ($self) = @_;
91  
92 2 my $range = $self->compute;
93  
94 2 my $result = [@{$self->value}[@{$range}]];
95  
96 2 my $i = 0;
97  
98 16 ▶ return sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
99 16 ▶ return if $i >= @{$result};
Branch: 1 branch
BranchTrueFalseTotal
if $i >= @{$result;} 2 14 16
100 14 return $result->[$i++];
101 2 };
102 }
103  
104 157 ▶sub length {
Subroutine length: called CC=1 SCAR=0.0
Pod undocumented
105 157 my ($self) = @_;
106  
107 157 my $length = scalar @{$self->value};
108  
109 157 return $length;
110 }
111  
112 163 ▶sub parse {
Subroutine parse: called CC=8 SCAR=20.8
Pod documented
113 163 my ($self, $expr, $data) = @_;
114  
115 163 ▶ $expr //= '';
Condition100%2/2
$expr //= ""
l!l
15211
MC/DC100%1/1
$expr //= ""
$expr
Truth table100%2/2
A
A= $expr
Aresult
11
00
116  
117 163 my ($start, $stop, $step) = (0, undef, 1);
118  
119 163 ▶ if ($expr =~ /^(-?\d*):(-?\d*)(?::(-?\d+))?$/) {
Branch: 2 branches
BranchTrueFalseTotal
if ($expr =~ /^(-?\d*):(-?\d*)(?::(-?\d+))?$/u) { } 116 47 163
elsif ($expr =~ /^(-?\d+)$/u) { } 34 13 47
120 116 ▶ $start = $1 if CORE::length($1);
Branch: 1 branch
BranchTrueFalseTotal
if CORE::length $1 102 14 116
121 116 ▶ $stop = CORE::length($2) ? $2 : undef;
Branch: 1 branch
BranchTrueFalseTotal
CORE::length $2 ? : 73 43 116
122 116 ▶ $step = $3 if defined $3;
Branch: 1 branch
BranchTrueFalseTotal
if defined $3 3 113 116
123 }
124 elsif ($expr =~ /^(-?\d+)$/) {
125 34 $start = $1;
126 34 $stop = $start;
127 }
128  
129 163 ▶ return $self->class->new(value => $data || [], start => $start, stop => $stop, step => $step);
Condition100%2/2
$data || []
l!l
1558
MC/DC100%1/1
$data || []
$data
Truth table100%2/2
A
A= $data
Aresult
11
00
130 }
131  
132 3 ▶sub partition {
Subroutine partition: called CC=3 SCAR=11.1
Pod documented
133 3 my ($self, $pos) = @_;
134  
135 3 my $result = [[], []];
136  
137 3 ▶ $pos = 0 if !defined $pos;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $pos 1 2 3
138  
139 3 push @{$result->[0]}, $self->before($pos);
140 3 push @{$result->[1]}, $self->after($pos - 1);
141  
142 0 ▶ return wantarray ? (@{$result}) : $result;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 3 3
143 }
144  
145 155 ▶sub select {
Subroutine select: called CC=2 SCAR=6.9
Pod documented
146 155 my ($self) = @_;
147  
148 155 my $range = $self->compute;
149  
150 155 my $result = [@{$self->value}[@{$range}]];
151  
152 155 ▶ return wantarray ? (@{$result}) : $result;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 12 143 155
153 }
154  
155 3 ▶sub split {
Subroutine split: called CC=3 SCAR=11.1
Pod documented
156 3 my ($self, $pos) = @_;
157  
158 3 my $result = [[], []];
159  
160 3 ▶ $pos = 0 if !defined $pos;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $pos 1 2 3
161  
162 3 push @{$result->[0]}, $self->before($pos);
163 3 push @{$result->[1]}, $self->after($pos);
164  
165 0 ▶ return wantarray ? (@{$result}) : $result;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 3 3
166 }
167  
168 12 1;
169  
170  
171  
172 =head1 NAME
173  
174 Venus::Range - Range Class
175  
176 =cut
177  
178 =head1 ABSTRACT
179  
180 Range Class for Perl 5
181  
182 =cut
183  
184 =head1 SYNOPSIS
185  
186 package main;
187  
188 use Venus::Range;
189  
190 my $range = Venus::Range->new(['a'..'i']);
191  
192 # $array->parse('0:2');
193  
194 # ['a', 'b', 'c']
195  
196 =cut
197  
198 =head1 DESCRIPTION
199  
200 This package provides methods for selecting elements from an arrayref using
201 range expressions. A "range expression" is a string that specifies a subset of
202 elements in an array or arrayref, defined by a start, stop, and an optional
203 step value, separated by colons. For example, the expression '1:4' will select
204 elements starting from index 1 to index 4 (both inclusive). The components of
205 the range expression are:
206  
207 =over 4
208  
209 =item * B<Start>: The beginning index of the selection. If this value is
210 negative, it counts from the end of the array, where -1 is the last element.
211  
212 =item * B<Stop>: The ending index of the selection. This value is also
213 inclusive, meaning the element at this index will be included in the selection.
214 Negative values count from the end of the array.
215  
216 =item * B<Step>: An optional value that specifies the interval between
217 selected elements. For instance, a step of 2 will select every second element.
218 If not provided, the default step is 1.
219  
220 =back
221  
222 This package uses inclusive start and stop indices, meaning both bounds are
223 included in the selection. This differs from some common conventions where the
224 stop value is exclusive. The package also gracefully handles out-of-bound
225 indices. If the start or stop values exceed the length of the array, they are
226 adjusted to fit within the valid range without causing errors. Negative indices
227 are also supported, allowing for easy reverse indexing from the end of the
228 array.
229  
230 =cut
231  
232 =head1 ATTRIBUTES
233  
234 This package has the following attributes:
235  
236 =cut
237  
238 =head2 start
239  
240 start(number $start) (number)
241  
242 The start attribute is read-write, accepts C<(number)> values, and is
243 optional.
244  
245 I<Since C<4.15>>
246  
247 =over 4
248  
249 =item start example 1
250  
251 # given: synopsis
252  
253 package main;
254  
255 my $start = $range->start(0);
256  
257 # 0
258  
259 =back
260  
261 =over 4
262  
263 =item start example 2
264  
265 # given: synopsis
266  
267 # given: example-1 start
268  
269 package main;
270  
271 $start = $range->start;
272  
273 # 0
274  
275 =back
276  
277 =cut
278  
279 =head2 stop
280  
281 stop(number $stop) (number)
282  
283 The stop attribute is read-write, accepts C<(number)> values, and is
284 optional.
285  
286 I<Since C<4.15>>
287  
288 =over 4
289  
290 =item stop example 1
291  
292 # given: synopsis
293  
294 package main;
295  
296 my $stop = $range->stop(9);
297  
298 # 9
299  
300 =back
301  
302 =over 4
303  
304 =item stop example 2
305  
306 # given: synopsis
307  
308 # given: example-1 stop
309  
310 package main;
311  
312 $stop = $range->stop;
313  
314 # 9
315  
316 =back
317  
318 =cut
319  
320 =head2 step
321  
322 step(number $step) (number)
323  
324 The step attribute is read-write, accepts C<(number)> values, and is
325 optional.
326  
327 I<Since C<4.15>>
328  
329 =over 4
330  
331 =item step example 1
332  
333 # given: synopsis
334  
335 package main;
336  
337 my $step = $range->step(1);
338  
339 # 1
340  
341 =back
342  
343 =over 4
344  
345 =item step example 2
346  
347 # given: synopsis
348  
349 # given: example-1 step
350  
351 package main;
352  
353 $step = $range->step;
354  
355 # 1
356  
357 =back
358  
359 =cut
360  
361 =head1 INHERITS
362  
363 This package inherits behaviors from:
364  
365 L<Venus::Kind::Utility>
366  
367 =cut
368  
369 =head1 INTEGRATES
370  
371 This package integrates behaviors from:
372  
373 L<Venus::Role::Valuable>
374  
375 =cut
376  
377 =head1 METHODS
378  
379 This package provides the following methods:
380  
381 =cut
382  
383 =head2 after
384  
385 after(number $index) (arrayref)
386  
387 The after method selects the elements after the index provided and returns the
388 selection using L</select>. The selection is not inclusive.
389  
390 I<Since C<4.15>>
391  
392 =over 4
393  
394 =item after example 1
395  
396 # given: synopsis
397  
398 package main;
399  
400 my $after = $range->after;
401  
402 # []
403  
404 =back
405  
406 =over 4
407  
408 =item after example 2
409  
410 # given: synopsis
411  
412 package main;
413  
414 my $after = $range->after(5);
415  
416 # ['g', 'h', 'i']
417  
418 =back
419  
420 =cut
421  
422 =head2 before
423  
424 before(number $index) (arrayref)
425  
426 The before method selects the elements before the index provided and returns the
427 selection using L</select>. The selection is not inclusive.
428  
429 I<Since C<4.15>>
430  
431 =over 4
432  
433 =item before example 1
434  
435 # given: synopsis
436  
437 package main;
438  
439 my $before = $range->before;
440  
441 # []
442  
443 =back
444  
445 =over 4
446  
447 =item before example 2
448  
449 # given: synopsis
450  
451 package main;
452  
453 my $before = $range->before(5);
454  
455 # ['a'..'e']
456  
457 =back
458  
459 =cut
460  
461 =head2 iterate
462  
463 iterate( ) (coderef)
464  
465 The iterate method returns an iterator which uses L</select> to iteratively
466 return each element of the selection.
467  
468 I<Since C<4.15>>
469  
470 =over 4
471  
472 =item iterate example 1
473  
474 # given: synopsis
475  
476 package main;
477  
478 my $iterate = $range->iterate;
479  
480 # sub{...}
481  
482 =back
483  
484 =over 4
485  
486 =item iterate example 2
487  
488 package main;
489  
490 my $range = Venus::Range->parse('4:', ['a'..'i']);
491  
492 my $iterate = $range->iterate;
493  
494 # sub{...}
495  
496 =back
497  
498 =cut
499  
500 =head2 new
501  
502 new(any @args) (Venus::Range)
503  
504 The new method constructs an instance of the package.
505  
506 I<Since C<4.15>>
507  
508 =over 4
509  
510 =item new example 1
511  
512 package main;
513  
514 use Venus::Range;
515  
516 my $range = Venus::Range->new;
517  
518 # bless(..., 'Venus::Range')
519  
520 =back
521  
522 =over 4
523  
524 =item new example 2
525  
526 package main;
527  
528 use Venus::Range;
529  
530 my $range = Venus::Range->new(['a'..'d']);
531  
532 # bless(..., 'Venus::Range')
533  
534 =back
535  
536 =over 4
537  
538 =item new example 3
539  
540 package main;
541  
542 use Venus::Range;
543  
544 my $range = Venus::Range->new(value => ['a'..'d']);
545  
546 # bless(..., 'Venus::Range')
547  
548 =back
549  
550 =cut
551  
552 =head2 parse
553  
554 parse(string $expr, arrayref $data) (Venus::Range)
555  
556 The parse method parses the "range expression" provided and returns a new
557 instance of L<Venus::Range> representing the range expression, optionally
558 accepting and setting the arrayref to be used as the selection source. This
559 method can also be used as a class method.
560  
561 I<Since C<4.15>>
562  
563 =over 4
564  
565 =item parse example 1
566  
567 # given: synopsis
568  
569 package main;
570  
571 my $parse = $range->parse('4:');
572  
573 # bless(..., "Venus::Range")
574  
575 # $parse->start
576 # 4
577  
578 # $parse->stop
579 # -1
580  
581 # $parse->step
582 # 1
583  
584 =back
585  
586 =over 4
587  
588 =item parse example 2
589  
590 # given: synopsis
591  
592 package main;
593  
594 my $parse = $range->parse('0:1');
595  
596 # bless(..., "Venus::Range")
597  
598 # $parse->start
599 # 0
600  
601 # $parse->stop
602 # 1
603  
604 # $parse->step
605 # 1
606  
607 =back
608  
609 =over 4
610  
611 =item parse example 3
612  
613 # given: synopsis
614  
615 package main;
616  
617 my $parse = $range->parse('1:0');
618  
619 # bless(..., "Venus::Range")
620  
621 # $parse->start
622 # 1
623  
624 # $parse->stop
625 # 0
626  
627 # $parse->step
628 # 1
629  
630 =back
631  
632 =over 4
633  
634 =item parse example 4
635  
636 # given: synopsis
637  
638 package main;
639  
640 my $parse = $range->parse('2::2');
641  
642 # bless(..., "Venus::Range")
643  
644 # $parse->start
645 # 2
646  
647 # $parse->stop
648 # -1
649  
650 # $parse->step
651 # 2
652  
653 =back
654  
655 =over 4
656  
657 =item parse example 5
658  
659 # given: synopsis
660  
661 package main;
662  
663 my $parse = $range->parse(':4');
664  
665 # bless(..., "Venus::Range")
666  
667 # $parse->start
668 # 0
669  
670 # $parse->stop
671 # 4
672  
673 # $parse->step
674 # 1
675  
676 =back
677  
678 =over 4
679  
680 =item parse example 6
681  
682 # given: synopsis
683  
684 package main;
685  
686 my $parse = $range->parse(':4:1');
687  
688 # bless(..., "Venus::Range")
689  
690 # $parse->start
691 # 0
692  
693 # $parse->stop
694 # 4
695  
696 # $parse->step
697 # 1
698  
699 =back
700  
701 =over 4
702  
703 =item parse example 7
704  
705 # given: synopsis
706  
707 package main;
708  
709 my $parse = $range->parse(':-2', ['a'..'i']);
710  
711 # bless(..., "Venus::Range")
712  
713 # $parse->start
714 # 0
715  
716 # $parse->stop
717 # -2
718  
719 # $parse->step
720 # 1
721  
722 =back
723  
724 =cut
725  
726 =head2 partition
727  
728 partition(number $index) (tuple[arrayref, arrayref])
729  
730 The partition method splits the elements into two sets of elements at the index
731 specific and returns a tuple of two arrayrefs. The first arrayref will include
732 everything L<"before"|/before> the index provided, and the second tuple will
733 include everything at and L<"after"|/after> the index provided.
734  
735 I<Since C<4.15>>
736  
737 =over 4
738  
739 =item partition example 1
740  
741 # given: synopsis
742  
743 package main;
744  
745 my $partition = $range->partition;
746  
747 # [[], ['a'..'i']]
748  
749 =back
750  
751 =over 4
752  
753 =item partition example 2
754  
755 # given: synopsis
756  
757 package main;
758  
759 my $partition = $range->partition(0);
760  
761 # [[], ['a'..'i']]
762  
763 =back
764  
765 =over 4
766  
767 =item partition example 3
768  
769 # given: synopsis
770  
771 package main;
772  
773 my $partition = $range->partition(5);
774  
775 # [['a'..'e'], ['f'..'i']]
776  
777 =back
778  
779 =cut
780  
781 =head2 select
782  
783 select() (arrayref)
784  
785 The select method uses the start, stop, and step attributes to select elements
786 from the arrayref and returns the selection. Returns a list in list context.
787  
788 I<Since C<4.15>>
789  
790 =over 4
791  
792 =item select example 1
793  
794 package main;
795  
796 use Venus::Range;
797  
798 my $range = Venus::Range->parse('4:', ['a'..'i']);
799  
800 my $select = $range->select;
801  
802 # ['e'..'i']
803  
804 =back
805  
806 =over 4
807  
808 =item select example 2
809  
810 package main;
811  
812 use Venus::Range;
813  
814 my $range = Venus::Range->parse('0:1', ['a'..'i']);
815  
816 my $select = $range->select;
817  
818 # ['a', 'b']
819  
820 =back
821  
822 =over 4
823  
824 =item select example 3
825  
826 package main;
827  
828 use Venus::Range;
829  
830 my $range = Venus::Range->parse('0:', ['a'..'i']);
831  
832 my $select = $range->select;
833  
834 # ['a'..'i']
835  
836 =back
837  
838 =over 4
839  
840 =item select example 4
841  
842 package main;
843  
844 use Venus::Range;
845  
846 my $range = Venus::Range->parse(':-2', ['a'..'i']);
847  
848 my $select = $range->select;
849  
850 # ['a'..'h']
851  
852 =back
853  
854 =over 4
855  
856 =item select example 5
857  
858 package main;
859  
860 use Venus::Range;
861  
862 my $range = Venus::Range->parse('2:8:2', ['a'..'i']);
863  
864 my $select = $range->select;
865  
866 # ['c', 'e', 'g', 'i']
867  
868 =back
869  
870 =cut
871  
872 =head2 split
873  
874 split(number $index) (tuple[arrayref, arrayref])
875  
876 The split method splits the elements into two sets of elements at the index
877 specific and returns a tuple of two arrayrefs. The first arrayref will include
878 everything L<"before"|/before> the index provided, and the second tuple will
879 include everything L<"after"|/after> the index provided. This operation will
880 always exclude the element at the index the elements are split on. See
881 L</partition> for an inclusive split operation.
882  
883 I<Since C<4.15>>
884  
885 =over 4
886  
887 =item split example 1
888  
889 # given: synopsis
890  
891 package main;
892  
893 my $split = $range->split;
894  
895 # [[], ['b'..'i']]
896  
897 =back
898  
899 =over 4
900  
901 =item split example 2
902  
903 # given: synopsis
904  
905 package main;
906  
907 my $split = $range->split(0);
908  
909 # [[], ['a'..'i']]
910  
911 =back
912  
913 =over 4
914  
915 =item split example 3
916  
917 # given: synopsis
918  
919 package main;
920  
921 my $split = $range->split(5);
922  
923 # [['a'..'e'], ['g'..'i']]
924  
925 =back
926  
927 =cut
928  
929 =head1 AUTHORS
930  
931 Awncorp, C<awncorp@cpan.org>
932  
933 =cut
934  
935 =head1 LICENSE
936  
937 Copyright (C) 2022, Awncorp, C<awncorp@cpan.org>.
938  
939 This program is free software, you can redistribute it and/or modify it under
940 the terms of the Apache license version 2.0.
941  
942 =cut
« blib/lib/Venus/Role/Catchable.pm ↑ Summary blib/lib/Venus/Gather.pm »