blib/lib/MYDan/Util/Debug.pm untested

filter: Statementstmt 0.0% 0 / 11 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 31 CC 4 SCAR 26.4
CC
4
Cov
0%
isdebug
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 14.0
1 package MYDan::Util::Debug;
2  
3 =head1 NAME
4  
5 MYDan::Util::Debug
6  
7 =cut
8 use warnings;
9 use strict;
10  
11 =head1 SYNOPSIS
12  
13 use MYDan::Util::Debug;
14  
15 MYDan::Util::Debug->isdebug( 1 );
16  
17 =head1 Methods
18  
19 =head3 isdebug( $level )
20  
21 =cut
22  
23 sub isdebug
24 {
25 my ( $class, $level ) = splice @_;
26 $level = 1 unless $level && $level =~ /^\d+$/;
27  
28 my $env = $ENV{MYDan_DEBUG};
29 $env = 0 unless $env && $env =~ /^\d+$/;
30  
31 return $env >= $level ? 1 : 0;
32 }
33  
34  
35 1;