validation and substitution engine
# - execute the request
# - return the proper fragment of the JSON tree
_mk_subs($methods_urls, { prefix => $PREFIX } );
my %app_to_hist = (
jobs => [ job =>
};
} @param_names;
my $url = $methods_urls->{$key}[0];
my $json_path = $methods_urls->{$key}[1];
my $new_method = sub {
my $self = shi
params => $extra_params });
# Only return the JSON fragment we need
return Hash::Path->get($res, split(/\./, $json_path));
};
{
# limit the scope
;
use strict;
use warnings;
use 5.10.0;
use Moo::Role;
use Data::Dumper;
use HTTP::Request;
use JSON::XS;
use HTML::PullParser;
use LWP::UserAgent;
use Regexp::Common qw( net );
use Scalar::Util q
=> 1,
);
has _json => (
is => 'rw',
lazy => 1,
default => sub {
return JSON::XS->new->pretty(1)->canonical(1);
},
isa => sub {
my $json = shift;
if ( ! blessed $json
|| ! $json->isa('JSON::XS')
|| ! $json->can('decode')
) {
die "Not a JSON object"
}
},
);
has debug => (
is =>
Clone qw( clone );
use Constant::FromGlobal DEBUG => { int => 1, default => 0, env => 1 };
use JSON::XS ();
use Moo::Role;
use Ref::Util qw(
is_arrayref
is_coderef
is_hashref
is_ref
);
has flat => (
is => 'rw',
default => sub { 0 },
lazy => 1,
);
has decode_json_substrings => (
is => 'rw',
default => sub { 0 },
lazy => 1,
);
sub all_avai
_stats {
my $self = shift;
my $c = $self->clone;
$c->stats( ['all'] );
$c->decode_json_substrings( 0 );
my @names;
$c->_looper(
$c->collect,
sub {
validation and substitution engine
# - execute the request
# - return the proper fragment of the JSON tree
_mk_subs($methods_urls);
has '+servers' => (
default => sub { ["localhost:19888"] },