I am using the module XML::Twig for processing XML. While trying to run the nparse
method with pretty_print option, I get an error. Following is the code:
use strict;
use XML::Twig;
use Data::Dumper;
my $xml_string = q{some xml string};
my $twig = XML::Twig->new();
$twig->nparse_pp( pretty_print => 'indented', $xml_string);
and the error message:
Attempt to bless into a reference at local/5.16/lib/perl5/XML/Twig.pm line 463.
Did I miss something?
Did I miss something
use strict;
use warnings;
$xml_string
$stdout
. (Maybe you mean STDOUT
)? XML::LibXML
and XML::Twig
. nparse_pp
implicitly sets pretty_print => 'indented'
already. Post some code that actually compiles and runs, and we might be able to help.
But perhaps you want something like;
my $twig = XML::Twig -> parse ( $xml_string );
$twig -> set_pretty_print ( 'indented' );
$twig -> print;