File Coverage

blib/lib/Iterator/File/Utility.pm
Criterion Covered Total %
statement 18 21 85.7
branch 3 6 50.0
condition 1 3 33.3
subroutine 6 6 100.0
pod 1 1 100.0
total 29 37 78.3


line stmt bran cond sub pod time code
1             package Iterator::File::Utility;
2              
3             ## $Id: Utility.pm,v 1.4 2008/06/11 05:20:07 wdr1 Exp $
4              
5 7     7   195 use 5.006;
  7         21  
  7         265  
6 7     7   40 use strict;
  7         12  
  7         234  
7 7     7   36 use warnings;
  7         11  
  7         2001  
8              
9             our $VERSION = substr(q$Revision: 1.4 $, 10);
10              
11             our %default_config =
12             (
13             'verbose' => 0,
14             'debug' => 0,
15             );
16              
17             sub new {
18 30     30 1 163 my ($class, %config) = @_;
19              
20 30         291 %config = (%config, %default_config);
21 30 50       138 if ($ENV{'ITERATOR_FILE_DEBUG'}) {
22 0         0 $config{'debug'} = $ENV{'ITERATOR_FILE_DEBUG'};
23             }
24              
25 30         79 my $self = bless(\%config, $class);
26            
27              
28 30         83 return $self;
29             }
30              
31              
32             sub _verbose {
33 14     14   21 my $self = shift;
34              
35 14 50 33     94 return unless ($self->{verbose} || $self->{debug});
36 0         0 print @_, "\n";
37             }
38              
39              
40             sub _debug {
41 37     37   53 my $self = shift;
42              
43 37 50       564 return unless ($self->{debug});
44 0           print @_, "\n";
45             }
46              
47              
48             1;
49             __END__