blib/lib/Devel/Trepan/CmdProcessor/Command/Info_Subcmd/Return.pm untested

filter: Statementstmt 0.0% 0 / 51 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 83 CC 5 SCAR 24.3
CC
5
Cov
0%
run
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 11.3
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2011-2012, 2014 Rocky Bernstein <rocky@cpan.org>
3 use warnings;
4 use rlib '../../../../..';
5  
6 package Devel::Trepan::CmdProcessor::Command::Info::Return;
7  
8 use Devel::Trepan::CmdProcessor::Command::Subcmd::Core;
9  
10 use strict;
11 use vars qw(@ISA @SUBCMD_VARS);
12 @ISA = qw(Devel::Trepan::CmdProcessor::Command::Subcmd);
13 # Values inherited from parent
14 use vars @Devel::Trepan::CmdProcessor::Command::Subcmd::SUBCMD_VARS;
15  
16 our $SHORT_HELP = "Show the value about to be returned";
17 =pod
18  
19 =head2 Synopsis:
20  
21 =cut
22 our $HELP = <<'HELP';
23 =pod
24  
25 B<info return>
26  
27 Show the value about to be returned.
28 =cut
29 HELP
30  
31 our $MIN_ABBREV = length('ret');
32  
33 unless (@ISA) {
34 eval <<"EOE";
35 use constant NEED_STACK => 1;
36 EOE
37 }
38  
39 use Data::Dumper;
40  
41 no warnings 'redefine';
42 sub run($$)
43 {
44 my ($self, $args) = @_;
45 my $proc = $self->{proc};
46  
47 no warnings 'once';
48 unless ($DB::event eq 'return') {
49 $proc->errmsg("We are not stopped at a return");
50 return;
51 }
52 my $ret_type = $proc->{dbgr}->return_type();
53 if ('undef' eq $ret_type) {
54 $proc->msg("Return value for $DB::_[0] is <undef>");
55 } elsif ('array' eq $ret_type) {
56 $proc->msg("Return array value for $DB::_[0] is:");
57 my @ret = $proc->{dbgr}->return_value();
58 $proc->msg(Dumper(@ret));
59 } elsif ('scalar' eq $ret_type) {
60 my $ret = $proc->{dbgr}->return_value() || 'undef';
61 $proc->msg("Return value for $DB::_[0] is: $ret");
62 }
63 }
64  
65 unless (caller) {
66 require Devel::Trepan;
67 # Demo it.
68 # require_relative '../../mock'
69 # my($dbgr, $parent_cmd) = MockDebugger::setup('show');
70 # $cmd = __PACKAGE__->new(parent_cmd);
71 # $cmd->run(@$cmd->prefix);
72 }
73  
74 # Suppress a "used-once" warning;
75 $HELP || scalar @SUBCMD_VARS;