XSS/StyleAttribute.pm

filter: Statementstmt 89.7% 35 / 39 Branchbran 100% 6 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 81.2% 13 / 16 Podpod 0.0% 0 / 1 totaltotal 80.6% 54 / 67 CC 5 SCAR 7.0
CC
5
Cov
85%
__ANON__
6.0
render
3.0
__ANON__
2.0
CRAP 2.0
« XSS/ProcessingInstruction.pm ↑ Summary XSS/Role/Renderer.pm »
1 package XML::XSS::StyleAttribute;
2 21 our $AUTHORITY = 'cpan:YANICK';
3 21 $XML::XSS::StyleAttribute::VERSION = '0.3.5';
4 # ABSTRACT: Style attribute for XML::XSS stylesheet rule
5  
6  
7 21 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 21 ▶use MooseX::SemiAffordanceAccessor;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 21 ▶use MooseX::Clone;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 21 with 'MooseX::Clone';
12  
13 21 ▶use Scalar::Util qw/ refaddr /;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 21 ▶no warnings qw/ uninitialized /;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17  
18 use overload
19 28 ▶ 'bool' => sub { $_[0]->value },
Subroutine BEGIN: called CC=1 SCAR=1.0
Subroutine __ANON__: called CC=1 SCAR=0.0
20 0 ▶ '""' => sub { $_[0]->value },
Subroutine __ANON__: not called CC=1 SCAR=6.9
21 2 ▶ '+' => sub { $_[0]->value + $_[1] },
Subroutine __ANON__: called CC=1 SCAR=0.0
22 0 ▶ '0+' => sub { $_[0]->value },
Subroutine __ANON__: not called CC=1 SCAR=6.9
23 7 ▶ '*=' => sub { $_[0]->set_value( $_[1] ) },
Subroutine __ANON__: called CC=1 SCAR=0.0
24 2 ▶ 'x=' => sub { $_[0]->set_value( XML::XSS::xsst( $_[1] ) ) },
Subroutine __ANON__: called CC=1 SCAR=0.0
25 9 ▶ '=' => sub { shift },
Subroutine __ANON__: called CC=1 SCAR=0.0
26 0 ▶ 'eq' => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
27 0 my ( $a, $b ) = @_;
28 0 ▶ return( ref($a) eq ref($b) and refaddr($a) == refaddr($b) );
Condition0%0/3
ref $a eq ref $b && builtin::refaddr($a) == builtin::refaddr($b)
!ll&&!rl&&r
000
MC/DC0%0/2
ref $a eq ref $b && builtin::refaddr($a) == builtin::refaddr($b)
ref $a eq ref $b builtin::refaddr($a) == builtin::refaddr($b)
Truth table0%0/3
A && B
A= ref $a eq ref $bB= builtin::refaddr($a) == builtin::refaddr($b)
ABresult
0X0
100
111
29 21 };
30  
31  
32 21 has 'value' => (
33 is => 'rw',
34 clearer => 'clear_value',
35 predicate => 'has_value',
36 traits => [qw/ Clone /],
37 );
38  
39 115 ▶after 'set_value' => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
40 115 my $self = shift;
41  
42 115 ▶ $self->clear_value unless defined $self->value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->value 3 112 115
43 21 };
44  
45 #sub clone {
46 # return XML::XSS::StyleAttribute->new(
47 # value => $_[0]->value
48 # );
49 #}
50  
51 862 ▶sub render {
Subroutine render: called CC=3 SCAR=11.0
Pod undocumented
52 862 my ( $self, $r, $node, $args ) = @_;
53  
54 862 ▶ return unless $self->has_value;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_value 770 92 862
55  
56 92 my $value = $self->value;
57  
58 92 ▶ return ref $value ? $value->( $r, $node, $args ) : $value;
Branch: 1 branch
BranchTrueFalseTotal
ref $value ? : 13 79 92
59 }
60  
61 21 1;
62  
63 __END__
« XSS/ProcessingInstruction.pm ↑ Summary XSS/Role/Renderer.pm »