line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
1528
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
38
|
|
2
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Jifty::DBI::Filter; |
5
|
1
|
|
|
1
|
|
3
|
use base 'Class::Accessor::Fast'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
443
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw(record column value_ref)); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head2 new |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Takes |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=over |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=item value_ref |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
A reference to the current value you're going to be |
18
|
|
|
|
|
|
|
massaging. C<encode> works in place, massaging whatever value_ref |
19
|
|
|
|
|
|
|
refers to. |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=item column |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
A L<Jifty::DBI::Column> object, whatever sort of column we're working |
24
|
|
|
|
|
|
|
with here. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=back |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub new { |
32
|
1
|
|
|
1
|
1
|
505
|
my $class = shift; |
33
|
1
|
|
|
|
|
3
|
my %args = ( |
34
|
|
|
|
|
|
|
column => undef, |
35
|
|
|
|
|
|
|
value_ref => undef, |
36
|
|
|
|
|
|
|
@_ |
37
|
|
|
|
|
|
|
); |
38
|
1
|
|
|
|
|
1
|
my $self = {}; |
39
|
1
|
|
|
|
|
2
|
bless $self, $class; |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
3
|
for ( keys %args ) { |
42
|
2
|
50
|
|
|
|
14
|
if ( $self->can($_) ) { |
43
|
2
|
|
|
|
|
5
|
$self->$_( $args{$_} ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
1
|
|
|
|
|
5
|
return ($self); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 encode |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
C<encode> takes data that users are handing to us and marshals it into |
55
|
|
|
|
|
|
|
a form suitable for sticking it in the database. This could be anything |
56
|
|
|
|
|
|
|
from flattening a L<DateTime> object into an ISO date to making sure |
57
|
|
|
|
|
|
|
that data is utf8 clean. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
1
|
1
|
|
sub encode { |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 decode |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
C<decode> takes data that the database is handing back to us and gets |
68
|
|
|
|
|
|
|
it into a form that's OK to hand back to the user. This could be |
69
|
|
|
|
|
|
|
anything from flattening a L<DateTime> object into an ISO date to |
70
|
|
|
|
|
|
|
making sure that data is utf8 clean. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
1
|
1
|
|
sub decode { |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |