FP::JSON
use FP::JSON qw(to_json); my $settings = { output_format => "JSON", # or "Mint" auto_numbers => 1, auto_integers => 0, }; use FP::List; is to_json([10, list(20,30), {40=> "foo", bar=> 50}], $settings), '[ 10, [ 20, 30 ], { _40: "foo", bar: 50 } ]';
Currently just provides `to_json` to turn some kinds of data into a JSON or Mint language string. This module will need some work for more serious use.
This somewhat consciously is not implemented as a class--nonetheless, the $settings argument to `to_json` is basically $self. Still, isn't it neat how few changes one needs to do from procedural code this way (Ok, all 3 functions now take the settings, though), and there's no need to use a constructor, just bare "data", which is quite en vogue (again) today (e.g. in Clojure, Elixir).
This is alpha software! Read the status section in the package README or on the website.
To install FunctionalPerl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FunctionalPerl
CPAN shell
perl -MCPAN -e shell install FunctionalPerl
For more information on module installation, please visit the detailed CPAN module installation guide.