| 1 | package XML::XSS::Text; | ||||||||||||||||||||||||||||
| 2 | 15 | our $AUTHORITY = 'cpan:YANICK'; | |||||||||||||||||||||||||||
| 3 | # ABSTRACT: XML::XSS text stylesheet rule | ||||||||||||||||||||||||||||
| 4 | 15 | $XML::XSS::Text::VERSION = '0.3.5'; | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 15 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 15 | ▶ | use MooseX::SemiAffordanceAccessor; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 15 | ▶ | use MooseX::Clone; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 15 | with 'XML::XSS::Role::Renderer', 'MooseX::Clone'; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 15 | ▶ | no warnings qw/ uninitialized /; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 15 | has replace => ( | |||||||||||||||||||||||||||
| 18 | traits => [ qw/ XML::XSS::Role::StyleAttribute Clone / ] | ||||||||||||||||||||||||||||
| 19 | ); | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 15 | has filter => ( | |||||||||||||||||||||||||||
| 23 | traits => [ qw/ XML::XSS::Role::StyleAttribute Clone / ] | ||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 15 | has [ qw/ pre post / ] => ( | |||||||||||||||||||||||||||
| 29 | traits => [ qw/ XML::XSS::Role::StyleAttribute Clone/ ] | ||||||||||||||||||||||||||||
| 30 | ); | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 15 | has process => ( | |||||||||||||||||||||||||||
| 34 | traits => [ qw/ XML::XSS::Role::StyleAttribute Clone/ ] | ||||||||||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 2 | ▶ | sub clear { | ||||||||||||||||||||||||||
|
Subroutine
clear: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 38 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 2 | for ( qw/ pre post replace filter process / ) { | |||||||||||||||||||||||||||
| 41 | 10 | my $setter = "clear_$_"; | |||||||||||||||||||||||||||
| 42 | 10 | $self->$setter; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 34 | ▶ | sub apply { | ||||||||||||||||||||||||||
|
Subroutine
apply: called CC=7 SCAR=19.5
| |||||||||||||||||||||||||||||
| 48 | 34 | my ( $self, $node, $args ) = @_; | |||||||||||||||||||||||||||
| 49 | 34 | ▶ | $args ||= {}; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args ||= {}
MC/DC0%0/1
$args ||= {}
$args
Truth table50%1/2
A
A= $args
| |||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | return | ||||||||||||||||||||||||||||
| 52 | 34 | ▶ | if $self->has_process and !$self->_render( 'process', $node, $args ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$self->has_process and not $self->_render("process", $node, $args)
MC/DC50%1/2
$self->has_process and not $self->_render("process", $node, $args)
$self->has_process
not $self->_render("process", $node, $args)
Truth table66%2/3
A and not(B)
A= $self->has_processB= not $self->_render("process", $node, $args)
| |||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 33 | my $text = $node->data; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 33 | my $output; | |||||||||||||||||||||||||||
| 57 | 33 | $output .= $self->_render( 'pre', $node, $args ); | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | 33 | ▶ | if ( $self->has_replace ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | 2 | $text = $self->_render( 'replace', $node, $args ); | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 33 | ▶ | if ( $self->has_filter ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 64 | 2 | $text = $self->filter->value()->() for $text; # quick alias to $_ | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 33 | $output .= $text; | |||||||||||||||||||||||||||
| 68 | 33 | $output .= $self->_render( 'post', $node, $args ); | |||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 33 | return $output; | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | 15 | 1; | |||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | __END__ | ||||||||||||||||||||||||||||