CSE/File/ApplicationXml.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 30 CC 3 SCAR 20.8
CC
3
Cov
0%
_build_content
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 8.0
1 package App::CSE::File::ApplicationXml;
2 $App::CSE::File::ApplicationXml::VERSION = '0.016';
3 use Moose;
4 extends qw/App::CSE::File/;
5  
6 use Log::Log4perl;
7 my $LOGGER = Log::Log4perl->get_logger();
8  
9 sub _build_content{
10 my ($self) = @_;
11 my $raw_content = $self->raw_content();
12 unless( defined($raw_content) ){ return undef; }
13  
14 my $dom = eval{ $self->cse()->xml_parser()->load_xml( string => $raw_content,
15 load_ext_dtd => 0,
16 validation => 0
17 );
18 };
19 unless( $dom ){
20 $LOGGER->debug($self->file_path()." is not a valid XML file (XML ERROR is $@). Indexing as standard content");
21 return $self->next::method();
22 }
23 # We need a string, not bytes.
24 $dom->setEncoding('UTF-8');
25 my $bytes = $dom->toString();
26 return Encode::decode($dom->actualEncoding(), $dom->toString());
27 }
28  
29  
30 __PACKAGE__->meta->make_immutable();