File Coverage

blib/lib/Alzabo/Debug.pm
Criterion Covered Total %
statement 20 27 74.0
branch 2 8 25.0
condition n/a
subroutine 6 6 100.0
pod n/a
total 28 41 68.2


line stmt bran cond sub pod time code
1             package Alzabo::Debug;
2              
3 11     11   69 use strict;
  11         22  
  11         2832  
4              
5             BEGIN
6             {
7 11     11   103 my %constants =
8             ( SQL => 0,
9             TRACE => 0,
10             METHODMAKER => 0,
11             REVERSE_ENGINEER => 0,
12             );
13              
14 11 50       72 if ( $ENV{ALZABO_DEBUG} )
15             {
16 0         0 my %debug = map { uc $_ => 1 } split /\|/, $ENV{ALZABO_DEBUG};
  0         0  
17              
18 0 0       0 if ( $debug{ALL} )
19             {
20 0         0 @constants{ keys %constants } = (1) x keys %constants;
21             }
22             else
23             {
24 0         0 foreach ( grep { exists $constants{$_} } keys %debug )
  0         0  
25             {
26 0 0       0 $constants{$_} = $debug{$_} ? 1 : 0;
27             }
28             }
29             }
30              
31 11         86 while ( my ($k, $v) = each %constants )
32             {
33 44     11   3048 eval "use constant $k => $v";
  11     11   68  
  11     11   26  
  11     11   436  
  11         67  
  11         36  
  11         379  
  11         65  
  11         23  
  11         371  
  11         61  
  11         23  
  11         422  
34 44 50       1052 die $@ if $@;
35             }
36             }
37              
38              
39             1;
40              
41             __END__