line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::Helper::ResultSet::IgnoreWantarray; |
2
|
|
|
|
|
|
|
$DBIx::Class::Helper::ResultSet::IgnoreWantarray::VERSION = '2.036000'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Get rid of search context issues |
4
|
|
|
|
|
|
|
|
5
|
56
|
|
|
56
|
|
383001
|
use strict; |
|
56
|
|
|
|
|
158
|
|
|
56
|
|
|
|
|
1484
|
|
6
|
56
|
|
|
56
|
|
284
|
use warnings; |
|
56
|
|
|
|
|
120
|
|
|
56
|
|
|
|
|
1431
|
|
7
|
|
|
|
|
|
|
|
8
|
56
|
|
|
56
|
|
298
|
use parent 'DBIx::Class::ResultSet'; |
|
56
|
|
|
|
|
132
|
|
|
56
|
|
|
|
|
276
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub search :DBIC_method_is_indirect_sugar{ |
11
|
419
|
50
|
66
|
419
|
1
|
253709
|
$_[0]->throw_exception ('->search is *not* a mutator, calling it in void context makes no sense') |
12
|
|
|
|
|
|
|
if !defined wantarray && (caller)[0] !~ /^\QDBIx::Class::/; |
13
|
|
|
|
|
|
|
|
14
|
418
|
|
|
|
|
1694
|
shift->search_rs(@_); |
15
|
56
|
|
|
56
|
|
37140
|
} |
|
56
|
|
|
|
|
67080
|
|
|
56
|
|
|
|
|
331
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
1; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
__END__ |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=pod |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 NAME |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
DBIx::Class::Helper::ResultSet::IgnoreWantarray - Get rid of search context issues |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 SYNOPSIS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
package MyApp::Schema::ResultSet::Foo; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__PACKAGE__->load_components(qw{Helper::ResultSet::IgnoreWantarray}); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
... |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
And then else where, like in a controller: |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $rs = $self->paginate( |
40
|
|
|
|
|
|
|
$schema->resultset('Foo')->search({ |
41
|
|
|
|
|
|
|
name => 'frew' |
42
|
|
|
|
|
|
|
}) |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head1 DESCRIPTION |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This component makes search always return a ResultSet, instead of |
48
|
|
|
|
|
|
|
returning an array of your database in array context. See |
49
|
|
|
|
|
|
|
L<DBIx::Class::Helper::ResultSet/NOTE> for a nice way to apply it to your |
50
|
|
|
|
|
|
|
entire schema. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 METHODS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 search |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Override of the default search method to force it to return a ResultSet. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 AUTHOR |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Arthur Axel "fREW" Schmidt. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
67
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=cut |