Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Problem with XMLout

by Scarborough (Hermit)
on Jun 28, 2004 at 14:29 UTC ( [id://370204]=perlquestion: print w/replies, xml ) Need Help??

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

Further to a question I asked about a week ago, I am using XML::Simple to read a list of jobs in the following format
<jobs> <job name="XYZ.pl"> <lang>Perl</lang> <runs>MON</runs> <parameters> <op SERVICE="REPORTS"/> <op USER="NEON"/> </parameters> </job> .... </jobs>
There are about 530 of these jobs and XMLin($file) reads them into my hash just fine. I then find which are due today and write a script file to run todays jobs. This works just fine but we are moving to a .NET enviroment and I've been tasked with making an XML file of todays jobs. Fine I think just copy elements of the hash returned by XMLin($file) that I need and pass it to XMLout. But not as easy as that I get
Options must be name=>value pairs (odd number supplied) at perl_job_steps.pm line 87
Line 87 is
print OUT, XMLout(%{$jobs_tody})

Can anyone see an obvious answer, I'm not keen on the idea of changing the format of the XML as the rest of the code works well.

Replies are listed 'Best First'.
Re: Problem with XMLout
by gellyfish (Monsignor) on Jun 28, 2004 at 14:35 UTC

    XMLout takes a hashref argument not a hash - you don't need to dereference the HASHREF you have.

    /J\

      Thanks that did the trick sometimes I just can't see for looking.
      Interestingly the format of the out file is very different to the original file and in XML terms is probably the format I should adopt for the orginal file. Learning something new every day thats what its all about.
        Look at the options if you want to format the output differently.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (5)
As of 2024-04-24 08:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found