Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Creating an XML file w/out external Libraries

by guice (Scribe)
on Jun 29, 2005 at 20:10 UTC ( #471159=perlquestion: print w/replies, xml ) Need Help??

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

I'm wondering if anybody has any simple code to create an XML file from a perl hash?

I have a system in place that has hundereds of client machines that runs a single self contained perl script which outputs a single data file. I want to convert this datafile to XML, but cannot guarentee that XML::Simple (and all it's dependencies) are installed on the remote systems. To combat this, I need the ability to output an XML document using standard looping.

I'm sure I can figure out the code myself, after lots of debugging and testing, but I wanted to check here first to see if anybody has such code already created. A search on XML just brought up posts about XML::Simple and related modules.

-- philip
We put the 'K' in kwality!

  • Comment on Creating an XML file w/out external Libraries

Replies are listed 'Best First'.
Re: Creating an XML file w/out external Libraries
by saintmike (Vicar) on Jun 29, 2005 at 20:14 UTC
    I'd recommend that you use PAR to package up your script so that you can install and run it anywhere with a basic perl installation.

    This way, your target machine won't need to have XML::Simple installed, because it comes with the PAR package.

    This article shows a couple of use cases.

      Oh, hadn't herd of this one before. JAR for Perl. Looks quite interesting. I'll have to check this one out. Wow, if it runs like a real JAR, this'll make things much simpler. Thanks!

      -- philip
      We put the 'K' in kwality!

Re: Creating an XML file w/out external Libraries
by davidrw (Prior) on Jun 29, 2005 at 20:16 UTC
    what about PAR or similar for making sure XML::Simple or any other dependencies are packaged with your script? XML::Dumper is another one.. You can always copy code (or the whole package) from one of those into your .pl file (obviously not the best way to go -- see PAR).

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2022-08-08 11:23 GMT
Find Nodes?
    Voting Booth?

    No recent polls found