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


in reply to How do I parse CPAN .meta files

That's JSON. JSON ought to do the trick, or minimally JSON::Tiny:

use Data::Dumper; use JSON::Tiny; my $json = do { local $/ = undef; <DATA>; }; my $hash = JSON::Tiny->new->decode($json); print Dumper $hash; __DATA__ { "abstract" : "Regexp Capture Filter For Message::Passing", "author" : [ "chenryn <rao.chenlin@gmail.com>" ], "dynamic_config" : 1, "generated_by" : "ExtUtils::MakeMaker version 6.62, CPAN::Meta::Con +verter version 2.112150", "license" : [ "unknown" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Message-Passing-Filter-Regexp", "no_index" : { "directory" : [ "t", "inc" ] }, "prereqs" : { "build" : { "requires" : { "ExtUtils::MakeMaker" : 0 } }, "configure" : { "requires" : { "ExtUtils::MakeMaker" : 0 } }, "runtime" : { "requires" : { "Config::Tiny" : 0, "JSON::Types" : 0, "Message::Passing" : "0.11", "Regexp::Log" : 0 } } }, "release_status" : "stable", "version" : "0.02" }

I won't bother dumping the output here, but it does work. ;)

As for understanding the spec itself, there's CPAN::Meta::Spec

Or more minimally, as a one-liner: perl -0777 -MData::Dumper -MJSON::Tiny -e 'print Dumper( JSON::Tiny->new->decode( <> ) );' file.txt


Dave