From: David Kamholz Date: Wed, 8 Mar 2006 20:28:00 +0000 (+0000) Subject: fix a couple mistakes in last commit X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1c258fc1b3bc48e162b6b05e325625d6a75cb217;p=dbsrgits%2FDBIx-Class-Historic.git fix a couple mistakes in last commit --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 3df6fe1..328b706 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -76,11 +76,10 @@ sub new { my $alias = ($attrs->{alias} ||= 'me'); $attrs->{columns} ||= delete $attrs->{cols} if $attrs->{cols}; + delete $attrs->{as} if $attrs->{columns}; $attrs->{columns} ||= [ $source->columns ] unless $attrs->{select}; - if ($attrs->{columns}) { - delete $attrs->{as}; - $attrs->{select} = [ map { m/\./ ? $_ : "${alias}.$_" } @{delete $attrs->{columns}} ]; - } + $attrs->{select} = [ map { m/\./ ? $_ : "${alias}.$_" } @{delete $attrs->{columns}} ] + if $attrs->{columns}; $attrs->{as} ||= [ map { m/^\Q$alias.\E(.+)$/ ? $1 : $_ } @{$attrs->{select}} ]; if (my $include = delete $attrs->{include_columns}) { push(@{$attrs->{select}}, @$include); @@ -103,7 +102,7 @@ sub new { } $attrs->{group_by} ||= $attrs->{select} if delete $attrs->{distinct}; - $attrs->{order_by} = [ $attrs->{order_by} ] if !ref($attrs->{order_by}); + $attrs->{order_by} = [ $attrs->{order_by} ] if $attrs->{order_by} and !ref($attrs->{order_by}); $attrs->{order_by} ||= []; my $collapse = $attrs->{collapse} || {};