Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^2: Accessing variables in an external hash without eval

by tobyink (Canon)
on May 17, 2017 at 08:46 UTC ( #1190448=note: print w/replies, xml ) Need Help??


in reply to Re: Accessing variables in an external hash without eval
in thread Accessing variables in an external hash without eval

JSON cannot store "arbitrary structures". Not unless your definition of "arbitrary" is extremely limited. It can't contain cyclic references for example. Something like this can be represented in Perl code, Storable, YAML, and (using IDREF) probably in XML, but not JSONů

use strict; use warnings; use Data::Dumper qw(Dumper); use YAML::XS qw(Dump); my $data = do { my $child = {}; my $parent = { child => $child }; $child->{parent} = $parent; }; print "#### Perl ####\n"; print Dumper($data), "\n"; print "#### YAML ####\n"; print Dump($data), "\n";

Replies are listed 'Best First'.
Re^3: Accessing variables in an external hash without eval
by afoken (Canon) on May 17, 2017 at 19:55 UTC
    JSON cannot store "arbitrary structures". Not unless your definition of "arbitrary" is extremely limited. It can't contain cyclic references for example.

    You are right.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2020-02-23 18:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?










    Results (103 votes). Check out past polls.

    Notices?