Reply/Util.pm

filter: Statementstmt 53.8% 28 / 52 Branchbran 16.6% 1 / 6 Conditioncond 0.0% 0 / 11 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 2 totaltotal 41.1% 35 / 85 CC 10 SCAR 30.0
CC
10
Cov
42%
all_packages
42.0
methods
20.0
BEGIN
2.3
CRAP 20.1
« Reply/Plugin/Autocomplete/Keywords.pm ↑ Summary Reply/Plugin/Autocomplete/Packages.pm »
1 package Reply::Util;
2 20 our $AUTHORITY = 'cpan:DOY';
3 20 $Reply::Util::VERSION = '0.42';
4 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 20 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 20 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=8.1
8 20 ▶ if ($] < 5.010) {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < 5.01) { } 0 20 20
9 0 require MRO::Compat;
10 }
11 else {
12 20 require mro;
13 }
14 }
15  
16 20 ▶use Package::Stash;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 20 ▶use Scalar::Util 'blessed';
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 20 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 20 our @EXPORT_OK = qw(
21 $ident_rx $varname_rx $fq_ident_rx $fq_varname_rx
22 methods all_packages
23 );
24  
25 # XXX this should be updated for unicode
26 20 our $varstart_rx = qr/[A-Z_a-z]/;
27 20 our $varcont_rx = qr/[0-9A-Z_a-z]/;
28 20 our $ident_rx = qr/${varstart_rx}${varcont_rx}*/;
29 20 our $sigil_rx = qr/[\$\@\%\&\*]/;
30 20 our $varname_rx = qr/$sigil_rx\s*$ident_rx/;
31 20 our $fq_ident_rx = qr/$ident_rx(?:::$varcont_rx+)*/;
32 20 our $fq_varname_rx = qr/$varname_rx(?:::$varcont_rx+)*/;
33  
34 0 ▶sub methods {
Subroutine methods: not called CC=4 SCAR=30.0
Pod undocumented
35 0 my ($invocant) = @_;
36  
37 0 ▶ my $class = blessed($invocant) || $invocant;
Condition0%0/3
builtin::blessed($invocant) || $invocant
l!l&&r!l&&!r
000
MC/DC0%0/2
builtin::blessed($invocant) || $invocant
builtin::blessed($invocant) $invocant
Truth table0%0/3
A || B
A= builtin::blessed($invocant)B= $invocant
ABresult
1X1
011
000
38  
39 my @mro = (
40 0 @{ mro::get_linear_isa('UNIVERSAL') },
41 0 @{ mro::get_linear_isa($class) },
42 );
43  
44 0 my @methods;
45 0 for my $package (@mro) {
46 0 my $stash = eval { Package::Stash->new($package) };
47 0 ▶ next unless $stash;
Branch: 1 branch
BranchTrueFalseTotal
unless $stash 0 0 0
48 0 push @methods, $stash->list_all_symbols('CODE');
49 }
50  
51 0 return @methods;
52 }
53  
54 0 ▶sub all_packages {
Subroutine all_packages: not called CC=6 SCAR=37.4
Pod undocumented
55 0 my ($root) = @_;
56 0 ▶ $root ||= \%::;
Condition0%0/2
$root ||= \%main::main::
l!l
00
MC/DC0%0/1
$root ||= \%main::main::
$root
Truth table0%0/2
A
A= $root
Aresult
11
00
57  
58 0 my @packages;
59 0 for my $fragment (grep { /::$/ } keys %$root) {
60 0 ▶ next if ref($root) && $root == \%:: && $fragment eq 'main::';
Branch: 1 branch
BranchTrueFalseTotal
if ref $root and $root == \%main::main:: and $fragment eq "main::" 0 0 0
Condition0%0/6
ref $root and $root == \%main::main:: and $fragment eq "main::"
!ll&&!rl&&r
000
ref $root and $root == \%main::main::
!ll&&!rl&&r
000
MC/DC0%0/3
ref $root and $root == \%main::main:: and $fragment eq "main::"
ref $root $root == \%main::main:: $fragment eq "main::"
Truth table0%0/4
A and B and C
A= ref $rootB= $root == \%main::main::C= $fragment eq "main::"
ABCresult
0XX0
10X0
1100
1111
61 push @packages, (
62 $fragment,
63 0 map { $fragment . $_ } all_packages($root->{$fragment})
64 );
65 }
66  
67 0 return map { s/::$//; $_ } @packages;
68 }
69  
70 =begin Pod::Coverage
71  
72 methods
73 all_packages
74  
75 =end Pod::Coverage
76  
77 =cut
78  
79 20 1;
« Reply/Plugin/Autocomplete/Keywords.pm ↑ Summary Reply/Plugin/Autocomplete/Packages.pm »