added 1.000
[dbsrgits/DBIx-Class-ResultSet-HashRef.git] / README
1 NAME
2     DBIx::Class::ResultSet::HashRef - Adds syntatic sugar to skip the fancy
3     objects
4
5 SYNOPSIS
6         # in your resultsource class
7         __PACKAGE__->resultset_class( 'DBIx::Class::ResultSet::HashRef' );
8     
9         # in your calling code
10         my $rs = $schema->resultset('User')->search( { } )->hashref_rs;
11         while (my $row = $rs->next) {
12             print Dumper $row;
13         }
14     
15         You can chain up every L<DBIx::Class::ResultSet> method to ->hashref_rs:
16     
17         * ->hashref_rs->all (same as ->hashref_array)
18
19         * ->hashref_rs->first (same as ->hashref_first)
20     
21 DESCRIPTION
22     This is a simple way to allow you to set result_class to
23     DBIx::Class::ResultClass::HashRefInflator to skip the fancy objects.
24
25 INSTALLATION
26         perl Makefile.PL
27         make
28         make test
29         make install
30
31 METHODS
32   hashref_rs( )
33     Sets result_class to DBIx::Class::ResultClass::HashRefInflator and
34     returns the resultset.
35
36   hashref_array( )
37     Calls ->hashref_rs->all and returns depending on the calling context an
38     array or an reference to an array.
39
40         my $rs = $schema->resultset('User')->search( { } )->hashref_array;
41         print Dumper $rs;
42
43         my @rs = $schema->resultset('User')->search( { } )->hashref_array;
44         print Dumper @rs;
45
46   hashref_first( )
47     Returns the first row of the resultset inflated by
48     DBIx::Class::ResultClass::HashRefInflator.
49
50         my $first_row = $schema->resultset('User')->search( { } )->hashref_first;
51         print Dumper $first_row
52
53 AUTHOR
54     Johannes Plunien <plu@cpan.org>
55
56 COPYRIGHT AND LICENSE
57     Copyright 2008 by Johannes Plunien
58
59     This library is free software; you can redistribute it and/or modify it
60     under the same terms as Perl itself.
61
62     Thanks to mst for his patience.
63
64 SEE ALSO
65     * DBIx::Class
66     * DBIx::Class::ResultClass::HashRefInflator
67