| 1 | package Plack::I18N::Util; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use parent 'Exporter'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 4 | our @EXPORT_OK = qw(try_load_class); | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use Plack::Util (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 48 | ▶ | sub try_load_class { | ||||||||||||||||||||||||||
|
Subroutine
try_load_class: called CC=7 SCAR=19.7
Pod
documented
| |||||||||||||||||||||||||||||
| 13 | 48 | my ($class) = @_; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 48 | my $path = (join '/', split /::/, $class) . '.pm'; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 48 | ▶ | return $class if exists $INC{$path} && defined $INC{$path}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $INC{$path} and defined $INC{$path}
MC/DC0%0/2
exists $INC{$path} and defined $INC{$path}
exists $INC{$path}
defined $INC{$path}
Truth table33%1/3
A and B
A= exists $INC{$path}B= defined $INC{$path}
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | { | ||||||||||||||||||||||||||||
| 20 | 4 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 21 | 48 | for (keys %{"$class\::"}) { | |||||||||||||||||||||||||||
| 22 | 207 | ▶ | return $class if defined &{"$class\::$_"}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | eval { | ||||||||||||||||||||||||||||
| 27 | 9 | Plack::Util::load_class($class); | |||||||||||||||||||||||||||
| 28 | 9 | ▶ | } || do { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 8 | my $e = $@; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 8 | ▶ | die $e unless $@ =~ m/Can't locate $path in \@INC/; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 8 | return; | |||||||||||||||||||||||||||
| 34 | }; | ||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 4 | 1; | |||||||||||||||||||||||||||
| 38 | __END__ | ||||||||||||||||||||||||||||