DBI/Filter/URI.pm

filter: Statementstmt 100% 22 / 22 Branchbran 100% 4 / 4 Conditioncond 66.6% 4 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 90.9% 40 / 44 CC 5 SCAR 7.9
CC
5
Cov
94%
decode
3.0
encode
3.0
BEGIN
1.0
CRAP 2.2
« DBI/Filter/base64.pm ↑ Summary DBI/Filter/utf8.pm »
1 #!/usr/bin/env perl
2 package Jifty::DBI::Filter::URI;
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use base 'Jifty::DBI::Filter';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 =head1 NAME
10  
11 Jifty::DBI::Filter::URI - Encodes uniform resource identifiers
12  
13 =head1 DESCRIPTION
14  
15 =head2 encode
16  
17 If the value is a L<URI>, encode it to its string
18 form. Otherwise, do nothing.
19  
20 =cut
21  
22 sub encode {
23 3 ▶ my $self = shift;
Subroutine encode: called CC=3 SCAR=11.0
Pod documented
24  
25 3 my $value_ref = $self->value_ref;
26 3 ▶ return unless ref $$value_ref and $$value_ref->isa('URI');
Branch: 1 branch
BranchTrueFalseTotal
unless ref $$value_ref and $$value_ref->isa("URI") 2 1 3
Condition66%2/3
ref $$value_ref and $$value_ref->isa("URI")
!ll&&!rl&&r
201
MC/DC50%1/2
ref $$value_ref and $$value_ref->isa("URI")
ref $$value_ref $$value_ref->isa("URI")
Truth table66%2/3
A and B
A= ref $$value_refB= $$value_ref->isa("URI")
ABresult
0X0
100
111
27  
28 1 $$value_ref = $$value_ref->as_string;
29 1 return 1;
30 }
31  
32 =head2 decode
33  
34 If value is defined, then decode it using
35 L<URI/as_string>, otherwise do nothing.
36  
37 =cut
38  
39 sub decode {
40 3 ▶ my $self = shift;
Subroutine decode: called CC=3 SCAR=11.0
Pod documented
41  
42 3 my $value_ref = $self->value_ref;
43 3 ▶ return unless defined $$value_ref and length $$value_ref;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $$value_ref and length $$value_ref 1 2 3
Condition66%2/3
defined $$value_ref and length $$value_ref
!ll&&!rl&&r
102
MC/DC50%1/2
defined $$value_ref and length $$value_ref
defined $$value_ref length $$value_ref
Truth table66%2/3
A and B
A= defined $$value_refB= length $$value_ref
ABresult
0X0
100
111
44  
45 2 $$value_ref = URI->new($$value_ref);
46 }
47  
48 =head1 SEE ALSO
49  
50 L<Jifty::DBI::Filter>, L<URI>
51  
52 =cut
53  
54 1 1;
55  
« DBI/Filter/base64.pm ↑ Summary DBI/Filter/utf8.pm »