Navigator/Node/Perl/Symdump.pm

filter: Statementstmt 43.2% 16 / 37 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 44.4% 4 / 9 Podpod 50.0% 1 / 2 totaltotal 38.1% 21 / 55 CC 5 SCAR 16.4
CC
5
Cov
37%
_symdump
12.0
children
6.0
_child
6.0
CRAP 5.2
« Navigator/Node.pm ↑ Summary Navigator/App/PerlDebug.pm »
1 package Tree::Navigator::Node::Perl::Symdump;
2 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 extends 'Tree::Navigator::Node';
5  
6 1 ▶use Devel::Symdump;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 has '+mount_point'
10 0 ▶ => ( required => 0, default => sub { {} } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
11  
12  
13  
14 0 ▶sub _symdump {
Subroutine _symdump: not called CC=3 SCAR=24.8
15 0 ▶ my $package = shift || '';
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
16 0 $package =~ s[/][::]g;
17 0 ▶ my @args = $package ? ($package) : ();
Branch: 1 branch
BranchTrueFalseTotal
$package ? : 0 0 0
18 0 return Devel::Symdump->new(@args);
19 }
20  
21 0 ▶sub children {
Subroutine children: not called CC=2 SCAR=17.9
Pod documented
22 0 my $self = shift;
23 0 (my $package = $self->path) =~ s[/][::]g;
24 0 my $symdump = _symdump($self->path);
25 0 my @sub_packages = $symdump->packages;
26  
27 0 s/^${package}::// foreach @sub_packages;
28 0 return sort @sub_packages;
29 }
30  
31  
32 0 ▶sub _child {
Subroutine _child: not called CC=2 SCAR=17.9
33 0 my ($self, $child_path) = @_;
34 0 my $class = ref $self;
35  
36 0 my $path = $self->_join_path($self->path, $child_path);
37 0 ▶ die "no package '$child_path'" if !_symdump($path);
Branch: 1 branch
BranchTrueFalseTotal
unless _symdump($path) 0 0 0
38  
39 0 return $class->new(mount_point => $self->mount_point,
40 path => $path);
41 }
42  
43  
44 0 ▶sub response {
Subroutine response: not called CC=1 SCAR=6.9
Pod undocumented
45 0 my $self = shift;
46  
47 0 my $html = "<body><h1>" . $self->full_path . "</h1>\n";
48  
49 0 my $symdump = _symdump($self->path);
50 0 $html .= $symdump->as_HTML . "</body>";
51 0 return [200, ['Content-Type' => 'text/html'], [$html]];
52 }
53  
54  
55  
56 1 __PACKAGE__->meta->make_immutable;
57  
58  
59 1 1; # End of Tree::Navigator::Node::Perl::Symdump
60  
61 __DATA__
« Navigator/Node.pm ↑ Summary Navigator/App/PerlDebug.pm »