App/Debug.pm untested

filter: Statementstmt 0.0% 0 / 21 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 40 CC 2 SCAR 12.8
CC
2
Cov
0%
debug
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 3.6
1 package Gapp::App::Debug;
2 {
3 $Gapp::App::Debug::VERSION = '0.007';
4 }
5  
6 use Moose;
7 use Sub::Exporter;
8  
9 our $DEBUG = 0;
10  
11 use DateTime;
12  
13 Sub::Exporter::setup_exporter({
14 exports => [qw( debug )],
15 groups => { all => [qw( debug )] }
16 });
17  
18  
19 sub debug {
20 my ( $message, $opts ) = @_;
21 $opts ||= {};
22
23 # only if we are set to debug
24 if ( $opts->{debug} || $DEBUG || $ENV{DEBUG} ) {
25
26 print q([D] ), $message, qq[\n];
27
28 }
29 }
30  
31 1;
32  
33 __END__