File Coverage

blib/lib/XML/Liberal/Remedy/Declaration.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::Declaration;
2 5     5   2031 use strict;
  5         9  
  5         585  
3              
4             # optimized to fix all errors in one apply() call
5             sub apply {
6 154     154 0 232 my $class = shift;
7 154         278 my($driver, $error, $xml_ref) = @_;
8              
9 154 100       277 return 0 if $error->message !~
10             /^parser error : XML declaration allowed only at the start of the document/;
11              
12 5 50       74 return 1 if $$xml_ref =~ s/^\s+(?=<)//; # s/^[^<]+//
13              
14 0           Carp::carp("No whitespace found at the start of the document, error was: ",
15             $error->summary);
16 0           return 0;
17             }
18              
19             1;