File Coverage

blib/lib/Enbld/Message.pm
Criterion Covered Total %
statement 13 19 68.4
branch 4 8 50.0
condition n/a
subroutine 4 5 80.0
pod 0 3 0.0
total 21 35 60.0


line stmt bran cond sub pod time code
1             package Enbld::Message;
2              
3 7     7   547 use strict;
  7         9  
  7         182  
4 7     7   23 use warnings;
  7         8  
  7         1103  
5              
6             our $VERBOSE;
7              
8             sub notify {
9 216     216 0 3125 my ( $pkg, $msg ) = @_;
10              
11 216         485 chomp( $msg );
12 216         384 $msg .= "\n";
13              
14 216         2133 require Enbld::Logger;
15 216 100       902 Enbld::Logger->write( $msg ) if Enbld::Logger->logfile;
16            
17 216 100       955 print $msg if $VERBOSE;
18             }
19              
20             sub alert {
21 0     0 0 0 my ( $pkg, $msg ) = @_;
22              
23 0         0 chomp( $msg );
24 0         0 $msg .= "\n";
25              
26 0         0 require Enbld::Logger;
27 0 0       0 Enbld::Logger->write( $msg ) if Enbld::Logger->logfile;
28            
29 0 0       0 print STDERR $msg if $VERBOSE;
30             }
31              
32             sub set_verbose {
33 1     1 0 644 $VERBOSE++;
34             }
35              
36             1;
37