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   183333 use 5.006; use strict; use warnings; our $VERSION = '1.02';
  2     2   6  
  2     2   7  
  2         7  
  2         35  
  2         5  
  2         9  
  2         125  
3 2     2   9 use base 'Import::Export';
  2         10  
  2         842  
4 2     2   31375 use Clone qw(clone);
  2         802  
  2         161  
5              
6             our %EX = (
7             n => [qw/all/],
8             x => [qw/all/]
9             );
10              
11             use overload
12 2     2   979 'x' => \&x;
  2         2715  
  2         12  
13              
14             sub n {
15 2     2 1 143848 my $n = shift;
16 2         51 bless \$n, __PACKAGE__;
17             }
18              
19             sub x {
20 5     5 1 4312 my ($times, $obj) = @_;
21             my @times = map {
22 5 100       16 ref $obj ? clone($obj) : $obj
  21 100       52  
23             } 1 .. (ref $times ? $$times : $times);
24 5 100       17 wantarray ? @times : \@times;
25             }
26              
27             1;
28              
29             __END__