lib/BioX/Workflow/Command/run/Utils/Debug.pm untested

filter: Statementstmt 0.0% 0 / 18 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 25 CC 2 SCAR 12.8
CC
2
Cov
0%
save_env
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.6
1 package BioX::Workflow::Command::run::Utils::Debug;
2  
3 use Moose::Role;
4 use namespace::autoclean;
5  
6 use Storable qw(dclone);
7  
8 =head1 BioX::Workflow::Command::run::utils::Debug
9  
10 Options for debugging. Stick your whole environment in memory, and figure out what went wrong.
11  
12 =head2 Variables
13  
14 =head3 save_object_env
15  
16 Save object env. This will save all the variables. Useful for debugging, but gets unweildly for larger workflows.
17  
18 =cut
19  
20 has 'save_object_env' => (
21 is => 'rw',
22 isa => 'Bool',
23 default => 0,
24 predicate => 'has_save_object_env',
25 clearer => 'clear_save_object_env',
26 );
27  
28 =head2 _classes
29  
30 Saves a snapshot of the entire namespace for the initial environment, and each rule.
31  
32 =cut
33  
34 has '_classes' => (
35 is => 'rw',
36 isa => 'HashRef',
37 default => sub { return {} },
38 required => 0,
39 predicate => 'has_classes',
40 clearer => 'clear_classes',
41 );
42  
43 =head2 save_env
44  
45 At each rule save the env for debugging purposes.
46  
47 =cut
48  
49 sub save_env {
50 my $self = shift;
51  
52 return unless $self->save_object_env;
53  
54 $DB::single = 2;
55 $self->_classes->{ $self->key } = dclone($self);
56 return;
57 $DB::single = 2;
58 }
59  
60 1;