Navigator/Node/Perl/StackTrace.pm

filter: Statementstmt 45.0% 32 / 71 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 42.8% 9 / 21 Podpod 33.3% 1 / 3 totaltotal 44.2% 42 / 95 CC 2 SCAR 5.2
CC
2
Cov
45%
_attributes
3.0
MOUNT
2.0
_stack
2.0
CRAP 1.7
« Navigator/Node/Win32/Registry.pm ↑ Summary Navigator/View.pm »
1 package Tree::Navigator::Node::Perl::StackTrace;
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::StackTrace::WithLexicals;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Devel::StackTrace::AsHTML;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 0 ▶sub MOUNT {
Subroutine MOUNT: not called CC=1 SCAR=6.9
Pod documented
11 0 my ($class, $mount_args) = @_;
12 $mount_args->{mount_point}{stack_trace}
13 0 = Devel::StackTrace::WithLexicals->new;
14 }
15  
16 0 ▶sub _stack {
Subroutine _stack: not called CC=1 SCAR=6.9
17 0 my $self = shift;
18 0 return $self->mount_point->{stack_trace};
19 }
20  
21 0 ▶sub _children {
Subroutine _children: not called CC=1 SCAR=6.9
22 0 my $self = shift;
23 0 return [reverse(0 .. $self->_stack->frame_count-1)];
24 }
25  
26 0 ▶sub _child {
Subroutine _child: not called CC=1 SCAR=6.9
27 0 my ($self, $child_path) = @_;
28  
29 0 return Tree::Navigator::Node::Perl::StackTrace::Frame->new(
30 mount_point => $self->mount_point,
31 path => $self->_join_path($self->path, $child_path),
32 );
33 }
34  
35  
36 0 ▶sub _attributes {
Subroutine _attributes: not called CC=1 SCAR=6.9
37 0 my $self = shift;
38 return {}
39 0 }
40  
41  
42 0 ▶sub _content {
Subroutine _content: not called CC=1 SCAR=6.9
43 0 my $self = shift;
44 0 my $html = $self->_stack->as_html;
45 0 open my $fh, "<", \$html;
46 0 return $fh;
47 }
48  
49  
50  
51 1 __PACKAGE__->meta->make_immutable;
52  
53  
54 package Tree::Navigator::Node::Perl::StackTrace::Frame;
55 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
56 1 extends 'Tree::Navigator::Node';
57  
58 1 ▶use Tree::Navigator::Node::Perl::Ref;
Subroutine BEGIN: called CC=1 SCAR=0.0
59 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
60  
61 0 ▶sub BUILD {
Subroutine BUILD: not called CC=1 SCAR=6.9
Pod undocumented
62 0 my $self = shift;
63 0 my $frame = $self->_frame;
64  
65 0 $self->mount(args => 'Perl::Ref' =>
66 {mount_point => {ref => [$frame->args]}});
67 0 $self->mount(lexicals => 'Perl::Ref' =>
68 {mount_point => {ref => $frame->lexicals}});
69 }
70  
71 0 ▶sub _frame {
Subroutine _frame: not called CC=1 SCAR=6.9
72 0 my $self = shift;
73 0 my $index = $self->last_path;
74  
75 0 return $self->mount_point->{stack_trace}->frame($index);
76 }
77  
78 0 ▶sub _is_parent {
Subroutine _is_parent: not called CC=1 SCAR=6.9
79 0 return 1;
80 }
81  
82 0 ▶sub _attributes {
Subroutine _attributes: not called CC=2 SCAR=10.9
83 0 my $self = shift;
84 0 my $frame = $self->_frame;
85 0 my %attrs;
86 0 $attrs{$_} = $frame->$_() foreach qw/package filename line subroutine
87 hasargs wantarray evaltext/;
88  
89 1 ▶ use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
90 # $attrs{args} = Dumper($frame->args);
91 0 return \%attrs;
92 }
93  
94  
95 0 ▶sub _content {
Subroutine _content: not called CC=1 SCAR=6.9
96 0 my $self = shift;
97 0 my $frame = $self->_frame;
98 0 my $filename = $frame->filename;
99 0 open(my $fh, $filename); # THINK: or die ? or ignore ?
100 0 return $fh;
101 }
102  
103  
104 0 ▶sub content_text {
Subroutine content_text: not called CC=1 SCAR=6.9
Pod undocumented
105 0 my $self = shift;
106 0 my $frame = $self->_frame;
107 0 my $current_line = $frame->line;
108 0 my $fh = $self->content;
109 0 my @lines = <$fh>;
110 0 $lines[$current_line-1] =~ s[(.*)][<span class='highlight'>$1</span>];
111 0 return join "", @lines;
112 }
113  
114  
115  
116 1 __PACKAGE__->meta->make_immutable;
117  
118  
119 1 1; # End of Tree::Navigator::Node::Perl::StackTrace
120  
121  
122 __END__
« Navigator/Node/Win32/Registry.pm ↑ Summary Navigator/View.pm »