File Coverage

blib/lib/Array/Splice.pm
Criterion Covered Total %
statement 20 24 83.3
branch 4 6 66.6
condition n/a
subroutine 6 6 100.0
pod 3 3 100.0
total 33 39 84.6


line stmt bran cond sub pod time code
1             package Array::Splice;
2            
3 6     6   114899 use 5.006;
  6         17  
  6         241  
4 6     6   30 use strict;
  6         10  
  6         183  
5 6     6   26 use warnings;
  6         15  
  6         1642  
6            
7             require Exporter;
8             require DynaLoader;
9            
10             our @ISA = qw(Exporter DynaLoader);
11            
12             our @EXPORT_OK = qw(
13             splice_aliases push_aliases unshift_aliases
14             );
15            
16             our $VERSION = '0.04';
17            
18             bootstrap Array::Splice $VERSION;
19            
20             sub splice_aliases (\@$$@) {
21 30     30 1 29549 my $array = shift;
22 30 100       82 if ( my $tied = tied @$array ) {
23 1         6 return $tied->SPLICE_ALIASES(@_);
24             }
25 29         140 _splice($array,@_);
26             }
27            
28             sub push_aliases (\@@) {
29 1     1 1 851 splice @_, 1, 0, scalar @{$_[0]}, 0;
  1         4  
30 1         4 &splice_aliases(@_);
31 1 50       8 return unless defined wantarray;
32 0         0 scalar @{$_[0]};
  0         0  
33             }
34            
35             sub unshift_aliases (\@@) {
36 1     1 1 14 splice @_, 1, 0, 0, 0;
37 1         5 &splice_aliases(@_);
38 1 50       5 return unless defined wantarray;
39 0           scalar @{$_[0]};
  0            
40             }
41            
42             1;
43             __END__