From: Dagfinn Ilmari Mannsåker Date: Tue, 9 Oct 2012 18:12:35 +0000 (+0100) Subject: Allow passing an arrayref to SQLT->filename X-Git-Tag: v0.011016~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=62d2a1c3701f5247d496aa42a88e3149b5bc589c;p=dbsrgits%2FSQL-Translator.git Allow passing an arrayref to SQLT->filename It was lost in the Mooification. --- diff --git a/Changes b/Changes index 875cc56..7bb611c 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ +* Allow passing an arrayref to SQLT->filename (lost in Mooification) + # ---------------------------------------------------------- # 0.11015 2012-10-05 # ---------------------------------------------------------- diff --git a/lib/SQL/Translator.pm b/lib/SQL/Translator.pm index 5ca651d..ea83749 100644 --- a/lib/SQL/Translator.pm +++ b/lib/SQL/Translator.pm @@ -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."); + } } }, );