Added a note about select
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSet.pm
index 14882ff..ca16242 100644 (file)
@@ -1796,7 +1796,12 @@ sub populate {
   } else {
     my ($first, @rest) = @$data;
 
-    my @names = grep {!ref $first->{$_}} keys %$first;
+    require overload;
+    my @names = grep {
+      (not ref $first->{$_}) || (ref $first->{$_} eq 'SCALAR') ||
+        (overload::Method($first->{$_}, '""'))
+    } keys %$first;
+
     my @rels = grep { $self->result_source->has_relationship($_) } keys %$first;
     my @pks = $self->result_source->primary_columns;
 
@@ -3255,6 +3260,9 @@ When you use function/stored procedure names and do not supply an C<as>
 attribute, the column names returned are storage-dependent. E.g. MySQL would
 return a column named C<count(employeeid)> in the above example.
 
+B<NOTE:> You will almost always need a corresponding 'as' entry when you use
+'select'.
+
 =head2 +select
 
 =over 4
@@ -3569,8 +3577,8 @@ Adds to the WHERE clause.
   # only return rows WHERE deleted IS NULL for all searches
   __PACKAGE__->resultset_attributes({ where => { deleted => undef } }); )
 
-Can be overridden by passing C<{ where => undef }> as an attribute
-to a resulset.
+Can be overridden by passing C<< { where => undef } >> as an attribute
+to a resultset.
 
 =back