From: Arthur Axel 'fREW' Schmidt Date: Sat, 20 Mar 2010 09:26:17 +0000 (-0500) Subject: get rid of unnecesary wantarray code X-Git-Tag: v0.001000_01~87 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-DeploymentHandler.git;a=commitdiff_plain;h=284cda869f0db54bac1891cfb52187bccf97d36f get rid of unnecesary wantarray code --- diff --git a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm index 7bcc1f8..92e4102 100644 --- a/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm +++ b/lib/DBIx/Class/DeploymentHandler/DeployMethod/SQL/Translator.pm @@ -168,32 +168,12 @@ method _deployment_statements { data => $schema, ); -#< frew> now note that deploy in the same file calls deployment_statements -#< ribasushi> right -#< frew> ALWAYS in array context -#< ribasushi> right, that's the only way -#< ribasushi> but create_ddl_dir -#< ribasushi> calls in scalar -#< ribasushi> because this is how you get stuff writable to a file -#< ribasushi> in list you get individual statements for dbh->do -#< frew> right -#< frew> ok... -#< frew> so for *me* I need it *always* in scalar -#< frew> because I *only* use it to generate the file -#< ribasushi> correct - my @ret; - my $wa = wantarray; - if ($wa) { - @ret = $tr->translate; - } - else { - $ret[0] = $tr->translate; - } + my $ret = $tr->translate; $schema->throw_exception( 'Unable to produce deployment statements: ' . $tr->error) - unless (@ret && defined $ret[0]); + unless defined $ret; - return $wa ? @ret : $ret[0]; + return $ret; } sub _deploy {