File Coverage

blib/lib/overload/x.pm
Criterion Covered Total %
statement 23 23 100.0
branch 6 6 100.0
condition n/a
subroutine 8 8 100.0
pod 2 2 100.0
total 39 39 100.0


line stmt bran cond sub pod time code
1             package overload::x;
2 2     2   97672 use 5.006; use strict; use warnings; our $VERSION = '0.102';
  2     2   16  
  2     2   8  
  2         2  
  2         36  
  2         8  
  2         2  
  2         75  
3 2     2   10 use base 'Import::Export';
  2         9  
  2         779  
4 2     2   25585 use Clone qw(clone);
  2         3709  
  2         114  
5              
6             our %EX = (
7             n => [qw/all/],
8             x => [qw/all/]
9             );
10              
11             use overload
12 2     2   1739 'x' => \&x;
  2         1397  
  2         11  
13              
14             sub n {
15 2     2 1 2176 my $n = shift; # \shift is really broken AND has varying behaviour depending on which OS you're using apparently
16 2         32 return bless \$n, __PACKAGE__;
17             }
18              
19             sub x {
20 5     5 1 3253 my ($times, $obj) = @_;
21             my @times = map {
22 5 100       17 ref $obj ? clone($obj) : $obj
  21 100       50  
23             } 1 .. (ref $times ? $$times : $times); # IN list context this counts which suckkks...
24 5 100       16 wantarray ? @times : \@times;
25             }
26              
27             1;
28              
29             __END__