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

Re: Re: Re: Re: Data::Dumper Efficiency Problem

by mirod (Canon)
on Jan 04, 2001 at 10:19 UTC ( [id://49704]=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Re: Data::Dumper Efficiency Problem
in thread Data::Dumper Efficiency Problem

You are actually right, although I don't really like how XML::Simple saves data structures.

Here is an example of what XML::Simple and XML::Dumper can do:

#!/bin/perl -w use strict; use XML::Simple; use XML::Dumper; my $struct= { toto => [1,2,3], tata => "duh", tutu => { tutu_toto => 1, tutu_tata => 2 }, }; my $out= XMLout( $struct); print "XML::Simple: $out\n"; my $dump = new XML::Dumper; print "XML::Dumper: ", $dump->pl2xml( $struct);

The result is:

XML::Simple: <opt tata="duh"> <tutu tutu_tata="2" tutu_toto="1" /> <toto>1</toto> <toto>2</toto> <toto>3</toto> </opt> XML::Dumper: <perldata> <hash> <item key="tata">duh</item> <item key="tutu"> <hash> <item key="tutu_tata">2</item> <item key="tutu_toto">1</item> </hash> </item> <item key="toto"> <array> <item key="0">1</item> <item key="1">2</item> <item key="2">3</item> </array> </item> </hash> </perldata>

I personnaly think the XML::Dumper way is cleaner but YMMV

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Data::Dumper Efficiency Problem
by repson (Chaplain) on Jan 05, 2001 at 05:03 UTC
    Now that I look at it I agree that the XML::Dumper is a cleaner data structure. But by using <hash> and <array>, the data structure doesn't make full sense outside a perl-only enviroment. However XML::Simple can emit a more portable seeming structure, especially if you specify a few options first.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (3)
As of 2024-04-19 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found