Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Reading a hash structure stored in a file

by davido (Cardinal)
on Jan 16, 2019 at 15:57 UTC ( #1228648=note: print w/replies, xml ) Need Help??


in reply to Reading a hash structure stored in a file

JSON, YAML, INI, TOML, XML... these are all serialization and data interchange formats. JSON, and YAML are particularly lightweight for representing datastructures such as hashes, arrays, and nested structures.

Are you committed due to some immutable legacy technical debt to using Perl files to store your data? Could you possibly adopt a more secure, simpler format such as JSON? JSON is popular because it is simple, and if treated as data (ie, not evaled by a Javascript engine as code) is fairly secure, in that it won't be exposing your code to injected code.

Perl supports JSON and YAML quite easily using modules from CPAN, and since Perl 5.14 JSON is even supported in the Perl core distribution via JSON::PP


Dave

  • Comment on Re: Reading a hash structure stored in a file

Replies are listed 'Best First'.
Re^2: Reading a hash structure stored in a file
by johngg (Canon) on Jan 17, 2019 at 15:03 UTC

    It's interesting to see that JSON::PP is now the Perl core but I wonder why it doesn't seem to be listed as a core module on http://perldoc.perl.org. I wonder if there are other useful modules that are now core but have been omitted from the documentation.

    Cheers,

    JohnGG

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2019-05-22 10:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (138 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!