view release on metacpan or search on metacpan
lib/API/Docker/API/Images.pm view on Meta::CPAN
$params{networkmode} = $opts{networkmode} if defined $opts{networkmode};
$params{platform} = $opts{platform} if defined $opts{platform};
$params{target} = $opts{target} if defined $opts{target};
if ($opts{buildargs}) {
require JSON::MaybeXS;
$params{buildargs} = JSON::MaybeXS::encode_json($opts{buildargs});
}
if ($opts{labels}) {
require JSON::MaybeXS;
$params{labels} = JSON::MaybeXS::encode_json($opts{labels});
}
my $raw = ref $context eq 'SCALAR' ? $$context : $context;
return $self->client->_request('POST', '/build',
lib/API/Docker/API/Images.pm view on Meta::CPAN
sub _build_registry_auth_header {
my ($auth) = @_;
# The Docker Engine requires an X-Registry-Auth header on every push,
# even for anonymous attempts. Encoding is base64url of a JSON object.
require JSON::MaybeXS;
require MIME::Base64;
my $payload;
if (!defined $auth) {
$payload = '{}';
}
elsif (ref $auth eq 'HASH') {
$payload = JSON::MaybeXS::encode_json($auth);
}
else {
# Already pre-built JSON or pre-encoded string. If it looks base64-like
# (no braces), pass through; otherwise encode as-is.
return $auth if $auth =~ /^[A-Za-z0-9+\/=_\-]+$/;
$payload = $auth;
}
lib/API/Docker/API/Images.pm view on Meta::CPAN
The Docker Engine requires an C<X-Registry-Auth> header on every push,
even for anonymous attempts; the header is always sent. Pass C<auth> as
a hashref of credentials (typical keys: C<username>, C<password>,
C<serveraddress>, or C<identitytoken>), or as a pre-encoded base64 string.
Without C<auth> the header carries an empty JSON object.
=head2 tag
$images->tag('nginx:latest', repo => 'myrepo/nginx', tag => 'v1');
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Drip/Request.pm view on Meta::CPAN
use File::HomeDir;
use Readonly;
use Carp;
use LWP::UserAgent;
use HTTP::Request::Common;
use JSON;
use URI;
use Data::Printer;
Readonly our %DEFAULTS => (
DRIP_TOKEN => undef,
lib/API/Drip/Request.pm view on Meta::CPAN
$self->{debugger}->("Success, no content");
return undef;
}
my $decoded = eval {decode_json( $result->content )};
if ( $@ ) {
$self->{debugger}->('Failed to decode JSON:', $@, $result->content);
die $result;
}
return $decoded;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Eulerian/EDW/Authority.pm view on Meta::CPAN
$status = API::Eulerian::EDW::Request->get( $status->{ url } );
# Get HTTP response
$response = $status->{ response };
# Get HTTP response code
$code = $response->code;
# We expect JSON reply data
$json = API::Eulerian::EDW::Request->json( $response );
if( $json && ( $code == 200 ) ) {
$status = $json->{ error } ?
$class->_error( $code, $json->{ error_msg } ) :
$class->_success( $kind, $json );
view all matches for this distribution
view release on metacpan or search on metacpan
"web" : "https://git.spwhitton.name/p5-API-GitForge"
}
},
"version" : "0.007",
"x_generated_by_perl" : "v5.32.1",
"x_serialization_backend" : "Cpanel::JSON::XS version 4.25",
"x_spdx_expression" : "GPL-3.0-only"
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Google.pm view on Meta::CPAN
use strict;
use warnings;
use Mojo::UserAgent;
use Config::JSON;
use Data::Dumper;
sub new {
my ($class, $params) = @_;
my $h = {};
if ($params->{tokensfile}) {
$h->{tokensfile} = Config::JSON->new($params->{tokensfile});
} else {
die 'no json file specified!';
}
$h->{ua} = Mojo::UserAgent->new();
$h->{debug} = $params->{debug};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Handle.pm view on Meta::CPAN
#has _util # TODO factor all the _methods to $self->util->methods... or not
has _json => (
is => 'rw'
, isa => 'JSON::XS'
, lazy => 1
, required => 1
, default => sub {
require JSON::XS;
return JSON::XS->new->utf8->ascii->relaxed;
}
);
has _xml => (
is => 'rw'
lib/API/Handle.pm view on Meta::CPAN
)
) {
$self->_tied( ref => \%args, key => 'content', tied => 1 );
}
# Leave it up to the API implementation to encode the hash/array ref into JSON / Form data / XML / etc.
$req->content( $args{content} ) if defined $args{content};
$req->method( $args{method} ) if defined $args{method};
$req->uri( $args{uri} );
my $res = $self->ua->request( $req );
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/INSEE/Sirene.pm view on Meta::CPAN
use strict;
use warnings;
use Carp 'croak';
use JSON;
use HTTP::Request::Common qw/ GET POST /;
use HTTP::Status ':constants';
use List::Util 'any';
use LWP::UserAgent;
use POSIX 'strftime';
lib/API/INSEE/Sirene.pm view on Meta::CPAN
=over 4
=item * L<< Carp|https://perldoc.perl.org/Carp >>
=item * L<< JSON|https://metacpan.org/pod/JSON >>
=item * L<< List::Util|https://perldoc.perl.org/List::Util >>
=item * L<< HTTP::Request::Common|https://metacpan.org/pod/HTTP::Request::Common >>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Instagram.pm view on Meta::CPAN
use strict;
use warnings;
use Digest::MD5 'md5_hex';
use URI;
use JSON;
use Furl;
use API::Instagram::User;
use API::Instagram::Location;
use API::Instagram::Tag;
view all matches for this distribution
view release on metacpan or search on metacpan
API/Intis/lib/API/Intis.pm view on Meta::CPAN
package API::Intis::APIGrab;
use YAML::Tiny;
use WWW::Mechanize;
use Crypt::SSLeay;
use Digest::Perl::MD5 'md5_hex';
use JSON;
use error_codes;
sub readConfig {
my $conf = YAML::Tiny->read( 'config.yaml' );
API/Intis/lib/API/Intis.pm view on Meta::CPAN
};
return (request_json => $request_json, error => \@error, request_xml => $request_xml, request_object => \%{$r}, out_format => !defined $output_format ? 'json' : $output_format );
};
package API::Intis::APIRequest;
use JSON;
sub new {
my($class, $method, $other_params) = @_;
my %request_params;
if (defined $other_params) {
%request_params = &API::Intis::APIGrab::connect($method, $other_params);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/MailboxOrg/APIBase.pm view on Meta::CPAN
=over 4
=item * json_rpc
I<(optional)> The version of JSON-RPC used. Defaults to C<2.0>.
=item * api
I<mandatory> An L<API::MailboxOrg> object.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Mathpix.pm view on Meta::CPAN
package API::Mathpix;
use Moose;
use JSON::PP;
use LWP::UserAgent;
use HTTP::Request;
use MIME::Base64;
use Algorithm::LeakyBucket;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Medium.pm view on Meta::CPAN
our $VERSION = '0.902'; # VERSION
use Moose;
use HTTP::Tiny;
use Log::Any qw($log);
use JSON::MaybeXS;
use Module::Runtime 'use_module';
has 'server' => (
isa => 'Str',
is => 'ro',
view all matches for this distribution
view release on metacpan or search on metacpan
t/promises.t
t/query.t
t/response.t
t/sentence.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/Octopart.pm view on Meta::CPAN
use 5.010;
use strict;
use warnings;
use JSON;
use LWP::UserAgent;
use Digest::MD5 qw(md5_hex);
use Data::Dumper;
lib/API/Octopart.pm view on Meta::CPAN
User Agent debugging. This is very verbose and provides API communication details.
=item * json_debug => 1
JSON response debugging. This is very verbose and dumps the Octopart response
in JSON.
=back
=cut
lib/API/Octopart.pm view on Meta::CPAN
}
=item * $o->octo_query($q) - Queries the Octopart API
Return the JSON response structure as a perl ARRAY/HASH given a query meeting Octopart's
API specification.
=cut
sub octo_query
lib/API/Octopart.pm view on Meta::CPAN
return $self->{api_queries};
}
=item * $o->query_part_detail($part)
Return the JSON response structure as a perl ARRAY/HASH given a part search term
shown as "$part". This function calls $o->octo_query() with a query from Octopart's
"Basic Example" so you can easily lookup a specific part number. The has_stock()
and get_part_stock_detail() methods use this query internally.
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/ParallelsWPB.pm view on Meta::CPAN
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request;
use JSON::XS;
use Carp;
use API::ParallelsWPB::Response;
use base qw/ API::ParallelsWPB::Requests /;
lib/API/ParallelsWPB.pm view on Meta::CPAN
sub _json {
my ( $self ) = @_;
unless( $self->{_json} ) {
$self->{_json} = JSON::XS->new;
}
return $self->{_json};
}
1;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/API/PureStorage.pm view on Meta::CPAN
package API::PureStorage;
use Data::Dumper;
use REST::Client;
use JSON;
use Net::SSL;
use warnings;
use strict;
view all matches for this distribution
view release on metacpan or search on metacpan
Makefile.PL
MANIFEST This list of files
README.md
t/01-test.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/APISchema/Generator/Markdown/Formatter.pm view on Meta::CPAN
our @EXPORT = qw(type json pretty_json code restriction desc anchor method methods content_type http_status http_status_code);
# cpan
use HTTP::Status qw(status_message);
use URI::Escape qw(uri_escape_utf8);
use JSON::XS ();
my $JSON = JSON::XS->new->canonical(1);
use constant +{
RESTRICTIONS => [qw(required max_items min_items max_length min_length maximum minimum pattern)],
SHORT_DESCRIPTION_LENGTH => 100,
};
lib/APISchema/Generator/Markdown/Formatter.pm view on Meta::CPAN
$x = 'true';
} elsif ($$x eq 0) {
$x = 'false';
}
} elsif (ref $x) {
$x = $JSON->encode($x);
} else {
$x = $JSON->encode([$x]);
$x =~ s/^\[(.*)\]$/$1/;
}
return $x;
}
my $PRETTY_JSON = JSON::XS->new->canonical(1)->indent(1)->pretty(1);
sub pretty_json ($) {
my $x = shift;
if (ref $x) {
$x = $PRETTY_JSON->encode($x);
} else {
$x = $PRETTY_JSON->encode([$x]);
$x =~ s/^\[\s*(.*)\s*\]\n$/$1/;
}
return $x;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/APNS/Agent.pm view on Meta::CPAN
our $VERSION = "0.06";
use AnyEvent::APNS;
use Cache::LRU;
use Encode qw/decode_utf8/;
use JSON::XS;
use Log::Minimal;
use Plack::Request;
use Router::Boom::Method;
use Class::Accessor::Lite::Lazy 0.03 (
lib/APNS/Agent.pm view on Meta::CPAN
my $token = $req->param('token') or return [400, [], ['Bad Request']];
my $payload;
if (my $payload_json = $req->param('payload') ) {
state $json_driver = JSON::XS->new->utf8;
local $@;
$payload = eval { $json_driver->decode($payload_json) };
return [400, [], ['BAD REQUEST']] if $@;
}
elsif (my $alert = $req->param('alert')) {
lib/APNS/Agent.pm view on Meta::CPAN
device token by HEX format. (Required)
=item C<payload>
JSON string for push notification. If you only want to send message, alternatively can use
C<alert> parameter.
One of C<payload> and C<alert> must be supplied. Both of C<payload> and C<alert> are specified,
the C<payload> parameter has priority.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Metadata.pm view on Meta::CPAN
}
sub write_mymeta_json {
my $self = shift;
# We need JSON to write the MYMETA.json file
unless ( eval { require JSON; 1; } ) {
return 1;
}
# Generate the data
my $meta = $self->_write_mymeta_data or return 1;
# Save as the MYMETA.yml file
print "Writing MYMETA.json\n";
Module::Install::_write(
'MYMETA.json',
JSON->new->pretty(1)->canonical->encode($meta),
);
}
sub _write_mymeta_data {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
[@Basic]
[PkgVersion]
[PodVersion]
[MetaJSON]
[GithubMeta]
remote = github
[AutoPrereqs]
[MinimumPerl]
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ARGV/JSON.pm view on Meta::CPAN
package ARGV::JSON;
use 5.008005;
use strict;
use warnings;
use JSON;
our $VERSION = '0.01';
our $JSON = JSON->new->utf8;
our @Data;
sub import {
local $/;
while (local $_ = <>) {
$JSON->incr_parse($_);
while (my $datum = $JSON->incr_parse) {
push @Data, $datum;
}
}
tie *ARGV, 'ARGV::JSON::Handle';
}
package
ARGV::JSON::Handle;
use Tie::Handle;
use parent -norequire => 'Tie::StdHandle';
sub READLINE {
if (wantarray) {
return splice @ARGV::JSON::Data;
} else {
return shift @ARGV::JSON::Data;
}
}
1;
lib/ARGV/JSON.pm view on Meta::CPAN
=encoding utf-8
=head1 NAME
ARGV::JSON - Parses @ARGV for accessing JSON via C<< <> >>
=head1 SYNOPSIS
use ARGV::JSON;
while (<>) {
# $_ is a decoded JSON here!
}
Or in one-liner:
perl -MARGV::JSON -anal -E 'say $_->{foo}->{bar}' a.json b.json
=head1 DESCRIPTION
ARGV::JSON parses each input from C<< @ARGV >> and enables to access
the JSON data structures via C<< <> >>.
Each C<< readline >> call to C<< <> >> (or C<< <ARGV> >>) returns a
hashref or arrayref or something that the input serializes in the
JSON format.
=head1 SEE ALSO
L<ARGV::URL>.
view all matches for this distribution
view release on metacpan or search on metacpan
xt/changes.t
xt/manifest.t
xt/pod-coverage.t
xt/pod.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ARGV/Struct.pm view on Meta::CPAN
I've had to use some command-line utilities that had to do creative stuff to transmit
deeply nested arguments, or datastructure-like information. Here are some strategies that
I've found over time:
=head2 Complex arguments codified as JSON
JSON is horrible for the command line because you have to escape the quotes. It's a nightmare.
command --complex_arg "{\"key1\":\"value1\",\"key2\":\"value2\"}"
=head2 Arguments encoded via some custom scheme
lib/ARGV/Struct.pm view on Meta::CPAN
The source code and issues are on https://github.com/pplu/ARGV-Struct
=head1 THANKS
Matt S. Trout for suggesting that ARGV::Struct syntax be JSONY compatible
=head1 AUTHOR
Jose Luis Martinez
CPAN ID: JLMARTIN
view all matches for this distribution
view release on metacpan or search on metacpan
[PkgVersion]
[GithubMeta]
remote = github
[MetaJSON]
[MinimumPerl]
[Prereqs]
LWP = 5
view all matches for this distribution
view release on metacpan or search on metacpan
t/config.cache
t/manifest.t
t/pod-coverage.t
t/pod.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
lib/ASP4.pm view on Meta::CPAN
Call C<< $Session->reset() >> to clear all the data out of the session and save
it to the database.
=head2 $Config
The ASP4 C<$Config> object is stored in a simple JSON format on disk, and accessible
everywhere within your entire ASP4 application as the global C<$Config> object.
If ever you find yourself in a place without a C<$Config> object, you can get one
like this:
view all matches for this distribution
view release on metacpan or search on metacpan
t/010-basic/020-basic.t view on Meta::CPAN
use strict;
use warnings 'all';
use Test::More 'no_plan';
use ASP4::API;
use JSON::XS;
my $api; BEGIN { $api = ASP4::API->new }
use_ok('ASP4x::Linker');
BLANK: {
ok( my $res = $api->ua->get('/'), "GET /" );
ok( my $info = decode_json($res->content), "JSON is good" );
is_deeply $info, [
{
"widgetA" => {
"page_size" => undef,
"sort_col" => undef,
t/010-basic/020-basic.t view on Meta::CPAN
], "Data structure looks right";
};
T1: {
ok( my $res = $api->ua->get('/?widgetA.page_size=1&widgetB.page_size=2&widgetC.color=red&widgetD.size=large'), "GET /" );
ok( my $info = decode_json($res->content), "JSON is good" );
is_deeply $info, [
{
"widgetA" => {
"page_size" => 1,
"sort_col" => undef,
t/010-basic/020-basic.t view on Meta::CPAN
], "Data structure looks right";
};
T2: {
ok( my $res = $api->ua->get('/?widgetA.page_size=20&widgetA.page_number=40&widgetA.sort_col=name&widgetA.sort_dir=DESC&widgetB.page_size=10&widgetB.page_number=100&widgetB.sort_col=date&widgetB.sort_dir=ASC&widgetC.color=red&widgetC.type=shirt&widg...
ok( my $info = decode_json($res->content), "JSON is good" );
is_deeply $info, [
{
"widgetA" => {
"page_size" => 20,
"sort_col" => 'name',
view all matches for this distribution
view release on metacpan or search on metacpan
t/pod.t
TODO
typemap
xt/boilerplate.t
META.yml Module YAML meta-data (added by MakeMaker)
META.json Module JSON meta-data (added by MakeMaker)
view all matches for this distribution
view release on metacpan or search on metacpan
"web" : "https://github.com/tehmoth/AWS-ARN"
},
"x_IRC" : "irc://irc.styxnet.tech/#perl"
},
"version" : "0.007",
"x_serialization_backend" : "JSON::PP version 4.02",
"x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later"
}
view all matches for this distribution