lib/Devel/Trepan/CmdProcessor/Command/Up.pm

filter: Statementstmt 75.9% 79 / 104 Branchbran 33.3% 4 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.7% 21 / 26 Podpod 0.0% 0 / 5 totaltotal 70.7% 104 / 147 CC 7 SCAR 7.9
CC
7
Cov
72%
run
5.1
run
5.1
run
5.1
CRAP 2.2
« lib/Devel/Trepan/CmdProcessor/Command/Unalias.pm ↑ Summary lib/Devel/Trepan/CmdProcessor/Command/Watch.pm »
1 # Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org>
2 12 ▶use warnings; no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 12 ▶use rlib '../../../..';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 12 ▶use Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
7 # NOTE: The down command subclasses this, so beware when changing!
8 package Devel::Trepan::CmdProcessor::Command::Up;
9 12 ▶use if !@ISA, Devel::Trepan::CmdProcessor::Command ;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶unless (@ISA) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@ISA) 0 1 1
12 0 ▶ eval <<'EOE';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
13 use constant CATEGORY => 'stack';
14 use constant SHORT_HELP => 'Move frame in the direction of most recent frame';
15 use constant MIN_ARGS => 0; # Need at least this many
16 use constant MAX_ARGS => 1; # Need at most this many - undef -> unlimited.
17 use constant NEED_STACK => 1;
18 EOE
19 }
20  
21 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 12 ▶use vars qw(@ISA @EXPORT); @ISA = @CMD_ISA; push @ISA, 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
24 12 ▶use vars @CMD_VARS; # Value inherited from parent
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
25 1 @EXPORT = qw(@CMD_VARS set_name);
26  
27 1 our $NAME = set_name();
28 =pod
29  
30 =head2 Synopsis:
31  
32 =cut
33 1 our $HELP = <<'HELP';
34 =pod
35  
36 B<up> [I<count>]
37  
38 Move the current frame up to a caller in the stack trace (an
39 older frame). 0 is the most recent frame. If no count is given, move
40 up 1. This is same as C<down>, but moving in the opposite direction.
41  
42 =head2 Examples:
43  
44 up # Set current frame to the caller of this current one
45 up 1 # Same as above
46 up -1 # Same as down
47  
48 =head2 See also:
49  
50 L<C<down>|Devel::Trepan::CmdProcessor::Command::Down>,
51 L<C<frame>|Devel::Trepan::CmdProcessor::Command::Frame>,
52 and L<C<backtrace>|Devel::Trepan::CmdProcessor::Command::Backtrace>
53  
54 =cut
55 HELP
56  
57 sub complete($$)
58 0 ▶{
Subroutine complete: not called CC=1 SCAR=6.9
Subroutine complete: not called CC=1 SCAR=6.9
Pod undocumented
Pod undocumented
59 0 ▶ my ($self, $prefix) = @_;
Subroutine complete: not called CC=1 SCAR=6.9
Pod undocumented
60 0 $self->{proc}->frame_complete($prefix, 1);
61 }
62  
63 # This method runs the command
64 sub run($$)
65 0 ▶{
Subroutine run: not called CC=3 SCAR=16.3
Subroutine run: not called CC=3 SCAR=16.3
Pod undocumented
Pod undocumented
66 0 my ($self, $args) = @_;
67 0 my $proc = $self->{proc};
68 0 my $count_str = $args->[1];
69 0 ▶ $count_str = 1 unless defined $count_str;
Branch: 2 branches
BranchTrueFalseTotal
unless defined $count_str 0 0 0
unless defined $count_str 11 0 11
70 0 my ($low, $high) = $proc->frame_low_high(0);
71 0 my $opts= {
72 'msg_on_error' =>
73 "The '${NAME}' command requires a frame number. Got: ${count_str}",
74 min_value => $low,
75 max_value => $high
76 };
77 0 my $count = $proc->get_an_int($count_str, $opts);
78 0 ▶ return unless defined $count;
Branch: 2 branches
BranchTrueFalseTotal
unless defined $count 0 0 0
unless defined $count 0 11 11
79 0 $proc->adjust_frame($count, 0);
80 }
81  
82 12 ▶unless (caller) {
Branch: 1 branch
BranchTrueFalseTotal
unless (caller) 0 1 1
83 0 require Devel::Trepan::DB;
84 0 require Devel::Trepan::Core;
85 0 my $db = Devel::Trepan::Core->new;
86 0 my $intf = Devel::Trepan::Interface::User->new;
87 0 my $proc = Devel::Trepan::CmdProcessor->new([$intf], $db);
88 0 $proc->{stack_size} = 0;
89 0 my $cmd = __PACKAGE__->new($proc);
90 0 $cmd->run([$NAME, 0]);
91 }
92  
93 1 1;
« lib/Devel/Trepan/CmdProcessor/Command/Unalias.pm ↑ Summary lib/Devel/Trepan/CmdProcessor/Command/Watch.pm »