| 1 | package DBIx::Class::Helper::ResultSet::Bare; | ||
| 2 | 54 | $DBIx::Class::Helper::ResultSet::Bare::VERSION = '2.033001'; | |
| 3 | # ABSTRACT: Get an unsearched ResultSet | ||
| 4 | |||
| 5 | 54 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 54 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 54 | ▶ | use parent 'DBIx::Class::ResultSet'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 1 | ▶ | sub bare { shift->result_source->resultset } |
|
Subroutine
bare: called CC=1 SCAR=0.0
Pod
documented
| |||
| 11 | |||
| 12 | 54 | 1; | |
| 13 | |||
| 14 | __END__ | ||
| 15 | |||
| 16 | =pod | ||
| 17 | |||
| 18 | =head1 NAME | ||
| 19 | |||
| 20 | DBIx::Class::Helper::ResultSet::Bare - Get an unsearched ResultSet | ||
| 21 | |||
| 22 | =head1 SYNOPSIS | ||
| 23 | |||
| 24 | package MyApp::Schema::ResultSet::KV; | ||
| 25 | |||
| 26 | __PACKAGE__->load_components(qw{Helper::ResultSet::Bare}); | ||
| 27 | |||
| 28 | sub set_value { | ||
| 29 | my ($self, $key, $value) = @_; | ||
| 30 | |||
| 31 | $self->bare->create_or_update({ | ||
| 32 | key => $key, | ||
| 33 | value => $value, | ||
| 34 | }); | ||
| 35 | } | ||
| 36 | |||
| 37 | 1; | ||
| 38 | |||
| 39 | =head1 DESCRIPTION | ||
| 40 | |||
| 41 | Once in a blue moon you will find yourself in the frustrating position of | ||
| 42 | needing a vanilla ResultSet when all you have is a ResultSet that has a search | ||
| 43 | applied to it. That's what this helper is for; it gives you a method to get at an | ||
| 44 | unsearched version of the ResultSet. | ||
| 45 | |||
| 46 | =head1 METHODS | ||
| 47 | |||
| 48 | =head2 C<bare> | ||
| 49 | |||
| 50 | my $plain_rs = $searched_rs->bare; | ||
| 51 | |||
| 52 | Takes no arguments and returns the ResultSet as if nothing were searched against | ||
| 53 | it at all. | ||
| 54 | |||
| 55 | =head1 AUTHOR | ||
| 56 | |||
| 57 | Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> | ||
| 58 | |||
| 59 | =head1 COPYRIGHT AND LICENSE | ||
| 60 | |||
| 61 | This software is copyright (c) 2016 by Arthur Axel "fREW" Schmidt. | ||
| 62 | |||
| 63 | This is free software; you can redistribute it and/or modify it under | ||
| 64 | the same terms as the Perl 5 programming language system itself. | ||
| 65 | |||
| 66 | =cut | ||