++ed by:

3 PAUSE users
8 non-PAUSE users.

Author image Laurent Dami
and 1 contributors


DBIx::DataModel::Schema::ResultAs::Hashref - arrange data rows in a hash


  $source->select(..., -result_as => 'hashref');
  # or
  $source->select(..., -result_as => [hashref => ($key1, ...)]);


The result will be a hashref. Keys in the hash correspond to distinct values of the specified columns, and values are data row objects. If the argument is given as [hashref => @cols], the column(s) are specified by the caller; otherwise if the argument is given as a simple string, @cols will default to $source->primary_key. If there is more than one column, the result will be a tree of nested hashes. This -result_as is normally used only where the key fields values for each row are unique. If multiple rows are returned with the same values for the key fields then later rows overwrite earlier ones.