se List::MoreUtils qw[uniq none];
use Locale::TextDomain qw[Zonemaster-Engine];
use Readonly;
use JSON::PP;
use Net::IP::XS;
use Zonemaster::Engine::Profile;
use Zonemaster::Engine::Constants qw[:ip]
my $json = JSON::PP->new->canonical->pretty;
if ( $p1 and scalar $p1->answer ) {
my @answer1 = map { lc $_->string } sort $p1->answer;
$answer1_string = $json->enco
my @answer2 = map { lc $_->string } sort $p2->answer;
$answer2_string = $json->encode( \@answer2 );
}
if ( $answer1_string eq $answer2_string ) {
$VERSION = '1.1.0';
use Moose;
use 5.14.2;
use DBI qw(:utils);
use Digest::MD5 qw(md5_hex);
use JSON::PP;
use Zonemaster::Backend::Validator qw( untaint_ipv6_address );
use Zonemaster::Backend::Err
);
use File::Find;
use File::Path qw(make_path);
use Getopt::Long qw(:config no_ignore_case);
use JSON;
use List::MoreUtils qw( first_index );
use List::Util qw( max );
use Pod::Usage;
use Pod::Text;
################################
sub fetch_json_file {
########################################################################
my ($path) = @_;
my $json;
open my $fh, '<', $path
or croak
' . $path;
{
local $RS = undef;
$json = JSON->new->utf8->decode(<$fh>);
}
close $fh
or croak 'could not close ' . $path;
return $json;
}
#######################################
is_hash is_array);
use Carp;
use Data::Dumper;
use English qw(-no_match_vars);
use JSON qw(decode_json encode_json);
use Scalar::Util qw(reftype blessed);
use List::Util qw(any none);
use POSIX qw(s
rue false) ) {
return {
0 => JSON::false,
1 => JSON::true,
true => JSON::true,
false => JSON::false,
}->{$data};
}
return
ime),
to_template_var('class') => $shape_class,
to_template_var('shape') => JSON->new->pretty->encode($shape),
to_template_var('service') => $service,
to_template_va
::Botocore::Shape);
use strict;
use warnings;
use JSON qw(decode_json);
our $SHAPE = <<'SHAPE';
@shape@
SHAPE
our $SHAPE_DEFINITION = decode_json($SHAPE);
########################################
ct;
use warnings;
use Zonemaster::LDNS;
use Zonemaster::LDNS::RRList;
use MIME::Base64;
sub TO_JSON {
my ( $self ) = @_;
return {
'Zonemaster::LDNS::Packet' => {
data
ho
=head2 JSON
JSON is the most commonly used data-interchange format for web services. L<Mojolicious> loves JSON and comes with the
possibly fastest pure-Perl implementation L<Mojo::JSON> built rig
h is accessible through
L<Mojo::Message/"json"> as well as the reserved stash value C<json>.
use Mojolicious::Lite -signatures;
# Modify the received JSON document and return it
put '/reverse'
q->json;
$hash->{message} = reverse $hash->{message};
$c->render(json => $hash);
};
app->start;
You can send JSON documents from the command line with L<Mojolicious::Command::get>.
$
o::JSON;
use Mojo::Promise;
use POSIX ();
has deserialize => sub { \&Mojo::JSON::decode_json };
has ioloop => sub { Mojo::IOLoop->singleton }, weak => 1;
has serialize => sub { \&Mojo::JSON::e
ncode_json };
sub exit_code { shift->{exit_code} }
sub pid { shift->{pid} }
sub run {
my ($self, @args) = @_;
$self->ioloop->next_tick(sub { $self->_start(@args) });
return $self;
}
sub run_
e(sub {...});
A callback used to deserialize subprocess return values, defaults to using L<Mojo::JSON>.
$subprocess->deserialize(sub ($bytes) { return [] });
=head2 ioloop
my $loop = $subpr
our $VERSION = version->declare("v1.1.8");
use Carp qw( confess );
use Time::HiRes qw[time];
use JSON::PP;
use Class::Accessor;
use Zonemaster::Engine::Profile;
use base qw(Class::Accessor);
use o
2,
WARNING => 3,
ERROR => 4,
CRITICAL => 5,
);
our $start_time = time();
my $json = JSON::PP->new->allow_blessed->convert_blessed->canonical;
my $test_levels_config;
__PACKAGE__->mk
able_args;
$argstr = join( q{; },
map { $_ . q{=} . ( ref( $p_args->{$_} ) ? $json->encode( $p_args->{$_} ) : $p_args->{$_} ) }
sort keys %{$p_args} );
}
retur
$VERSION = '1.1.0';
use Moose;
use 5.14.2;
use DBI qw(:utils);
use Digest::MD5 qw(md5_hex);
use JSON::PP;
use Zonemaster::Backend::Errors;
with 'Zonemaster::Backend::DB';
=head1 CLASS METHODS
=
ult profile.
Dies if any of the given paths cannot be read or their contents cannot be parsed
as JSON.
=cut
sub load_profiles {
my ( $class, %profile_paths ) = @_;
my %profiles;
foreac
$json = eval { read_file( $path, err_mode => 'croak' ) } #
// die "Error loading profile '$name': $@";
my $named_profile = eval { Zonemaster::Engine::Profile->from_json(
::Dumper;
use Date::Format;
use English qw( -no_match_vars);
use HTTP::Request;
use JSON qw( encode_json decode_json );
use LWP::UserAgent;
use List::Util qw(any all pairs none);
use Readonly;
use Sca
t -u > xml.services
grep -ri '"protocol":"' botocore/botocore/data/* | grep 'json' | \
cut -f 8 -d '/' | sort -u > json.services
grep -ri '"protocol":"' botocore/botocore/data/* | grep 'query' | \
an API class. Content-Type can however be
overridden when invoking APIs if we guess wrong.
rest-json => application/x-amz-1.1
rest-xml => application/xml
query => application/x-www-form-urlen
API class without using the
# Botocore metadata
use strict;
use warnings;
use Data::Dumper;
use JSON::PP;
our @API_METHODS = qw ( DescribeRule ListRules ListTargetsByRule );
use parent qw(Amazon::
kage, $options, @args ) = @_;
my $cwe = $package->service($options);
return print {*STDOUT} JSON::PP->new->pretty->encode( $cwe->ListRules() );
}
###############################################
package Amazon::ECR;
use strict;
use warnings;
use Data::Dumper;
use JSON;
our $DESCRIPTIONS = { GetAuthorizationToken =>
q{Retrieves an authorization token: run GetAuthorizationToken}, };
use
egistry_V20150921',
api_methods => \@API_METHODS,
content_type => 'application/x-amz-json-1.1',
debug => $ENV{DEBUG} // 0,
%options
}
);
return $self;
}
#####
##############
my ( $package, $options ) = @_;
my $ecr = $package->service($options);
my $rsp = $ecr->GetAuthorizationToken();
return print {*STDOUT} JSON->new->pretty->encode($rsp);
}
1;
ata::Dumper;
use JSON;
use Readonly;
our $VERSION = '0.03';
Readonly::Scalar our $TRUE => 1;
Readonly::Scalar our $FALSE => 0;
use parent qw(Exporter);
our @EXPORT = qw(dump_json normalize_option
########################
sub slurp_json {
########################################################################
my ($file) = @_;
my $json = eval { return JSON::PP->new->decode( slurp($file) )
};
croak "ERROR: could not decode JSON string:\n$EVAL_ERROR\n"
if !$json || $EVAL_ERROR;
return $json;
}
########################################################################
sub slurp {
;
use strict;
use warnings;
use APIExample qw(:booleans dump_json);
use parent qw(APIExample Amazon::API);
use Data::Dumper;
use JSON::PP;
use Data::UUID;
use List::Util qw(any none);
local $Data
s, @args ) = @_;
my $secrets_mgr = $package->service($options);
return print {*STDOUT} dump_json( $secrets_mgr->ListSecrets() );
}
##############################################################
ames;
return print {*STDOUT} dump_json(
$secrets_mgr->DeleteSecret(
{ SecretId => $secret,
ForceDeleteWithoutRecovery => JSON::PP::true
}
)
);
}
##
rnings;
use Carp;
use Data::Dumper;
use English qw( -no_match_vars );
use APIExample qw(dump_json);
use parent qw( APIExample Amazon::API::Route53 );
our $VERSION = '0.01';
our $DESCRIPTIONS
ckage->service($options);
my $hosted_zones = $rt53->ListHostedZones();
print {*STDOUT} dump_json($hosted_zones);
return $hosted_zones;
}
#####################################################
$package->service($options);
my $record_sets
= $rt53->ListResourceRecordSets( { HostedZoneId => $args[0] } );
print {*STDOUT} dump_json($record_sets);
return $record_sets;
}
1;
__END__
e strict;
use warnings;
use Data::Dumper;
use Amazon::API qw( param_n );
use APIExample qw( dump_json );
use parent qw( APIExample Amazon::API::EC2 );
BEGIN {
our $VERSION = $Amazon::API::EC2::VE
service($options);
my $ec2_instances = $ec2->DescribeInstances;
return print {*STDOUT} dump_json($ec2_instances);
}
########################################################################
sub
$package->service($options);
my $vpc_list = $ec2->DescribeVpcs;
return print {*STDOUT} dump_json($vpc_list);
}
########################################################################
sub _Desc
use strict;
use warnings;
use Carp;
use Data::Dumper;
use JSON qw(encode_json);
use Scalar::Util qw( reftype );
use APIExample qw(dump_json);
use parent qw(APIExample Amazon::API::SQS);
our $DESCR
my $sqs = $package->service($options);
my $rsp = $sqs->ListQueues();
print {*STDOUT} dump_json($rsp);
return $rsp;
}
#######################################################################
Url => $queue_url,
ReceiptHandle => $receipt_handle
}
);
print {*STDOUT} dump_json($rsp);
return $rsp;
}
#######################################################################
PIExample Amazon::API::STS );
use Carp;
use Data::Dumper;
use English qw( -no_match_vars );
use JSON::PP;
our $VERSION = '0.01';
our $DESCRIPTIONS = { AssumeRole => 'Executes the AssumeRole API' }
ptions);
my $credentials = $sts->get_credentials_from_role( shift @ARGV );
if ($credentials) {
print {*STDOUT} JSON::PP->new->pretty->encode($credentials);
}
return $credentials;
}
1;