tags:

views:

238

answers:

2

The XML2JSON package is not getting loaded when I execute my program. I'm getting the following error:

 Can't locate object method "new" via package "XML::XML2JSON" (perhaps you forgot
  to load "XML::XML2JSON"?) at jsontoxml.pl line 6.
+1  A: 

Do you have a line

 use XML::XML2JSON;

in your program? Did you install the software OK?

Kinopiko
Ya ..I had installed XML2JSON and the following is the code i am trying to execute:-use XML::XML2JSON; my $JSON ='{"name":"Douglas Crockford","phone":"555 123 456"}';my $XML2JSON =XML::XML2JSON->new();my $Obj = $XML2JSON->json2obj($JSON);my $XML = $XML2JSON->obj2xml($Obj);print $XML;
Meteor
A: 

Check that you can use the XML::XML2JSON module from the command line

perl -MXML::XML2JSON

If that gives error messages, then the module isn't installed properly. If it doesn't then there's some fault either with your script or the way you're executing it.

Mark Fowler