Allow passing an arrayref to SQLT->filename
[dbsrgits/SQL-Translator.git] / lib / SQL / Translator.pm
index d887c29..ea83749 100644 (file)
@@ -3,7 +3,7 @@ package SQL::Translator;
 use Moo;
 our ( $DEFAULT_SUB, $DEBUG, $ERROR );
 
-our $VERSION  = '0.11014';
+our $VERSION  = '0.11015';
 $DEBUG    = 0 unless defined $DEBUG;
 $ERROR    = "";
 
@@ -201,12 +201,14 @@ around filters => sub {
 has filename => (
     is => 'rw',
     isa => sub {
-        my $filename = shift;
-        if (-d $filename) {
-            throw("Cannot use directory '$filename' as input source");
-        } elsif (not -f _ && -r _) {
-            throw("Cannot use '$filename' as input source: ".
-                  "file does not exist or is not readable.");
+        foreach my $filename (ref($_[0]) eq 'ARRAY' ? @{$_[0]} : $_[0]) {
+            if (-d $filename) {
+                throw("Cannot use directory '$filename' as input source");
+            }
+            elsif (not -f _ && -r _) {
+                throw("Cannot use '$filename' as input source: ".
+                      "file does not exist or is not readable.");
+            }
         }
     },
 );