Navigator/App/PerlDebug.pm

filter: Statementstmt 63.8% 23 / 36 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 1 totaltotal 60.0% 30 / 50 CC 3 SCAR 14.6
CC
3
Cov
58%
debug
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.3
« Navigator/Node/Perl/Symdump.pm ↑ Summary Navigator/Node/DBIDM.pm »
1 =encoding utf8
2  
3 =pod
4  
5 TODO
6 - add Pod/Pom/Web
7  
8 =cut
9  
10  
11  
12 package Tree::Navigator::App::PerlDebug;
13 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use Tree::Navigator;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use Plack 1.0004; # need 'harakiri mode' in HTTP::Server::PSGI
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use Plack::Runner;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use Exporter qw/import/;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 1 our @EXPORT_OK = qw/debug/;
22  
23 0 ▶sub debug {
Subroutine debug: not called CC=3 SCAR=24.8
Pod undocumented
24 # create the navigator
25 0 my $tn = Tree::Navigator->new(can_be_killed => 1);
26  
27 # each pair or arguments ($path => $ref) becomes a mount instruction
28 0 ▶ while (@_ >= 2) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ >= 2) 0 0 0
29 0 my ($path, $ref) = splice @_, 0, 2;
30 0 $tn->mount($path => 'Perl::Ref' => {mount_point => {ref => $ref}});
31 }
32  
33 # if one arg is remaining, it's an arrayref of options to Plack::Runner
34 0 ▶ my $runner_options = shift || ["--access-log" => '/dev/null'];
Condition0%0/2
shift() || ['--access-log', '/dev/null']
l!l
00
MC/DC0%0/1
shift() || ['--access-log', '/dev/null']
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
35  
36 # tell about the objects being debugger
37 0 my $debugged = join ", ", $tn->children;
38 0 print STDERR "DEBUG STARTED; USE YOUR WEB BROWSER TO INSPECT $debugged\n";
39  
40 # mount Stack navigator
41 0 $tn->mount(stack => 'Perl::StackTrace' => {mount_point => {}});
42  
43 # mount Class navigator
44 0 $tn->mount(symdump => 'Perl::Symdump' => {mount_point => {}});
45  
46 # run the Web server
47 0 my $runner = Plack::Runner->new;
48 0 $runner->parse_options(@$runner_options);
49 0 $runner->run($tn->to_app);
50  
51 # if reaching here, server has been killed by user
52 0 print STDERR "END DEBUG SERVER, RESUMING NORMAL OPERATIONS\n";
53 }
54  
55 1 1;
56  
57  
58 __END__
« Navigator/Node/Perl/Symdump.pm ↑ Summary Navigator/Node/DBIDM.pm »