File Coverage

lib/Devel/ebug/Plugin/Run.pm
Criterion Covered Total %
statement 34 34 100.0
branch 2 2 100.0
condition 1 2 50.0
subroutine 8 8 100.0
pod 0 5 0.0
total 45 51 88.2


line stmt bran cond sub pod time code
1             package Devel::ebug::Plugin::Run;
2              
3 19     19   11285 use strict;
  19         37  
  19         577  
4 19     19   90 use warnings;
  19         32  
  19         524  
5 19     19   87 use base qw(Exporter);
  19         27  
  19         8554  
6             our @EXPORT = qw(undo run return step next);
7              
8             our $VERSION = '0.64'; # VERSION
9              
10             # undo
11             sub undo {
12 4     4 0 2476 my($self, $levels) = @_;
13 4   50     81 $levels ||= 1;
14 4         53 my $response = $self->talk({ command => "commands" });
15 4         16 my @commands = @{$response->{commands}};
  4         20  
16 4         27 pop @commands foreach 1..$levels;
17             # use YAML; warn Dump \@commands;
18 4         25 my $proc = $self->proc;
19 4         56 $proc->die;
20 4         8629 $self->load;
21 4         132 $self->talk($_) foreach @commands;
22 4         22 $self->basic;
23             }
24              
25              
26              
27             # run until a breakpoint
28             sub run {
29 50     50 0 28836 my($self) = @_;
30 50         346 my $response = $self->talk({ command => "run" });
31 50         358 $self->basic; # get basic information for the new line
32             }
33              
34              
35             # return from a subroutine
36             sub return {
37 2     2 0 4894 my($self, @values) = @_;
38 2         6 my $values;
39 2 100       19 $values = \@values if @values;
40 2         32 my $response = $self->talk({
41             command => "return",
42             values => $values,
43             });
44 2         14 $self->basic; # get basic information for the new line
45             }
46              
47              
48              
49             # step onto the next line (going into subroutines)
50             sub step {
51 57     57 0 74249 my($self) = @_;
52 57         362 my $response = $self->talk({ command => "step" });
53 57         369 $self->basic; # get basic information for the new line
54             }
55              
56             # step onto the next line (going over subroutines)
57             sub next {
58 17     17 0 28553 my($self) = @_;
59 17         86 my $response = $self->talk({ command => "next" });
60 17         86 $self->basic; # get basic information for the new line
61             }
62              
63             1;
64              
65             __END__