blib/lib/Devel/Trepan/CmdProcessor/Command/Set_Subcmd/Display_Subcmd/OP.pm untested

filter: Statementstmt 0.0% 0 / 49 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod n/a totaltotal 0.0% 0 / 62 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2012, 2014-2015 Rocky Bernstein <rocky@cpan.org>
3 use warnings; no warnings 'redefine'; no warnings 'once';
4 use rlib '../../../../../..';
5  
6 use Devel::Trepan::DB;
7  
8 package Devel::Trepan::CmdProcessor::Command::Set::Display::OP;
9 use Devel::Trepan::CmdProcessor::Command::Subcmd::Subsubcmd;
10  
11 use strict;
12 use vars qw(@ISA @SUBCMD_VARS);
13 @ISA = qw(Devel::Trepan::CmdProcessor::Command::SetBoolSubsubcmd);
14 # Values inherited from parent
15  
16 use vars @Devel::Trepan::CmdProcessor::Command::Subsubcmd::SUBCMD_VARS;
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 use constant MAX_ARGS => 1;
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;