- sudo perl -MCPAN -e 'install JSON'
- sudo perl -MCPAN -e 'install JSON::XS'
- sudo perl -MCPAN -e 'install WWW::Mechanize'
http://beerpla.net/2008/03/27/parsing-json-in-perl-by-example-southparkstudioscom-south-park-episodes/
#!/usr/bin/perl -w
use strict;
use JSON;
use LWP::Simple;
fetch_json_page("http://www.crunchbase.com/v/1/company/yousendit.js");
sub fetch_json_page
{
my ($json_url) = @_;
eval{
my $content = get($json_url);
my $json = new JSON;
# these are some nice json options to relax restrictions a bit:
my $json_text = $json->decode($content);
print $json_text->{phone_number} . "\n";
};
# catch crashes:
if($@){
print "[[JSON ERROR]] JSON parser crashed! $@\n";
}
}