File Coverage

blib/lib/parent/versioned.pm
Criterion Covered Total %
statement 20 20 100.0
branch 6 6 100.0
condition 3 3 100.0
subroutine 3 3 100.0
pod n/a
total 32 32 100.0


line stmt bran cond sub pod time code
1             package parent::versioned;
2              
3 8     8   207723 use strict;
  8         37  
  8         1491  
4              
5             our $VERSION = '0.001_02';
6             $VERSION = eval "$VERSION";
7              
8             # Based on parent.pm, version 0.237;
9             # parent was included in the Perl core beginning with Perl 5.10.1,
10             # and is dual-lived on CPAN.
11              
12             sub import {
13 27     27   13271 my $class = shift;
14              
15 27         62 my $inheritor = caller(0);
16              
17 27 100 100     164 if ( @_ and $_[0] eq '-norequire' ) {
18 15         29 shift @_;
19             } else {
20 12         44 for ( my @filename = @_ ) {
21              
22 8 100       28 $_ = $_->[0] if ref $_ eq 'ARRAY';
23              
24 8         36 s{::|'}{/}g;
25 8         2121 require "$_.pm"; # dies if the file is not found
26             }
27             }
28              
29             {
30 8     8   60 no strict 'refs';
  8         23  
  8         1063  
  24         83  
31 24         182 push @{"$inheritor\::ISA"},
32 24 100       37 map {ref($_) eq 'ARRAY' ? do {$_->[0]->VERSION($_->[1]); $_->[0]} : $_ }
  24         4614  
  11         218  
  6         93  
33             @_; # dies if a loop is detected or if a requisite version is not met.
34             };
35             };
36              
37             1;
38              
39             __END__