| 1 | package Dir::Self; | ||||||||||||||
| 2 | |||||||||||||||
| 3 | 1 | $VERSION = '0.11'; | |||||||||||||
| 4 | |||||||||||||||
| 5 | 1 | ▶ | use 5.005; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 7 | |||||||||||||||
| 8 | 1 | ▶ | use File::Spec (); | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 9 | |||||||||||||||
| 10 | |||||||||||||||
| 11 | 3 | ▶ | sub __DIR__ () { | ||||||||||||
|
Subroutine
__DIR__: called CC=2 SCAR=7.1
| |||||||||||||||
| 12 | 3 | ▶ | my $level = shift || 0; | ||||||||||||
|
Condition50%1/2
shift() || 0
MC/DC0%0/1
shift() || 0
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||
| 13 | 3 | my $file = (caller $level)[1]; | |||||||||||||
| 14 | 3 | File::Spec->rel2abs(join '', (File::Spec->splitpath($file))[0, 1]) | |||||||||||||
| 15 | } | ||||||||||||||
| 16 | |||||||||||||||
| 17 | 0 | ▶ | sub _const { | ||||||||||||
|
Subroutine
_const: not called CC=1 SCAR=6.9
| |||||||||||||||
| 18 | 0 | my $value = shift; | |||||||||||||
| 19 | 0 | ▶ | sub () { $value } | ||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||
| 20 | 0 | } | |||||||||||||
| 21 | |||||||||||||||
| 22 | 1 | ▶ | sub import { | ||||||||||||
|
Subroutine
import: called CC=5 SCAR=18.0
| |||||||||||||||
| 23 | 1 | my $class = shift; | |||||||||||||
| 24 | 1 | my $caller = caller; | |||||||||||||
| 25 | |||||||||||||||
| 26 | 1 | ▶ | @_ or @_ = '__DIR__'; | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 27 | |||||||||||||||
| 28 | 1 | for my $item (@_) { | |||||||||||||
| 29 | 1 | ▶ | if ($item eq '__DIR__') { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 30 | 1 | ▶ | no strict 'refs'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 31 | 1 | *{$caller . '::__DIR__'} = \&__DIR__; | |||||||||||||
| 32 | } elsif ($item eq ':static') { | ||||||||||||||
| 33 | 1 | ▶ | no strict 'refs'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 34 | 0 | *{$caller . '::__DIR__'} = _const &__DIR__(1); | |||||||||||||
| 35 | } else { | ||||||||||||||
| 36 | 0 | require Carp; | |||||||||||||
| 37 | 0 | Carp::croak(qq{"$item" is not exported by the $class module}); | |||||||||||||
| 38 | } | ||||||||||||||
| 39 | } | ||||||||||||||
| 40 | } | ||||||||||||||
| 41 | |||||||||||||||
| 42 | 1 | 1 | |||||||||||||
| 43 | __END__ | ||||||||||||||