| 1 | package Test::Lib; | ||||||||||
| 2 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 7 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 7 | our $VERSION = '0.003'; | |||||||||
| 6 | 7 | $VERSION =~ tr/_/d/; | |||||||||
| 7 | |||||||||||
| 8 | 7 | ▶ | use File::Spec; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 7 | ▶ | use Cwd (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 7 | ▶ | use lib (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 7 | ▶ | sub import { | ||||||||
|
Subroutine
import: called CC=5 SCAR=16.1
| |||||||||||
| 13 | 7 | my $class = shift; | |||||||||
| 14 | 7 | my $dir = shift; | |||||||||
| 15 | 7 | ▶ | if (! defined $dir) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 7 | my $file = File::Spec->rel2abs((caller)[1]); | |||||||||
| 17 | 7 | $dir = File::Spec->catpath((File::Spec->splitpath($file))[0,1], ''); | |||||||||
| 18 | } | ||||||||||
| 19 | 7 | for my $i (0..5) { | |||||||||
| 20 | 27 | my $tdir = File::Spec->catdir($dir, (File::Spec->updir) x $i); | |||||||||
| 21 | 27 | my $abs_path = Cwd::abs_path($tdir); | |||||||||
| 22 | 27 | my $dirname = (File::Spec->splitdir($abs_path))[-1]; | |||||||||
| 23 | |||||||||||
| 24 | 27 | ▶ | if ($dirname eq 't') { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 6 | my $tlib = File::Spec->catdir($tdir, 'lib'); | |||||||||
| 26 | 6 | ▶ | if (-d $tlib) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 6 | lib->import($tlib); | |||||||||
| 28 | 6 | return; | |||||||||
| 29 | } | ||||||||||
| 30 | } | ||||||||||
| 31 | } | ||||||||||
| 32 | 1 | require Carp; | |||||||||
| 33 | 1 | Carp::croak("unable to find t/lib directory in $dir"); | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 7 | 1; | |||||||||
| 37 | |||||||||||
| 38 | __END__ | ||||||||||