DBIx::Class::Helper::Random - Get random rows from a ResultSet
version 1.093500
# note that this is normally a component for a ResultSet package MySchema::ResultSet::Bar; use strict; use warnings; use parent 'DBIx::Class::ResultSet'; __PACKAGE__->load_components('Helper::Random'); # in code using resultset: my $random_row = $schema->resultset('Bar')->rand->single;
This component allows convenient selection of random rows.
Currently this method will return a ResultSet containing a single random row from the given ResultSet. In the future it will take an argument of how many random rows should be included in the ResultSet.
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com>
This software is copyright (c) 2009 by Arthur Axel "fREW" Schmidt.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install DBIx::Class::Helpers, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBIx::Class::Helpers
CPAN shell
perl -MCPAN -e shell install DBIx::Class::Helpers
For more information on module installation, please visit the detailed CPAN module installation guide.