Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Data::Dumper: What the Cabal doesn't want you to know.

by ikegami (Patriarch)
on May 30, 2023 at 21:43 UTC ( [id://11152536]=note: print w/replies, xml ) Need Help??


in reply to Data::Dumper: What the Cabal doesn't want you to know.

Data::Dumper is not great at that. Why not use JSON or YAML instead?

  • Comment on Re: Data::Dumper: What the Cabal doesn't want you to know.

Replies are listed 'Best First'.
Re^2: Data::Dumper: serializing and deserializing
by ikegami (Patriarch) on May 30, 2023 at 21:49 UTC

    Data::Dumper isn't meant for this, but it can be done.

    use Data::Dumper qw( ); sub serializer { local $Data::Dumper::Purity = 1; local $Data::Dumper::Sortkeys = 1; # Optional, but requested local $Data::Dumper::Useqq = 1; # Optional. return Data::Dumper->Dump( [ $_[0] ], [qw( D )] ); } sub deserializer { my $D; eval( $_[0] ) or die ( $@ ); return $D; } my $text = serializer( $data ); my $copy = deserializer( $text );

    [Woops, this was supposed to be a reply to the OP.]

Log In?
Username:
Password:

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

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

    No recent polls found