File Coverage

lib/Devel/ebug/Backend/Plugin/State.pm
Criterion Covered Total %
statement 6 18 33.3
branch 0 2 0.0
condition n/a
subroutine 2 5 40.0
pod 0 3 0.0
total 8 28 28.5


line stmt bran cond sub pod time code
1             package Devel::ebug::Backend::Plugin::State;
2              
3 1     1   2056 use strict;
  1         1  
  1         38  
4 1     1   941 use Devel::ebug::Backend::Plugin::ActionPoints;
  1         1263  
  1         203  
5              
6             sub register_commands {
7 0     0 0   return ( get_state => { sub => \&get_state },
8             set_state => { sub => \&set_state, record => 1 },
9             );
10             }
11              
12             # FIXME breaks encapsulation
13             *all_break_points_with_condition = \&Devel::ebug::Backend::Plugin::ActionPoints::all_break_points_with_condition;
14             *break_point = \&Devel::ebug::Backend::Plugin::ActionPoints::break_point;
15              
16             # FIXME likely does not scale with more ebug plugins... needs registration
17             # interface
18             sub get_state {
19 0     0 0   my( $req, $context ) = @_;
20 0           my $res = {};
21              
22 0           my $bpres = all_break_points_with_condition( $req, $context );
23 0           $res->{break_points} = $bpres->{break_points};
24 0           return $res;
25             }
26              
27             sub set_state {
28 0     0 0   my( $req, $context ) = @_;
29 0           my $state = $req->{state};
30 0 0         foreach my $bp ( @{$state->{break_points} || []} ) {
  0            
31 0           break_point( $bp, $context );
32             }
33 0           return {};
34             }
35              
36             1;