Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

How to resolve this error "Unrecognised option" if i use XML::Simple ?

by Anonymous Monk
on May 13, 2008 at 07:08 UTC ( [id://686201]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
open(READ_DATAFEED_XML, $sales_channel_input); my $input_xml = <READ_DATAFEED_XML>; close(READ_DATAFEED_XML); my $sales_channel_output = $xml_simple->XMLin($input_xml);
I ran the above code in my system i am getting error "Unrecognised option: XML::Simple=HASH(0xacfc8bc) at test.pl 11". In some system we were not getting this error. I checked the version of XML::Simple it was same. Any idea why we getting this error ?
  • Comment on How to resolve this error "Unrecognised option" if i use XML::Simple ?
  • Download Code

Replies are listed 'Best First'.
Re: How to resolve this error "Unrecognised option" if i use XML::Simple ?
by moritz (Cardinal) on May 13, 2008 at 07:35 UTC
    It seems that some of your systems don't work with the object interface of XML::Simple for some obscure reasons - consider using the functional interface instead.

    BTW you're only reading the first line from the XML file (unless you modified $/).

      Yes moritz. I used 'undef $/' before open function. I missed to include in the above code snippet. Please guide me what would be the error may be ?

        You can help moritz in helping you by showing a bit more of your script. Other replies have told you that your post is not showing enough, and that there are alternatives.

        You should update your post, and make sure you mention as a note that you are updating, and show some more of the code you wrote. It is important to show how you create $xml_simple. Are you assigning something to an XML::Simple object?

Re: How to resolve this error "Unrecognised option" if i use XML::Simple ?
by FunkyMonk (Chancellor) on May 13, 2008 at 08:07 UTC
    You've obviously just posted a snippit of your code, but do you know that XML::Simple can process a file without having to read it in first:
    #untested use XML::Simple; my $sales_channel_output = XMLin( $sales_channel_input );


    Unless I state otherwise, all my code runs with strict and warnings
Re: How to resolve this error "Unrecognised option" if i use XML::Simple ?
by hipowls (Curate) on May 13, 2008 at 07:40 UTC

    You need to check the open and <READ_DATAFEED_XML>. The error you are getting is indicative of an undef value in $input_xml

    Update: I may have spoke too quickly about being indicative of an undef value, but the point remains that you don't know that any data was read

Re: How to resolve this error "Unrecognised option" if i use XML::Simple ?
by lwicks (Friar) on May 13, 2008 at 09:01 UTC
    Here is a snippet from a working script I use daily on a Windoze machine:
    my $config_file = 'C:\program files\secret_app\config.xml'; my $config = XMLin($config_file); my $timeout = $config->{timeout};

    Kia Kaha, Kia Toa, Kia Manawanui!
    Be Strong, Be Brave, Be perservering!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://686201]
Approved by gube
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-04-19 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found