Really return undef when parsing fails
[cascardo/Finance-Bank-BR-Santander-Spreadsheet.git] / lib / Finance / Bank / BR / Santander / Spreadsheet.pm
index e4bddb6..e388aeb 100644 (file)
@@ -14,7 +14,9 @@ sub new {
     my $self = {};
     bless $self, $class;
     $self->_init;
-    $self->load(@_);
+    if ($self->load(@_)) {
+        return undef;
+    }
     return $self;
 }
 
@@ -52,10 +54,11 @@ sub load {
     if (defined($filename)) {
         my $xls = Spreadsheet::ParseExcel::Simple->read($filename);
         if (!defined($xls)) {
-            return;
+            return 1;
         }
         $self->_parse($xls);
     }
+    return 0;
 }
 
 sub balance {