File Coverage

lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Display_Subcmd/OP.pm
Criterion Covered Total %
statement 30 30 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod n/a
total 40 40 100.0


line stmt bran cond sub pod time code
1             # -*- coding: utf-8 -*-
2             # Copyright (C) 2012, 2014-2015 Rocky Bernstein <rocky@cpan.org>
3 12     12   91 use warnings; no warnings 'redefine'; no warnings 'once';
  12     12   38  
  12     12   544  
  12         79  
  12         35  
  12         403  
  12         73  
  12         35  
  12         363  
4 12     12   78 use rlib '../../../../../..';
  12         35  
  12         101  
5              
6 12     12   9922 use Devel::Trepan::DB;
  12         52  
  12         624  
7              
8             package Devel::Trepan::CmdProcessor::Command::Set::Display::OP;
9 12     12   97 use Devel::Trepan::CmdProcessor::Command::Subcmd::Subsubcmd;
  12         50  
  12         316  
10              
11 12     12   70 use strict;
  12         34  
  12         343  
12 12     12   80 use vars qw(@ISA @SUBCMD_VARS);
  12         37  
  12         939  
13             @ISA = qw(Devel::Trepan::CmdProcessor::Command::SetBoolSubsubcmd);
14             # Values inherited from parent
15              
16 12     12   87 use vars @Devel::Trepan::CmdProcessor::Command::Subsubcmd::SUBCMD_VARS;
  12         38  
  12         1819  
17              
18             our $IN_LIST = 1;
19             =pod
20              
21             =head2 Synopsis:
22              
23             =cut
24              
25             our $HELP = <<'HELP';
26             =pod
27              
28             B<set display op>
29              
30             Set to show the I<OP> address in location status.
31              
32             The OP address is the address of the Perl opcode tree that is about
33             to be run. It gives the most precise indication of where you are, and
34             can be useful in disambiguating where among Perl several
35             statements in a line you.
36              
37             In a mult-statement line, the C<deparse> command will print just the
38             current command.
39              
40             =head2 See also:
41              
42             L<C<show display op>|Devel::Trepan::CmdProcessor::Command::Show::Display::OP>,
43             L<C<deparse>|Devel::Trepan::CmdProcessor::Command::Deparse>,
44             L<C<info line>|Devel::Trepan::CmdProcessor::Command::Info::Line>,
45             L<C<info program>|Devel::Trepan::CmdProcessor::Command::Info::Line> and
46             L<C<disassemble>|Devel::Trepan::CmdProcessor::Command::Disassemble>
47             (via plugin L<Devel::Trepan::Disassemble>).
48             =cut
49              
50             HELP
51              
52             our $MIN_ABBREV = length('co');
53 12     12   93 use constant MAX_ARGS => 1;
  12         44  
  12         2657  
54             our $SHORT_HELP = "Set to show OP address in locations";
55              
56             unless (caller) {
57             # Demo it.
58             # DRY this.
59             require Devel::Trepan::CmdProcessor;
60             my $cmdproc = Devel::Trepan::CmdProcessor->new();
61             my $subcmd = Devel::Trepan::CmdProcessor::Command::Set->new($cmdproc, 'set');
62             my $parent_cmd = Devel::Trepan::CmdProcessor::Command::Set::Display->new($subcmd, 'display');
63             my $cmd = __PACKAGE__->new($parent_cmd, 'op');
64             # Add common routine
65             foreach my $field (qw(min_abbrev name)) {
66             printf "Field %s is: %s\n", $field, $cmd->{$field};
67             }
68             my @args = qw(set display op on);
69             $cmd->run(\@args);
70             @args = qw(set display op off);
71             $cmd->run(\@args);
72             }
73              
74             1;