Digest::SHA qw(hmac_sha1_hex);
use Encode qw(decode);
use HTTP::Request;
use HTTP::Response;
use JSON ();
use Perl6::Slurp;
use Test::More;
use URI::Escape qw(uri_unescape);
########################
if ($args_ref->{key_file}) {
my $json = JSON->new()->relaxed(1);
my $key_data = slurp($args_ref->{key_file});
$keys = $json->decode($key_data);
}
# Integration
$args_ref->{$key} // $keys->{$key};
}
# Create the JSON decoder that we'll use for subsequent operations.
$self->{json} = JSON->new->utf8(1);
# Create the queue of expected requests
d => $self->{id} };
my $uri = '/auth/v2/auth_status';
my $result = $self->{_duo}->call_json('GET', $uri, $data);
# Ensure the response included a result field.
if (!defined($result
NTS
Perl 5.14 or later and the modules HTTP::Request and HTTP::Response (part
of HTTP::Message), JSON, LWP (also known as libwww-perl), Perl6::Slurp,
Sub::Install, and URI::Escape (part of URI), all
chanize;
use JSON;
###########################################################################
# Constants
use constant SEARCH => 'http://openlibrary.org/api/books?jscmd=data&format=json&bibkeys=ISB
e unavailable.")
if($@ || !$mech->success() || !$mech->content());
my $code = decode_json($mech->content());
#use Data::Dumper;
#print STDERR "\n# code=".Dumper($code);
return $self-
html = $mech->content();
#print STDERR "\n# html=[\n$html\n]\n";
# catch any data not in the JSON
($data->{height},$data->{width},$data->{depth})
= $html =~ m!<dt>D
##############################################################
# Modules
use WWW::Mechanize;
use JSON::XS;
###########################################################################
# Constants
us
si;
my ($json) = $html =~ m!<script>\s*ws_dl = \[(.*?)\]\s*</script>!si;
#print STDERR "\n# json=[\n$json\n]\n";
if($json) {
$data->{json} = decode_json( $json );
for(qw(author title imprint publication_date format)) {
$data->{$_} = $data->{json}{'gtm-books'}[0]{$_};
}
$data->{binding} ||= $data->{format};
$data->{pubdate} |
##############################################################
# Modules
use HTML::Entities;
use JSON;
use WWW::Mechanize;
###########################################################################
my $json = $mech->content();
return $self->handler("Failed to find that book on GoogleBooks website.")
if($json eq 'bookdata({});');
$json =~ s/^bookdata\(//;
$json =~ s/\);
$//;
my $code = decode_json($json);
#use Data::Dumper;
#print STDERR "\n# code=".Dumper($code);
return $self->handler("Failed to find that book on GoogleBooks website.")
unless($code
es.com.au
# Date: 25th May 2016
# ABSTRACT: Query RightScale for server instances
use URI;
use JSON;
use HTTP::Headers;
use LWP::UserAgent;
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(rs_g
sponse->decoded_content;
} else {
die $response->status_line;
}
return decode_json( $output );
}
sub rs_find_instance {
my $instance_id = shift;
my $rs_cloud_id = shift;
=refresh_token" \\
-d "refresh_token=$refresh_token"
CURL
my $token_request = decode_json `$curl1`;
return $token_request->{access_token};
}
# Connect to RightScale and look for the
DTools::NDProc::Module::JsonPatch;
use strict;
use warnings FATAL => 'all';
use parent 'App::NDTools::NDProc::Module';
use App::NDTools::Util qw(chomp_evaled_error);
use JSON::Patch 0.04 qw(patch);
use Log::Log4Cli;
use Struct::Path 0.80 qw(path);
our $VERSION = '0.02';
sub MODINFO { "Apply JSON Patch (rfc6902) patches" }
sub arg_opts {
my $self = shift;
return (
$self->SUPER
d_error($@), 8 if ($@);
}
}
1; # End of App::NDTools::NDProc::Module::JsonPatch
__END__
=head1 NAME
Patch - Apply JSON Patch (rfc6902) patches
=head1 OPTIONS
=over 4
=item B<--[no]blame>
B
require MooseX::Storage;
MooseX::Storage->import();
with Storage(
'format' => 'JSON',
'io' => 'File',
traits => ['DisableCycleDetection']
);
}
has 'verbo
PTION
This module provides Base81 encoding of the truth table's columns
when saving the table in JSON format.
=head2 FUNCTIONS
=head3 terms_to_base81
Take the terms of a truth table's column and p
pace::autoclean;
use Carp;
use Module::Runtime qw(is_module_name use_module);
use Text::CSV;
use JSON;
use Logic::Minimizer;
use Logic::TruthTable::Convert81 qw(:all);
#
#use Devel::Timer;
# TBD:
e values as a JSON file.
#
open my $fh_json, ">", "twofourtwoone.json" or die "Error opening JSON file.";
$tt_2421 ->export_json(write_handle => \$fh_json);
close $fh_json or warn "Err
the variable names, function names, and title.
Methods exist to import from and export to CSV and JSON files.
=head2 Object Methods
=head3 new()
Create the truth table object. The attributes are:
e auth: $error") if $error;
if (exists $user->{verified_email}) {
# we stringify our JSON::Bool data as some session
# backends might have trouble storing objects.
$user->
parse_response {
my ($response) = @_;
my ($data, $error);
try {
$data = from_json($response);
} catch {
if ($response =~ /timeout/) {
$error = "google auth
: timeout ($response)";
}
else {
$error = "google auth: error parsing JSON ($_)";
}
};
return ($data, $error);
}
register_plugin;
__END__
=head1 NAME
Dan
S_NUMERIC_VALUE
do not process numeric value.
use JSON;
use Data::Recursive::Encode;
my $data = { int => 1 };
is encode_json( Data::Recursive::Encode->encode_utf8($data) ); #=> '{"
int":"1"}'
local $Data::Recursive::Encode::DO_NOT_PROCESS_NUMERIC_VALUE = 1;
is encode_json( Data::Recursive::Encode->encode_utf8($data) ); #=> '{"int":1}'
=back
=head1 METHODS
=over 4
=i
use warnings;
use Time::Piece;
use Carp;
use File::Spec;
use File::Path qw(make_path);
use JSON::PP; # only this support sort_by(custom_func)
use Capture::Tiny qw(capture);
use Algorithm::Cro
JSON
$$jobconf{ next_time_descr } = scalar CORE::localtime($cron->next_time(time));
}
# JSON for the job
my $json = JSON::PP->new->utf8->pretty->canonical;
$json->canonical(1);
$json
->sort_by( \&_ordered_json );
push @{ $self->{jobs} }, $jobconf;
# verbosity
if ( $self->{verbose} > 2 ){
print "added the following job:\n";
print $json->encode( $jobconf );
}
# clean
ON
Version 0.6.3
=cut
our $VERSION = "0.6.3";
=head1 DESCRIPTION
Diff, patch, process, query JSON and YAML with ease.
=head1 TOOLS
=over 4
=item B<L<nddiff>>
Human friendly and machine readab
:
Insert Insert value into structure
JsonMergePatch Apply JSON Merge Patch (rfc7396) patches
JsonPatch Apply JSON Patch (rfc6902) patches
Merge Merge str
L<YAML::XS> should be additionally installed for YAML support. L<YAML::XS>
C<0.67> or later and L<JSON::PP> required for correct booleans dump; C<1> for
true and C<0> for false used for earlier L<YAML
ed to lookup path '$path'", 4 if ($@);
for my $r (@refs) {
my $in = s_encode(${$r}, 'JSON', { pretty => 1 });
my ($out, $err);
run3($opts->{command}, \$in, \$out, \$err,
? " (" . join(" ", split("\n", $err)) . ")" : ""), 16;
}
${$r} = s_decode($out, 'JSON');
}
}
1; # End of App::NDTools::NDProc::Module::Pipe
__END__
=head1 NAME
Pipe - pass str
culation toggle. Enabled by default.
=item B<--command|--cmd> E<lt>commandE<gt>
Command to run. JSON encoded structure passed to it's STDIN and it's STDOUT
applied to original structure. Exit 0 expe
ry::Client;
use strict;
use warnings FATAL => 'all';
use Moose;
use Data::Dumper;
use URI;
use JSON::MaybeXS;
use LWP::UserAgent;
use Path::Tiny qw();
use MooseX::StrictConstructor;
use URI::Escape
'Str',
default => '',
writer => '_set_repository',
);
has '_json' => (
is => 'ro',
builder => '_build_json',
lazy => 1,
);
has '_api_url' => (
is => 'ro',
_upload( $path_to_json )
Upload Build
=cut
sub build_upload {
my ( $self, $json_file ) = @_;
open( my $fh, '<', $json_file );
chomp( my @lines = <$fh> );
my $json_input = join( "",
$self->{OPTS}->{value} = JSON::true;
} elsif ($_[1] eq '0' or $_[1] =~ /^(F|f)alse$/) {
$self->{OPTS}->{value} = JSON::false;
} else {
$self = shift;
$self->{OPTS}->{value} =
s_decode(delete $self->{OPTS}->{structure}, 'JSON')
if (defined $self->{OPTS}->{structure});
$self->{OPTS}->{value} =
$sel
=item B<--file|-f> E<lt>fileE<gt>
Load inserting value from file.
=item B<--file-fmt> E<lt>RAW|JSON|YAMLE<gt>
Input file format.
=item B<--null|--undef>
Insert null value.
=item B<--number> E<l
=> 'all';
use parent qw(Exporter);
use open qw(:std :utf8);
use File::Basename qw(basename);
use JSON qw();
use Scalar::Util qw(readonly);
use App::NDTools::INC;
use App::NDTools::Util qw(is_number)
JSON => {
allow_nonref => 1,
canonical => 1,
pretty => 1,
relaxed => 1,
space_before => 0,
},
);
use constant {
TRUE => JSON::true,
FALSE => JSON
ues/25
# second thing here: get rid of dualvars: YAML::XS load numbers as
# dualvars, but JSON::XS dumps them as strings =(
my @stack = (\$data);
my $ref;
while ($ref = shift @st
package App::NDTools::NDProc::Module::JsonMergePatch;
use strict;
use warnings FATAL => 'all';
use parent 'App::NDTools::NDProc::Module';
use Log::Log4Cli;
use Struct::Diff::MergePatch qw(patch);
us
e Struct::Path 0.80 qw(path);
our $VERSION = '0.02';
sub MODINFO { "Apply JSON Merge Patch (rfc7396) patches" }
sub arg_opts {
my $self = shift;
return (
$self->SUPER::arg_opts(),
$_}, $source) } @refs;
}
1; # End of App::NDTools::NDProc::Module::JsonMergePatch
__END__
=head1 NAME
JsonMergePatch - Apply JSON Merge Patch (rfc7396) patches
=head1 OPTIONS
=over 4
=item B<--
return $self->check_args(@{$self->{ARGV}});
}
sub defaults {
return {
'ofmt' => 'JSON',
'pretty' => 1,
'verbose' => $Log::Log4Cli::LEVEL,
};
}
sub dump_opts {