use DEBUG enviroment variable, update debug only if higher
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 10 Oct 2014 10:44:19 +0000 (12:44 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 10 Oct 2014 10:44:19 +0000 (12:44 +0200)
lib/Biblio/RFID.pm
lib/Biblio/RFID/Reader.pm

index 209956c..6cfa603 100644 (file)
@@ -16,7 +16,7 @@ Biblio::RFID - perl tools to use different RFID readers for library use
 
 our $VERSION = '0.04';
 
-our $debug = 0;
+our $debug = $ENV{DEBUG} || 0;
 
 
 =head1 DESCRIPTION
index 5eb9417..f99d159 100644 (file)
@@ -129,7 +129,7 @@ sub to_hash {
 
 sub debug {
        my ( $self, $level ) = @_;
-       $debug = $level;
+       $debug = $level if $level > $debug;
        warn "debug level $level\n" if $level;
 }