Using warn instead of die
[koha.git] / C4 / Boolean.pm
index 3a99daf..8d40312 100644 (file)
@@ -1,7 +1,5 @@
 package C4::Boolean;
 
-# $Id$
-
 #package to handle Boolean values in the parameters table
 # Note: This is just a utility module; it should not be instantiated.
 
@@ -24,13 +22,24 @@ package C4::Boolean;
 # Suite 330, Boston, MA  02111-1307 USA
 
 use strict;
+use warnings;
+
 use POSIX;
-require Exporter;
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
 
-# set the version for version checking
-$VERSION = 0.01;
+BEGIN {
+       # set the version for version checking
+       $VERSION = 0.02;
+       require Exporter;
+       @EXPORT = qw(
+               &INVALID_BOOLEAN_STRING_EXCEPTION
+    );
+       @EXPORT_OK = qw(
+               true_p
+    );
+       @ISA = qw(Exporter);
+}
 
 =head1 NAME
 
@@ -54,15 +63,6 @@ Boolean values in a consistent way which makes common sense.
 
 =cut
 
-@ISA = qw(Exporter);
-@EXPORT = (
-       &INVALID_BOOLEAN_STRING_EXCEPTION
-    );
-
-@EXPORT_OK = qw(
-       true_p
-    );
-
 sub INVALID_BOOLEAN_STRING_EXCEPTION ()
     { 'The given value does not seem to be interpretable as a Boolean value' }
 
@@ -90,19 +90,18 @@ exception is thrown.
 
 =cut
 
-require '/u/acli/lib/cvs.pl';
 sub true_p ($) {
     my($x) = @_;
     my $it;
     if (!defined $x || ref($x) ne '') {
-       die INVALID_BOOLEAN_STRING_EXCEPTION;
+       warn INVALID_BOOLEAN_STRING_EXCEPTION;
     }
     $x = lc($x);
     $x =~ s/\s//g;
     if (defined $strings{$x}) {
        $it = $strings{$x};
     } else {
-       die INVALID_BOOLEAN_STRING_EXCEPTION;
+       warn INVALID_BOOLEAN_STRING_EXCEPTION;
     }
     return $it;
 }