line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DBIx::Class::Helper::ResultSet::ResultClassDWIM; |
2
|
|
|
|
|
|
|
$DBIx::Class::Helper::ResultSet::ResultClassDWIM::VERSION = '2.036000'; |
3
|
|
|
|
|
|
|
# ABSTRACT: result_class => '::HRI' == WIN |
4
|
|
|
|
|
|
|
|
5
|
56
|
|
|
56
|
|
25648
|
use strict; |
|
56
|
|
|
|
|
130
|
|
|
56
|
|
|
|
|
1467
|
|
6
|
56
|
|
|
56
|
|
274
|
use warnings; |
|
56
|
|
|
|
|
116
|
|
|
56
|
|
|
|
|
1479
|
|
7
|
|
|
|
|
|
|
|
8
|
56
|
|
|
56
|
|
365
|
use parent 'DBIx::Class::ResultSet'; |
|
56
|
|
|
|
|
117
|
|
|
56
|
|
|
|
|
282
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub result_class { |
11
|
594
|
|
|
594
|
1
|
186581
|
my ($self, $result_class) = @_; |
12
|
|
|
|
|
|
|
|
13
|
594
|
100
|
|
|
|
1752
|
return $self->next::method unless defined $result_class; |
14
|
|
|
|
|
|
|
|
15
|
493
|
100
|
|
|
|
1493
|
if (!ref $result_class) { |
16
|
492
|
100
|
|
|
|
1343
|
if ($result_class eq '::HRI') { |
17
|
3
|
|
|
|
|
8
|
$result_class = 'DBIx::Class::ResultClass::HashRefInflator' |
18
|
|
|
|
|
|
|
} else { |
19
|
489
|
|
|
|
|
1018
|
$result_class =~ s/^::/DBIx::Class::ResultClass::/; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
493
|
|
|
|
|
1686
|
$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) 2020 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 |