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   11165 use strict;
  19         40  
  19         567  
4 19     19   100 use warnings;
  19         31  
  19         511  
5 19     19   97 use base qw(Exporter);
  19         32  
  19         8177  
6             our @EXPORT = qw(undo run return step next);
7              
8             our $VERSION = '0.63'; # VERSION
9              
10             # undo
11             sub undo {
12 4     4 0 2292 my($self, $levels) = @_;
13 4   50     70 $levels ||= 1;
14 4         37 my $response = $self->talk({ command => "commands" });
15 4         14 my @commands = @{$response->{commands}};
  4         18  
16 4         28 pop @commands foreach 1..$levels;
17             # use YAML; warn Dump \@commands;
18 4         27 my $proc = $self->proc;
19 4         60 $proc->die;
20 4         9104 $self->load;
21 4         154 $self->talk($_) foreach @commands;
22 4         18 $self->basic;
23             }
24              
25              
26              
27             # run until a breakpoint
28             sub run {
29 50     50 0 27893 my($self) = @_;
30 50         358 my $response = $self->talk({ command => "run" });
31 50         316 $self->basic; # get basic information for the new line
32             }
33              
34              
35             # return from a subroutine
36             sub return {
37 2     2 0 5432 my($self, @values) = @_;
38 2         6 my $values;
39 2 100       25 $values = \@values if @values;
40 2         37 my $response = $self->talk({
41             command => "return",
42             values => $values,
43             });
44 2         15 $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 61816 my($self) = @_;
52 57         330 my $response = $self->talk({ command => "step" });
53 57         344 $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 26846 my($self) = @_;
59 17         106 my $response = $self->talk({ command => "next" });
60 17         88 $self->basic; # get basic information for the new line
61             }
62              
63             1;
64              
65             __END__