http://www.perlmonks.org?node_id=1228648


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