) >>
$ua->http_get('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Retrieves
>>
$ua->http_head('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Retrieves
$ua->http_post('http://example.com/api',
'{token:"my_json_token"}',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @
e splitpath updir );
use JSON qw(decode_json);
use List::MoreUtils qw( uniq );
use LWP::Simple qw( get );
use Time::Local ();
my $URL = 'https://www.gov.uk/bank-holidays.json';
my %CODE = (
'eng
get_dates( download_json() ) );
exit;
sub file {
return catfile( ( splitpath( realpath __FILE__ ) )[ 0, 1 ],
updir, qw(lib Date Holidays GB.pm) );
}
sub download_json {
my $content
s = get $URL or die "Can't download $URL";
return decode_json($contents);
}
sub get_dates {
my $data = shift;
my %holiday;
foreach my $region ( keys %{$data} ) {
foreach m
ss Finance::Dogecoin::Utils::ProxyActions {
use JSON;
use Path::Tiny;
use feature 'say';
field $rpc :param;
field $json :param;
field $addresses :param;
field $address_file :param;
sub BUILDARGS( $class, %args ) {
$args{json} //= JSON->new->utf8(1);
$args{address_file} = $args{address_file}
? path( $a
do {
if ($args{address_file} && $args{address_file}->exists) {
$args{json}->decode( $args{address_file}->slurp_utf8 );
}
else {
{}
e';
use JSON;
use Carp;
sub as_hashref {
my $self = shift;
return if !$self->is_success;
my $type = $self->header('Content-Type');
if ($type && $type =~ /\Aapplication\/json/) {
return JSON->new->utf8(1)->decode($self->content);
}
return;
}
1;
=encoding utf-8
=head1 NAME
Net::Azure::EventHubs::Response - A Response Class for Net::Azure::EventHubs
=head1 SYN
->new(GET => 'http://...');
$req->agent(LWP::UserAgent->new);
my $res = $req->do;
my $json_data = $res->as_hashref;
=head1 DESCRIPTION
Net::Azure::EventHubs::Response is a response class
warnings;
class Finance::Dogecoin::Utils::NodeRPC {
use Mojo::UserAgent;
use Mojo::JSON 'decode_json';
field $ua :param;
field $auth :param;
field $url :param;
sub BUILDA
word}";
} elsif ($args{user} && $args{auth_file}) {
my $auth = decode_json( $args{auth_file}->slurp_utf8 );
$args{password} = $auth->{$args{user}} if exists
)->userinfo( $auth ),
json => { jsonrpc => '1.0', id => 'Perl RPCAuth', method => $method, params => \@params }
)->res;
return $res->json if $res->is_success;
if
) >>
$ua->http_get('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Retrieves
>>
$ua->http_head('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Retrieves
$ua->http_post('http://example.com/api',
'{token:"my_json_token"}',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @
) >>
$ua->http_get('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Retrieves
>>
$ua->http_head('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Retrieves
$ua->http_post('http://example.com/api',
'{token:"my_json_token"}',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @
my $res = $ua->http_get('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
# ... handle the respo
y $res = $ua->http_head('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
})->get;
Retr
s = $ua->http_post('http://example.com/api',
'{token:"my_json_token"}',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @
trict;
use warnings;
use Net::Azure::EventHubs::Request;
use Net::Azure::Authorization::SAS;
use JSON;
use LWP::UserAgent;
use URI;
use Carp;
use Try::Tiny;
use Class::Accessor::Lite (
new => 0,
= LWP::UserAgent->new(agent => sprintf('%s/%s', $class, $VERSION));
$param{serializer} = JSON->new->utf8(1);
$param{api_version} ||= $DEFAULT_API_VERSION;
$param{timeout} ||= $DEF
$MARC::Moose::Parser::Marcedit::VERSION = '1.0.49';
use Moose;
extends 'MARC::Moose::Parser';
use JSON;
override 'parse' => sub {
my ($self, $raw) = @_;
return unless $raw;
my @fields;
) >>
$ua->http_get('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Retrieves
>>
$ua->http_head('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Retrieves
$ua->http_post('http://example.com/api',
'{token:"my_json_token"}',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @
) >>
$ua->http_get('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Retrieves
>>
$ua->http_head('http://example.com/',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @_;
...
});
Retrieves
$ua->http_post('http://example.com/api',
'{token:"my_json_token"}',
headers => {
'Accept' => 'text/json',
},
)->then(sub {
my( $body, $headers ) = @
included with the
distribution (C<share/generate_date_holidays_gb.pl>). This downloads the
latest JSON files from L<https://www.gov.uk/>, and could be used to
update/alter the package if necessary.
=
::Repository;
use warnings;
use strict;
use Carp;
use Git;
use File::Slurper qw(read_text);
use JSON;
use parent 'Test::Builder::Module'; # Included in Test::Simple
use version; our $VERSION = qv('
ivate> API method C<$method> (with the given C<$params>, where applicable) and returns either the JSON encoded result string or an error message (C<code> C<message>).
=back
=head1 DEPENDENCIES
=ove
k::Kraken;
use JSON;
my $kraken = new Finance::Bank::Kraken;
my $res = $kraken->call(Public, 'Ticker', ['pair=XLTCZEUR,XXBTZEUR']);
printf "1 XLTC is %f EUR\n",
from_json($res)->{'resul
unless $res =~ /^5/;
=head2 get XLTC account balance
use Finance::Bank::Kraken;
use JSON;
my $kraken = new Finance::Bank::Kraken;
$kraken->key("mysupersecretkey");
$kraken->secret("
$ct =~ s/;\s+.*//;
if( $ct eq '<%= $ct %>' ) {
# we only handle ndjson currently
my $handled_offset = 0;
$resp->on(progress => sub($msg,
lit /\n/, $fresh;
for (@lines) {
my $payload = decode_json( $_ );
$res->push(
% my $type = $info->{content}->{$ct}->{schema};
ct eq 'application/json' ) {
my $payload = $resp->json();
% } elsif( $ct eq 'application/x-ndjson' ) {
# code missing to hack up ndjson into hashes for a
d $uri;
my $ua = LWP::UserAgent->new();
$ua->default_header('Accept' => 'application/json');
$ua->default_header('Accept' => 'application/foo');
my $res = $ua->get($uri);
to get $uri: " . $res->status_line . $/) unless $res->is_success;
$keys = JSON::XS::decode_json($res->decoded_content);
}
my $data = decode_jwt(
token => $token,
$self->_cli_ar
package AnyEvent::I3;
# vim:ts=4:sw=4:expandtab
use strict;
use warnings;
use JSON::XS;
use AnyEvent::Handle;
use AnyEvent::Socket;
use AnyEvent;
use Encode;
use Scalar::Util qw(tainted);
use Carp;
defined($self->{callbacks}->{$type});
my $cb = $self->{callbacks}->{$type};
$cb->(decode_json $payload);
return if ($type & $event_mask) == $event_mask;
# If this was a one-time cal
tets
$payload = encode_utf8($content);
} else {
$payload = encode_json $content;
}
}
my $message = $magic . pack("LL", length($payload), $type) . $paylo
sed, it is handed off to
L<Data::Structure::Deserialize::Auto>, which attempts to parse a
YAML, JSON, TOML, or perl string value or filename of an existing, readable file
containing data in one of t
sed, it is handed off to
L<Data::Structure::Deserialize::Auto>, which attempts to parse a
YAML, JSON, TOML, or perl string value or filename of an existing, readable file
containing data in one of t
h->($ref);
}
my sub stringify_value($v) {
return 'undef' unless (defined($v));
return encode_json($v) if (ref($v));
return qq{"$v"} if (!looks_like_number($v));
return $v;
}
my sub re
Data::Printer colored => 1;
use XML::Simple;
use URI::Escape::XS qw/uri_escape uri_unescape/;
use JSON;
use URI;
use URI::QueryParam;
use Carp;
use Net::OAuth;
use Data::Random qw(rand_chars);
use Tim
Auth::PROTOCOL_VERSION_1_0A;
our $AUTOLOAD;
our %CONTENT_TYPE = (
json => 'application/json',
js => 'application/json',
xml => 'text/xml',
);
requires 'commands';
has 'live_url' =
l' => (
is => 'rw',
isa => 'Str',
);
has 'json' => (
is => 'rw',
isa => 'JSON',
default => sub {
my $js = JSON->new;
$js->utf8;
$js->allow_blesse