blib/lib/overload/x.pm

filter: Statementstmt 100% 11 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 15 / 15 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary
1 package overload::x;
2 1 ▶use 5.006; use strict; use warnings; our $VERSION = '0.02';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use base 'Import::Export';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 use Function::Fallback::CoreOrPP qw(clone);
5  
6 our %EX = (
7 n => [qw/all/],
8 x => [qw/all/]
9 );
10  
11 use overload
12 'x' => \&x;
13  
14 sub n {
15 return bless \shift, __PACKAGE__;
16 }
17  
18 sub x {
19 my ($times, $obj) = @_;
20 my $o = ref $times;
21 my @times = map {
22 ref $obj ? clone($obj) : $obj
23 } 1 .. ($o ? $$times : $times); # IN list context this counts which suckkks...
24 wantarray && !$o ? @times : \@times;
25 }
26  
27 1;
28  
29 __END__
↑ Summary