;
use warnings;
use parent 'LWP::UserAgent::Caching';
use CHI;
use JSON;
use parent 'Exporter';
our @EXPORT_OK = qw(get_from_json);
=head1 SYNOPSIS
use LWP::UserAgent::Caching::Simple;
for quick one timers
use LWP::UserAgent::Caching::Simple qw(get_from_json);
my $hashref = get_from_json (
'http://example.com/cached?',
'Cache-Control' => 'max-stale
s $ua;
return $ua
}
}
sub get_from_json {
my $resp = _default_useragent()->get(@_, Accept => 'application/json');
return decode_json($resp->decoded_content()) if $resp->is_success