Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: From Perl to Java

by almut (Canon)
on Jul 24, 2008 at 18:57 UTC ( [id://699951]=note: print w/replies, xml ) Need Help??


in reply to From Perl to Java

...for instance what is the equivalent to 'Data::Dumper' ?

Not exactly equivalent... but when I feel like needing Data::Dumper in Java (to get an idea of what some complex data structure contains), I usually use XStream with the JSON backend (which I find a little easier on my eyes than the default XML representation).

The usual

use Data::Dumper; ... print Dumper $data;

then becomes something like

import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.json.JsonHierarchicalStreamDriver +; ... XStream dumper = new XStream(new JsonHierarchicalStreamDriver()); System.out.println(dumper.toXML(data));

Not ideal, but better than nothing...

Replies are listed 'Best First'.
Re^2: From Perl to Java
by amarquis (Curate) on Jul 25, 2008 at 13:07 UTC

    I was hoping somebody would drop in with something like this. I knew my usual method of "Just make every object have a debug_print method that knows how to print itself in a sane way" was not ideal, but hadn't done more than a cursory search for something better. Thanks!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-18 05:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found