From: Matt S Trout Date: Fri, 13 Jan 2006 22:46:52 +0000 (+0000) Subject: Re-arranged the add_columns code to be a bit clearer X-Git-Tag: v0.05005~117^2~64 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=535096650b7eb371c52589eef645de0164875f7e;p=dbsrgits%2FDBIx-Class.git Re-arranged the add_columns code to be a bit clearer --- diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index a7a802b..c122ddb 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -45,7 +45,12 @@ sub add_columns { if !$self->_ordered_columns; push @{ $self->_ordered_columns }, @cols; while (my $col = shift @cols) { - $self->_columns->{$col} = (ref $cols[0] ? shift : {}); + + my $column_info = ref $cols[0] ? shift : {}; + # If next entry is { ... } use that for the column info, if not + # use an empty hashref + + $self->_columns->{$col} = $column_info; } }