line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::DBI::Sweet::Topping; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
8723
|
use strict; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
208
|
|
4
|
5
|
|
|
5
|
|
30
|
use Class::DBI::Sweet; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
74
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# Alias |
7
|
|
|
|
|
|
|
*Class::DBI::Sweet::find = \&Class::DBI::Sweet::search; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub Class::DBI::Sweet::AUTOLOAD { |
10
|
1
|
|
|
1
|
|
1422
|
my $self = shift; |
11
|
1
|
|
|
|
|
3
|
our $AUTOLOAD = $Class::DBI::Sweet::AUTOLOAD; |
12
|
1
|
|
|
|
|
2
|
my $super_meth = $AUTOLOAD; |
13
|
1
|
|
|
|
|
7
|
$super_meth =~ s/(?:.*::)?/SUPER::/; |
14
|
1
|
50
|
|
|
|
12
|
$AUTOLOAD =~ m/(search|find|page|count|(?:previous|next)_by)_(.*)/ |
15
|
|
|
|
|
|
|
|| return $self->$super_meth(@_); |
16
|
1
|
|
50
|
|
|
6
|
my $method = $1 || ''; |
17
|
1
|
|
50
|
|
|
6
|
my $query = $2 || ''; |
18
|
1
|
50
|
|
|
|
4
|
return 0 unless $query; |
19
|
1
|
|
|
|
|
5
|
my @keys = split /_and_/, $query; |
20
|
1
|
|
|
|
|
3
|
my %con; |
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
11
|
for my $key (@keys) { |
23
|
1
|
50
|
|
|
|
5
|
if ($method =~ /_by/) { |
24
|
1
|
|
|
|
|
6
|
$con{$key} = $self->$key; # previous/next_by conds are from self |
25
|
|
|
|
|
|
|
} else { |
26
|
0
|
|
0
|
|
|
0
|
$con{$key} = shift || ''; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
74
|
$method =~ s/(.*)_by/retrieve_$1/; # Convert next_by to retrieve_next |
31
|
|
|
|
|
|
|
|
32
|
1
|
|
50
|
|
|
5
|
my $attrs = shift || {}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
return wantarray() |
35
|
1
|
50
|
|
|
|
6
|
? @{[$self->$method( \%con, $attrs )]} |
|
1
|
|
|
|
|
16
|
|
36
|
|
|
|
|
|
|
: $self->$method( \%con, $attrs ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |