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

filter: Statementstmt 77.1% 88 / 114 Branchbran 33.3% 4 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 92.5% 25 / 27 Podpod 0.0% 0 / 2 totaltotal 75.4% 117 / 155 CC 7 SCAR 9.3
CC
7
Cov
73%
run
6.8
run
6.8
run
6.8
CRAP 2.5
« lib/Devel/Trepan/CmdProcessor/Command/Down.pm ↑ Summary blib/lib/Devel/Trepan/CmdProcessor/Mock.pm »
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2011-2015 Rocky Bernstein <rocky@cpan.org>
3 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
4 12 ▶use rlib '../../../..';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package Devel::Trepan::CmdProcessor::Command::Display;
7 12 ▶use English qw( -no_match_vars );
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 12 ▶use if !@ISA, Devel::Trepan::DB::Display ;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
10 12 ▶use if !@ISA, Devel::Trepan::Condition ;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
11 12 ▶use if !@ISA, Devel::Trepan::CmdProcessor::Command ;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶unless (@ISA) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@ISA) 0 1 1
14 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
15 use constant CATEGORY => 'data';
16 use constant NEED_STACK => 0;
17 use constant SHORT_HELP =>
18 'Display expressions when entering debugger';
19 use constant MIN_ARGS => 1; # Need at least this many
20 use constant MAX_ARGS => undef; # Need at most this many - undef -> unlimited.
21 EOE
22 }
23  
24 12 ▶use strict; use vars qw(@ISA); @ISA = @CMD_ISA;
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
25 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
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<display> I<Perl-expression>
37  
38 Print value of expression I<Perl-expression> each time the program stops.
39  
40 =head2 Examples:
41  
42 display $a # Display variable \$a each time we enter debugger
43 display join(', ', @ARGV) # show values of array @ARGV
44  
45 If what you want to do is evaluate a Perl expression or statement once
46 rather than every time the program stops, see C<eval>.
47  
48 See also L<C<undisplay>|<Devel::Trepan::CmdProcessor::Command::Undisplay>,
49 L<C<enable>|<Devel::Trepan::CmdProcessor::Command::Enable>, and
50 L<C<disable>|<Devel::Trepan::CmdProcessor::Command::Disable>
51 =cut
52 HELP
53  
54 # This method runs the command
55 0 ▶sub run($$) {
Subroutine run: not called CC=3 SCAR=19.2
Subroutine run: not called CC=3 SCAR=19.2
Pod undocumented
Pod undocumented
56 0 my ($self, $args) = @_;
57 0 my $proc = $self->{proc};
58 0 my $display;
59 0 my @args = @{$args};
60 0 shift @args;
61  
62 0 $display = join(' ', @args);
63 0 ▶ unless (is_valid_condition($display)) {
Branch: 2 branches
BranchTrueFalseTotal
unless (&is_valid_condition($display)) 0 0 0
unless (&is_valid_condition($display)) 11 0 11
64 0 $proc->errmsg("Invalid display: $display");
65 return
66 0 }
67 0 my $disp = $proc->{displays}->add($display);
68 0 ▶ if ($disp) {
Branch: 2 branches
BranchTrueFalseTotal
if ($disp) 0 0 0
if ($disp) 0 11 11
69 0 my $mess = sprintf("Display %d set", $disp->number);
70 0 $proc->msg($mess);
71 }
72 }
73  
74 1 ▶unless (caller) {
Branch: 1 branch
BranchTrueFalseTotal
unless (caller) 0 1 1
75 0 require Devel::Trepan::CmdProcessor::Mock;
76 0 my $proc = Devel::Trepan::CmdProcessor::Mock::setup();
77 0 my $cmd = __PACKAGE__->new($proc);
78 0 $cmd->run([$NAME]);
79 }
80  
81 1 1;
« lib/Devel/Trepan/CmdProcessor/Command/Down.pm ↑ Summary blib/lib/Devel/Trepan/CmdProcessor/Mock.pm »