File Coverage

blib/lib/XML/Liberal/Remedy/ControlCode.pm
Criterion Covered Total %
statement 7 9 77.7
branch 3 4 75.0
condition n/a
subroutine 2 2 100.0
pod 0 1 0.0
total 12 16 75.0


line stmt bran cond sub pod time code
1             package XML::Liberal::Remedy::ControlCode;
2 5     5   2014 use strict;
  5         9  
  5         704  
3              
4             my $ERROR_RX = do {
5             my $pat = join '|', (
6             'CData section not finished',
7             'PCDATA invalid Char value \d+',
8             'Char 0x[0-9A-F]+ out of allowed range',
9             );
10             qr/^parser error : (?:$pat)/;
11             };
12              
13             sub apply {
14 195     195 0 295 my $class = shift;
15 195         362 my($driver, $error, $xml_ref) = @_;
16              
17 195 100       581 return 0 if $error->message !~ $ERROR_RX;
18 41 50       1134 return 1 if $$xml_ref =~ s/[\x00-\x08\x0b-\x0c\x0e-\x1f\x7f]+//g;
19              
20 0           Carp::carp("Can't find control code line, error was: ", $error->summary);
21 0           return 0;
22             }
23              
24             1;