File Coverage

blib/lib/DBIx/Class/Helper/ResultSet/Bare.pm
Criterion Covered Total %
statement 10 10 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 15 15 100.0


line stmt bran cond sub pod time code
1             package DBIx::Class::Helper::ResultSet::Bare;
2             $DBIx::Class::Helper::ResultSet::Bare::VERSION = '2.036000';
3             # ABSTRACT: Get an unsearched ResultSet
4              
5 56     56   119637 use strict;
  56         154  
  56         1669  
6 56     56   274 use warnings;
  56         115  
  56         1423  
7              
8 56     56   280 use parent 'DBIx::Class::ResultSet';
  56         105  
  56         282  
9              
10 1     1 1 2356 sub bare { shift->result_source->resultset }
11              
12             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) 2020 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