Skip to content

arc/JavaScript-HashRef-Decode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript::HashRef::Decode

This module allows you to decode a JavaScript "simple object" (a hashref) into a Perl hashref structure.

It supports strings, numbers, hashrefs, and arrayrefs.

Hashrefs values can contain either of the above, and so do arrayrefs values.

Examples

use JavaScript::HashRef::Decode qw<decode_js>;
use Data::Dumper::Concise;
my $js   = q!{ foo: "bar", baz: { quux: 123 } }!;
my $href = decode_js($js);
print Dumper $href;
{
    baz => {
        quux => 123
    },
    foo => "bar"
}

To do

String de-interpolation is not the best it could be.

Copyright

This software is copyright (c) 2013 by Situation Publishing.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

About

JavaScript::HashRef::Decode - an JS HashRef decoder for JS to Perl data structures conversion

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Perl 100.0%