| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package DBIx::Class::Helper::ResultSet::ResultClassDWIM; |
|
2
|
|
|
|
|
|
|
$DBIx::Class::Helper::ResultSet::ResultClassDWIM::VERSION = '2.034002'; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: result_class => '::HRI' == WIN |
|
4
|
|
|
|
|
|
|
|
|
5
|
55
|
|
|
55
|
|
21434
|
use strict; |
|
|
55
|
|
|
|
|
106
|
|
|
|
55
|
|
|
|
|
1264
|
|
|
6
|
55
|
|
|
55
|
|
234
|
use warnings; |
|
|
55
|
|
|
|
|
91
|
|
|
|
55
|
|
|
|
|
1137
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
55
|
|
|
55
|
|
248
|
use parent 'DBIx::Class::ResultSet'; |
|
|
55
|
|
|
|
|
107
|
|
|
|
55
|
|
|
|
|
222
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub result_class { |
|
11
|
582
|
|
|
582
|
1
|
165348
|
my ($self, $result_class) = @_; |
|
12
|
|
|
|
|
|
|
|
|
13
|
582
|
100
|
|
|
|
1591
|
return $self->next::method unless defined $result_class; |
|
14
|
|
|
|
|
|
|
|
|
15
|
481
|
100
|
|
|
|
1292
|
if (!ref $result_class) { |
|
16
|
480
|
100
|
|
|
|
1221
|
if ($result_class eq '::HRI') { |
|
17
|
3
|
|
|
|
|
7
|
$result_class = 'DBIx::Class::ResultClass::HashRefInflator' |
|
18
|
|
|
|
|
|
|
} else { |
|
19
|
477
|
|
|
|
|
939
|
$result_class =~ s/^::/DBIx::Class::ResultClass::/; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
481
|
|
|
|
|
1528
|
$self->next::method($result_class); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
1; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
__END__ |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=pod |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 NAME |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
DBIx::Class::Helper::ResultSet::ResultClassDWIM - result_class => '::HRI' == WIN |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
package MyApp::Schema::ResultSet::Foo; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
__PACKAGE__->load_components(qw{Helper::ResultSet::ResultClassDWIM}); |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
... |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
And then elsewhere: |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
my $data = $schema->resultset('Foo')->search({ |
|
49
|
|
|
|
|
|
|
name => 'frew' |
|
50
|
|
|
|
|
|
|
}, { |
|
51
|
|
|
|
|
|
|
result_class => '::HRI' |
|
52
|
|
|
|
|
|
|
})->all; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
This component allows you to prefix your C<result_class> with C<::> to indicate |
|
57
|
|
|
|
|
|
|
that it should use the default namespace, namely, C<DBIx::Class::ResultClass::>. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
C<::HRI> has been hardcoded to work. Of course C<::HashRefInflator> would |
|
60
|
|
|
|
|
|
|
also work fine. |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
See L<DBIx::Class::Helper::ResultSet/NOTE> for a nice way to apply it to your |
|
63
|
|
|
|
|
|
|
entire schema. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 AUTHOR |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Arthur Axel "fREW" Schmidt <frioux+cpan@gmail.com> |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This software is copyright (c) 2019 by Arthur Axel "fREW" Schmidt. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
74
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |