Hi All,
I am trying to run the following program
#!/usr/bin/perl
# use module
use XML::Simple;
use Data::Dumper;
# create object
$xml = new XML::Simple;
# read XML file
$data = $xml->XMLin("dump.xml");
# print output
print Dumper($dump);
At first i had the error mesage saying can't locate simple.pm. So i downloaded simple.pm and put it in /perl/site/lib/XML folder. I ran the program again and this is what i get
Can't locate object method "new" via package "XML::Simple" (perhaps you forgot t
o load "XML::Simple"?) at dump.pl line 9.
Not sure what is missing now. Appreciate help
Thanks in adavance
Install XML::Simple by using the "cpan" command as root.
tyler_durden
Place the installed directory - where XML::Simple is installed in perl lib env variable. eg: PERL5LIB
simple method to install XML::Simple:
perl -MCPAN -e 'install "XML::Simple"'
how do you check if XML::Simple is installed? try using it:
perl -e 'use XML::Simple;'
Thanks all for your replies.
I installed Simple.pm on my machine. I have the admin rights on my desktop.
I used the command yogesh mentioned. For the options i didnt know answers to, i just ressed enter. Finally i got
commit: wrote C:\Perl\lib\CPAN\Config.pm
I'm thinking it means that it is installed
I also used the command that yogesh mentioned to check if it is installed. I got the following
C:\>perl -e 'use XML::Simple;'
Can't find string terminator "'" anywhere before EOF at -e line 1.
C:\>perl -e "use XML::Simple;"
C:\>
I changed single quotes to double quotes and then it went to the prompt again. So i'm guessing all is OK.
I tried running my program again and the error is the same
Can't locate object method "new" via package "XML::Simple" (perhaps you forgot t
o load "XML::Simple"?) at dump.pl line 9.
Dont know what i missed now. Appreciate help.
Hi All,
My issue is resolved. I used ratlperl instead of perl and it resolved my problem.
Thanks for all ur help.
I have redirected the output of my file to output.xm which is in the following format
RT
=> {
'List' => {
'String' => [abcd
efgh
]
RT!
=> {
'List' => {
'String' => [
pqrs
lmno
]
I am trying to get the String values under RT and here is the code i am using
my $data = XMLin("output.xml", GroupTags=>{RequestedTerminations=>'String'});
# print output
print Dumper($data);
However, it doesnt seem to work and i get the following error
Undefined subroutine &main::XMLin called at dump.pl line 15.
Appreciate your help with this