2 DBIx::Class::ResultSet::HashRef - Adds syntactic sugar to skip the fancy
6 # in your resultsource class
7 __PACKAGE__->resultset_class( 'DBIx::Class::ResultSet::HashRef' );
10 my $rs = $schema->resultset('User')->search( { } )->hashref_rs;
11 while (my $row = $rs->next) {
15 You can chain up every L<DBIx::Class::ResultSet> method to ->hashref_rs:
17 * ->hashref_rs->all (same as ->hashref_array)
19 * ->hashref_rs->first (same as ->hashref_first)
22 This is a simple way to allow you to set result_class to
23 DBIx::Class::ResultClass::HashRefInflator to skip the fancy objects.
33 Sets result_class to DBIx::Class::ResultClass::HashRefInflator and
34 returns the resultset.
37 Calls ->hashref_rs->all and returns depending on the calling context an
38 array or an reference to an array.
40 my $rs = $schema->resultset('User')->search( { } )->hashref_array;
43 my @rs = $schema->resultset('User')->search( { } )->hashref_array;
47 Returns the first row of the resultset inflated by
48 DBIx::Class::ResultClass::HashRefInflator.
50 my $first_row = $schema->resultset('User')->search( { } )->hashref_first;
51 print Dumper $first_row
54 Calls hashref_array and returns a reference to a hash containing the
55 primary key. For each key the corresponding value is a reference to a
56 hash of the resultset inflated by
57 DBIx::Class::ResultClass::HashRefInflator.
59 my $hashref_pk = $schema->resultset('User')->search( { } )->hashref_pk;
60 print Dumper $hashref_pk
63 Johannes Plunien <plu@cpan.org>
66 Robert Bohne <rbo@cpan.org>
69 Copyright 2008 by Johannes Plunien
71 This library is free software; you can redistribute it and/or modify it
72 under the same terms as Perl itself.
74 Thanks to mst for his patience.
78 * DBIx::Class::ResultClass::HashRefInflator