Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
DBIx::Class::ResultSetUsersContributed Perl DBIx::Class::ResultSet::HashRef(3)

NAME
       DBIx::Class::ResultSet::HashRef - Adds syntactic	sugar to skip the
       fancy objects

SYNOPSIS
	   # in	your resultsource class
	   __PACKAGE__->resultset_class( 'DBIx::Class::ResultSet::HashRef' );

	   # in	your calling code
	   my $rs = $schema->resultset('User')->search(	{ } )->hashref_rs;
	   while (my $row = $rs->next) {
	       print Dumper $row;
	   }

	   You can chain up every L<DBIx::Class::ResultSet> method to ->hashref_rs:

	   * ->hashref_rs->all (same as	->hashref_array)

	   * ->hashref_rs->first (same as ->hashref_first)

DESCRIPTION
       This is a simple	way to allow you to set	result_class to
       DBIx::Class::ResultClass::HashRefInflator to skip the fancy objects.

INSTALLATION
	   perl	Makefile.PL
	   make
	   make	test
	   make	install

METHODS
   hashref_rs( )
       Sets result_class to DBIx::Class::ResultClass::HashRefInflator and
       returns the resultset.

   hashref_array( )
       Calls ->hashref_rs->all and returns depending on	the calling context an
       array or	an reference to	an array.

	   my $rs = $schema->resultset('User')->search(	{ } )->hashref_array;
	   print Dumper	$rs;

	   my @rs = $schema->resultset('User')->search(	{ } )->hashref_array;
	   print Dumper	@rs;

   hashref_first( )
       Returns the first row of	the resultset inflated by
       DBIx::Class::ResultClass::HashRefInflator.

	   my $first_row = $schema->resultset('User')->search( { } )->hashref_first;
	   print Dumper	$first_row

   hashref_pk( )
       Returns a hash or reference to hash, depending on the calling context.
       The keys	of the hash are	the primary keys of each row returned by
       "hashref_array( )":

	       {
		       1 => {
			   'id'	   => '1',
			   'login' => 'root'
		       },
		       2 => {
			   'id'	   => '2',
			   'login' => 'toor'
		       },
	       }

       Example usage:

	   my $hashref_pk = $schema->resultset('User')->search(	{ } )->hashref_pk;
	   print Dumper	$hashref_pk

AUTHOR
       Johannes	Plunien	<plu@cpan.org>

CONTRIBUTORS
       Robert Bohne <rbo@cpan.org>

COPYRIGHT AND LICENSE
       Copyright 2008 by Johannes Plunien

       This library is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

       Thanks to mst for his patience.

SEE ALSO
       o   DBIx::Class

       o   DBIx::Class::ResultClass::HashRefInflator

perl v5.24.1			  2009-06-14DBIx::Class::ResultSet::HashRef(3)

NAME | SYNOPSIS | DESCRIPTION | INSTALLATION | METHODS | AUTHOR | CONTRIBUTORS | COPYRIGHT AND LICENSE | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=DBIx::Class::ResultSet::HashRef&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help