File Coverage

blib/lib/XML/Liberal/Remedy/ControlCode.pm
Criterion Covered Total %
statement 3 9 33.3
branch 0 4 0.0
condition n/a
subroutine 1 2 50.0
pod 0 1 0.0
total 4 16 25.0


line stmt bran cond sub pod time code
1             package XML::Liberal::Remedy::ControlCode;
2 2     2   1011 use strict;
  2         3  
  2         277  
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 0     0 0   my $class = shift;
15 0           my($driver, $error, $xml_ref) = @_;
16              
17 0 0         return 0 if $error->message !~ $ERROR_RX;
18 0 0         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;