blib/lib/UNIVERSAL/which.pm

filter: Statementstmt 100% 28 / 28 Branchbran 100% 10 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 97.6% 42 / 43 CC 6 SCAR 14.7
CC
6
Cov
100%
which
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.3
↑ Summary
1 package UNIVERSAL::which;
2 6 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 our $VERSION = sprintf "%d.%02d", q$Revision: 0.6 $ =~ /(\d+)/g;
6  
7 15 ▶sub UNIVERSAL::which {
Subroutine which: called CC=6 SCAR=17.9
Pod undocumented
8 15 my ( $self, $method ) = @_;
9 15 my $coderef = $self->can($method);
10 15 ▶ unless ($coderef) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($coderef) 3 12 15
11 3 $method = 'AUTOLOAD';
12 3 $coderef = $self->can($method);
13 }
14 15 ▶ return unless UNIVERSAL::isa($coderef, 'CODE');
Branch: 1 branch
BranchTrueFalseTotal
unless UNIVERSAL::isa($coderef, "CODE") 1 14 15
15 14 require B;
16 14 my $b = B::svref_2object($coderef);
17 14 my $cvflags = $b->CvFLAGS;
18 14 my $pkg = $b->GV->STASH->NAME;
19 14 my $fq = $pkg . '::' . $method;
20 14 ▶ if (! defined(&{$fq}) ){
Branch: 1 branch
BranchTrueFalseTotal
unless (defined &{$fq;}) 6 8 14
21 6 $method = $b->GV->NAME;
22 6 $fq = $pkg . '::' . $method;
23 6 ▶ $fq = undef unless defined(&{$fq}); # double-check
Branch: 1 branch
BranchTrueFalseTotal
unless defined &{$fq;} 4 2 6
24 }
25 14 ▶ return wantarray ? ( $pkg, $method, $cvflags ) : $fq;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 12 14
26 }
27  
28 6 1;
29 __END__
↑ Summary