package Catmandu::Fix::get_json;
our $VERSION = '0.51';
use Catmandu::Sane;
use Catmandu::Util;
use Moo;
use Catmandu::Fix::Has;
use Catmandu::Importer::getJSON;
with "Catmandu::Fix::Base";
has ur
{
$options{ $self->vars ? 'url' : 'from' } = $self->url;
}
Catmandu::Importer::getJSON->new(%options);
}
sub BUILD {
my ($self) = @_;
unless ( defined $self->path ) {
:get_json - get JSON data from an URL as fix function
=head1 SYNOPSIS
# fetches a hash or array
get_json("http://example.com/json")
# stores it in path.key
get_json("http://example.com/json", p
package Catmandu::Importer::getJSON;
our $VERSION = '0.52';
our $CACHE;
use Catmandu::Sane;
use Moo;
use JSON;
use Furl;
use Scalar::Util qw(blessed);
use URI::Template;
with 'Catmandu::Importer';
=> 'ro' );
has headers => (
is => 'ro',
default => sub { [ 'Accept' => 'application/json' ] }
);
has wait => ( is => 'ro' );
has cache => ( is => 'ro', trigger => 1 );
has client => (
d $_[0]->{$_} }
qw(timeout agent proxy),
);
}
);
has json => ( is => 'ro', default => sub { JSON->new->utf8(1) } );
has time => ( is => 'rw' );
has warn => ( is => 'ro', defa