eaders => [qw/X-Requested-With Authorization Content-Type/],
maxage => 7200,
},
'JSON' => {
pretty => 1,
convert_blessed => 1,
},
'XML::Simple' => {
RootName
Test;
use Dwarf::Pragma;
use parent 'Exporter';
use Data::Dumper;
use Encode qw/decode_utf8/;
use JSON;
use HTTP::Cookies;
use HTTP::Request::Common qw/GET HEAD PUT POST DELETE/;
use LWP::UserAgent;
u
0 || $res->code == 500) and $res->header('Content-Type') =~ /json/) {
return $res unless $res->content;
my $content = eval { decode_json($res->content) };
if ($@) {
warn $content;
}
$res-
V{MOJO_WORDPRESS_DEBUG} || 0;
our $VERSION = '0.03';
has base_url => 'http://localhost/wp-json'; # Will become a Mojo::URL object
has meta_replacer => undef;
has post_pr
> "wp/v2/$type", \%query)->then(sub {
my $wp_res = shift->res;
my $post = _arr($wp_res->json)->[0];
return $post && $processor ? $c->$processor($post) : $post;
});
}
sub _helper_get_p
ather, @posts);
$gather = sub {
my $wp_res = shift->res;
for my $post (@{_arr($wp_res->json)}) {
push @posts, $processor ? $c->$processor($post) : $post;
}
# Done getting all
warf::Util qw/add_method encode_utf8 decode_utf8/;
use Email::Valid;
use Email::Valid::Loose;
use JSON;
use Mouse;
use Mouse::Util::TypeConstraints;
use Regexp::Common qw/URI/;
sub init {
my ($class
CreditcardSecurity
=> as 'Str'
=> where { $_ =~ /\A[0-9]{3,4}\z/ };
subtype JSON
=> as 'Str'
=> where { _json($_) };
subtype Base64JPEG
=> as 'Str'
=> where { _base64_type($_, 'jpeg')
$s > 59 or $s < 0 ) {
return 0;
}
return 1;
}
sub _json {
my $value = $_;
return 1 unless defined $value;
my $data = eval { decode_json encode_utf8 $value };
if ($@) {
warn $@;
warn $val
pi/ping.json',
'SERVER_NAME' => 'perl.org',
'HTTP_CONNECTION' => 'TE, close',
'REQUEST_METHOD' => 'GET',
'SCRIPT_URI' => 'http://www.perl.org/dwarf/test/api/ping.json',
'SC
RIPT_FILENAME' => '/dwarf/test/api/ping.json',
'SERVER_SOFTWARE' => 'Apache/1.3.27 (Unix) ',
'HTTP_TE' => 'deflate,gzip;q=0.3',
'QUERY_STRING' => 'name[]=1&name[1]=2',
'REMO
=> '/dwarf/test/api/ping.json',
'REQUEST_URI' => '/dwarf/test/api/ping.json',
'GATEWAY_INTERFACE' => 'CGI/1.1',
'SCRIPT_URL' => '/dwarf/test/api/ping.json',
'SERVER_ADDR' =
ync;
use Dwarf::Util qw/encode_utf8 decode_utf8 shuffle_array/;
use HTTP::Request::Common ();
use JSON;
use LWP::UserAgent;
use Dwarf::Accessor qw/
ua ua_async urls
key secret
access_token refresh
e, $text) = @_;
my $json = encode_json {
title => $title,
body => $text,
recipients => [$id]
};
$self->call('messages/@me/@self/@outbox', 'POST', {}, $json);
}
sub is_following
$self->access_token);
if (defined $content) {
push @p, (
'Content-Type' => 'application/json',
'Content' => $content
);
}
}
no strict 'refs';
my $req = &{"HTTP::Request::Co
(my $err = $tx->error) { Carp::croak $err->{message} }
my $data = $tx->res->json;
return $self->_result($tx->res->json);
}
sub get_p {
my ($self, $url) = @_;
$self->ua->get_p($url)->then(sub{
$err = $tx->error) { Carp::croak $err->{message} }
my $data = $tx->res->json;
return $self->_result($tx->res->json);
});
}
sub root {
my $self = shift;
return $self->{root} ||= $self->
n.
It replaces the existing IPMI "standard", such as it was, both in standardization and in using JSON over HTTP rather than binary protocols.
L<Mojo::Redfish::Client> is, as the name suggests, a cli
opes grant_type timeout expires_in/],
rw => [qw/token_url cache/],
);
use JSON qw(encode_json decode_json);
use JSON::WebToken;
use Furl;
use HTTP::Status qw(:constants);
use Carp qw(carp croak);
EFAULT_TIMEOUT;
$args{scopes} ||= [];
$args{jwt_config} ||= _jwt_config_from_json($args{api_key_json}, $args{scopes});
$args{token_url} ||= $args{jwt_config}->{token_url};
$args{u
args{uri},
headers => [
'Content-Type' => $args{content_type} || 'application/json; UTF-8',
'Authorization' => sprintf("Bearer %s", $token->{access_token}),
],
"0.02";
use Class::Accessor::Lite (
new => 0,
rw => [qw/sender api_url/],
);
use JSON qw(encode_json);
use Carp qw(croak);
use WWW::FCM::HTTP::V1::OAuth;
our $SCOPE_FIREBASE_MESSAGING = "h
pi_url => $api_url, api_key_json => $api_key_json })'
unless (exists $args{api_url} && defined $args{api_url} && exists $args{api_key_json} && defined $args{api_key_json});
$args{sender} ||=
WWW::FCM::HTTP::V1::OAuth->new(
api_key_json => $args{api_key_json},
scopes => [$SCOPE_FIREBASE_MESSAGING],
);
bless { %args }, $class;
}
sub send {
my ($self, $con
::Result;
use Mojo::Base -base;
use Carp ();
use Mojo::Collection;
use Mojo::Promise;
use Mojo::JSON::Pointer;
use Scalar::Util ();
my $isa = sub { Scalar::Util::blessed($_[0]) && $_[0]->isa($_[1])
et = Mojo::JSON::Pointer->new($self->data)->get($path);
return $self->_get($target);
}
sub get_p {
my ($self, $path) = @_;
return $self unless defined $path;
my $target = Mojo::JSON::Pointer-
my $target = Mojo::JSON::Pointer->new($self->data)->get($path);
$target = Mojo::Collection->new(@$target)
if ref $target eq 'ARRAY';
return $target;
}
sub TO_JSON { shift->data }
sub _
e Dwarf::HTTP::Async;
use DateTime;
use DateTime::Format::HTTP;
use HTTP::Request::Common ();
use JSON;
use LWP::UserAgent;
use Data::Dumper;
use Dwarf::Accessor qw/
ua urls
key secret
access_toke
>on_error->('Line OAuth Error: Could not get access token.');
return;
}
my $decoded = decode_json $res->{_content};
my $access_token = $decoded->{access_token};
$self->access_token($access_tok
validate {
my ($self, $res) = @_;
my $content = eval { decode_json($res->decoded_content) };
if ($@) {
warn "Couldn't decode JSON: $@";
$content = $res->decoded_content;
}
# [todo]
# che
e Dwarf::HTTP::Async;
use DateTime;
use DateTime::Format::HTTP;
use HTTP::Request::Common ();
use JSON;
use LWP::UserAgent;
use Data::Dumper;
use Dwarf::Accessor qw/
ua urls
key secret
access_toke
n_error->('Amazon OAuth Error: Could not get access token.');
return;
}
my $decoded = decode_json $res->{_content};
my $access_token = $decoded->{access_token};
$self->access_token($access_tok
validate {
my ($self, $res) = @_;
my $content = eval { decode_json($res->decoded_content) };
if ($@) {
warn "Couldn't decode JSON: $@";
$content = $res->decoded_content;
}
# [todo]
# che
::Async;
use HTTP::Request::Common ();
use JSON;
use LWP::UserAgent;
use MIME::Base64 qw/decode_base64 encode_base64url/;
use Dwarf::Util qw/safe_decode_json encode_utf8/;
use Digest::SHA qw/hmac_sha2
$self->ua->post($uri);
my $content = eval { safe_decode_json(encode_utf8 $res->decoded_content) };
if ($@) {
warn "Couldn't decode JSON: $@";
$content = $res->decoded_content;
}
return $con
t get access token.');
return;
}
my $content = eval { decode_json $res->decoded_content };
if ($@) {
warn "Couldn't decode JSON: $@";
$content = $res->decoded_content;
}
$self->_validate_
e Dwarf::HTTP::Async;
use DateTime;
use DateTime::Format::HTTP;
use HTTP::Request::Common ();
use JSON;
use LWP::UserAgent;
use Dwarf::Accessor qw/
ua ua_async urls
key secret
access_token access_
hod = uc $method;
$params->{access_token} ||= $self->access_token;
$params->{format} ||= 'json';
my $base_url = $command =~ /^method\//
? $self->urls->{'old_api'}
: $self->urls->{'api'
validate {
my ($self, $res) = @_;
my $content = eval { decode_json($res->decoded_content) };
if ($@) {
warn "Couldn't decode JSON: $@";
$content = $res->decoded_content;
}
if ($res->code !~
e Dwarf::HTTP::Async;
use DateTime;
use DateTime::Format::HTTP;
use HTTP::Request::Common ();
use JSON;
use LWP::UserAgent;
use Dwarf::Accessor qw/
ua ua_async urls
key secret
access_token access_
ams);
my $res = $self->ua->post($uri);
$self->validate($res);
my $json = $res->content;
my $data = eval { decode_json($json) };
if ($@) {
warn $data;
}
$self->access_token($data->{access_t
ss_token} ||= $self->access_token;
my $uri = URI->new($self->urls->{'api'} . '/' . $command . '.json');
$uri->query_form(%{ $params }) if $method =~ /^(GET|DELETE)$/;
my %data = %{ $params };
i
if exists $payload->{aps}{badge};
# trim alert body
my $json = $self->json->encode($payload);
while (bytes::length($json) > $self->{max_payload_size}) {
if (ref $payload->{aps}{a
}
$json = $self->json->encode($payload);
}
my $command = $self->command;
if ($command == 0) {
$chunk = CORE::pack('C n/a* n/a*', $command, $device_token, $json);
}
('C L N n/a* n/a*',
$command, $extra->{identifier}, $extra->{expiry}, $device_token, $json,
);
}
else {
croak "command($command) not support. shuled be 0 or 1";
'Catmandu::Exporter';
has fields => (is => 'ro');
has handler => (is => 'rw', default => sub {'json'} , coerce => \&_coerce_handler );
sub _coerce_handler {
my ($handler) = @_;
return $handle
reaker format
=head1 SYNOPSIS
# Using the default breaker
$ catmandu convert JSON to Breaker < data.json
# Using a OAI_DC breaker
$ catmandu convert OAI --url http://biblio.ugent.be
r
# Convert the Breaker format by line into JSON
$ catmandu convert Breaker < data.breaker
# Convert the Breaker format by line into JSON using the fields file
$ catmandu convert Bre
YNOPSIS
# From the command line
# Using the default breaker
$ catmandu convert JSON to Breaker < data.json
# Break a OAI-PMH harvest
$ catmandu convert OAI --url http://biblio.ugent.be/oa
data-field><tab><metadata-value><tab><metadatavalue>...
For the default JSON breaker the input format is broken down into JSON-like Paths. E.g.
when give this YAML input:
---
name: John
nter for each record (or the content of the _id field when present).
The second column provides a JSON path to the data (with the array-paths translated to []).
The third column is the field value.
O
ct;
use warnings;
use 5.008_001;
our $VERSION = '0.14';
use parent 'Class::Accessor::Lite';
use JSON::XS;
use Carp qw(croak);
use File::Temp qw(tempfile);
use Socket qw(PF_INET SOCK_STREAM MSG_DONTW
e
cert
cert_type
key_file
key
key_type
read_timeout
write_timeout
json
]);
my %default = (
cert_type => Net::SSLeay::FILETYPE_PEM(),
key_type => Net::
gs();
Net::SSLeay::SSLeay_add_ssl_algorithms();
Net::SSLeay::randomize();
$args{json} ||= JSON::XS->new->utf8;
bless { %default, %args }, $class;
}
sub hostname {
my $self = shif
write it to a json-formatted file
my $msh2 = Bio::Sketch::Mash->new("all.msh");
$msh2->writeJson("all.json");
# Read the json file
my $mashJson = Bio::Sketch::Mash->new("all.json");
my $dist
= $msh2->dist($mashJson); # yields a zero distance
=head1 DESCRIPTION
This is a module to read mash files produced by the Mash executable. For more information on Mash, see L<mash.readthedocs.org>.
One object per set of files.
Arguments: Sketch filename (valid types/extensions are .msh, .json, .json.gz)
Hash of options (none so far)
Returns: Bio::Sketch::Mash object
=back