From: Ken Youens-Clark Date: Tue, 14 Apr 2009 21:21:11 +0000 (+0000) Subject: Return lines of output in a list context per user request. X-Git-Tag: v0.11008~209 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bf75adec88e7d32b300af8897772a1522955d185;p=dbsrgits%2FSQL-Translator.git Return lines of output in a list context per user request. --- diff --git a/lib/SQL/Translator/Producer/PostgreSQL.pm b/lib/SQL/Translator/Producer/PostgreSQL.pm index a291bfc..c342aae 100644 --- a/lib/SQL/Translator/Producer/PostgreSQL.pm +++ b/lib/SQL/Translator/Producer/PostgreSQL.pm @@ -190,8 +190,8 @@ sub produce { my $qf = ''; $qf = '"' if ($translator->quote_field_names); - my $output; - $output .= header_comment unless ($no_comments); + my @output; + push @output, header_comment unless ($no_comments); my (@table_defs, @fks); for my $table ( $schema->get_tables ) { @@ -216,10 +216,10 @@ sub produce { }); } - $output = join(";\n\n", @table_defs) . ";\n\n"; + push @output, map { "$_;\n\n" } @table_defs; if ( @fks ) { - $output .= "--\n-- Foreign Key Definitions\n--\n\n" unless $no_comments; - $output .= join( ";\n\n", @fks ) . ";\n"; + push @output, "--\n-- Foreign Key Definitions\n--\n\n" unless $no_comments; + push @output, map { "$_;\n\n" } @fks; } if ( $WARN ) { @@ -235,7 +235,9 @@ sub produce { } } - return $output; + return wantarray + ? @output + : join ('', @output); } # -------------------------------------------------------------------