ask = {
'gcid' => "",
'cid' => '',
'filesize' => 0,
'ext_json' => { 'autoname' => 1 },
};
my $res = $self->url_resolve($url)->{'taskInfo'};
$task
ame && $task->{'name'} ne $filename ) {
$task->{'name'} = $filename;
$task->{'ext_json'}->{'autoname'} = 0;
}
return $task;
}
sub create_task {
my $self = shift;
my (
Nub::VERSION = '0.001';
use Moo;
use LWP::UserAgent;
use Carp qw( croak );
use HTTP::Request;
use JSON::MaybeXS;
use WWW::PubNub::Message;
has useragent => (
is => 'lazy',
);
sub _build_useragent
$response, $request ) = @_;
$request = $response->request unless $request;
my $data = decode_json($response->decoded_content);
my ( $raw_messages_arrayref, $timetoken, $channel ) = @{$data};
##########
#JSON Graph Specification file format methods #
#############################################################################
{
use JSON;
sub inp
}
my $json_text = $EMPTY_STRING;
open(my $infile, '<:encoding(UTF-8)', $filename) or croak "could not open '$filename'";
print {$verboseOutfile} "inputGraphfromJSON: opened '$file
y $line = <$infile>) {
$json_text .= $line;
}
close($infile);
my $graphHref = from_json( $json_text, {utf8 => 1} ) or croak "inputGraphfromJSON: invalid json text";
if (ref($gra
package Net::Nessus::REST;
use warnings;
use strict;
use Carp;
use LWP::UserAgent;
use JSON;
use List::Util qw(first);
use version; our $VERSION = version->declare('v0.7.0');
sub new {
my ($cl
query_form(%params);
my $response = $self->{agent}->get($url);
my $result = eval { from_json($response->content()) };
if ($response->is_success()) {
return $result;
} else {
;
my $response = $self->{agent}->delete($self->{url} . $path);
my $result = eval { from_json($response->content()) };
if ($response->is_success()) {
return $result;
} else {
se strict;
use warnings;
use constant {RC_TOO_MANY_REQUESTS => 429};
use Carp qw(confess);
use JSON;
use LWP::UserAgent;
use Moose;
use Moose::Util::TypeConstraints;
use WWW::LetsEncrypt::JWS;
use
lts to the
Let's Encrypt API URL, cannot be changed once the object has been created.
=item JWK
JSON Web Key object that implements both JWK and JWA (will be passed to
a JWS object). This is require
if ($processed_response->{error} || $rate_limited) {
my $err_ref;
try {
$err_ref = decode_json($Response->content());
} catch {
$err_ref->{message} = $Response->content();
$err_ref->{f
e Text::CSV::Flatten;
use v5.014;
use strict;
use warnings;
our $VERSION = '0.04';
use JSON qw/ encode_json /;
use Text::CSV;
my @KNOWN_ARGS= qw/ column_name /;
sub new {
my ($class, $pattern
} elsif($it->can('TO_JSON')) {
no warnings 'prototype'; # avoid "_foreach() called too early to check prototype"
_foreach($codeblock, $it->TO_JSON);
} else {
ror";
}
} else {
my $cell_value= ref $cur_data
? encode_json($cur_data)
: $cur_data;
my @column_tuple= @$column_name_prefix ? @$
Mojolicious::Plugin::Pingen;
use Mojo::Base 'Mojolicious::Plugin';
use Mojo::UserAgent;
use Mojo::JSON;
use POSIX qw(strftime);
use Mojo::Exception;
use constant DEBUG => $ENV{MOJO_PINGEN_DEBUG} || 0;
d2 pingen.document.upload
my $json = $c->pingen->document->upload($asset[,\%args]);
$c->pingen->document->upload($mojoUpload[,\%args], sub { my ($c, $json) = @_; });
Upload a L<Mojo::Uploa
DF file). Pingen will analyze the content of the pdf and figure out
how and where to mail it.
C<$json> is the response object from pingen.
C<%args> can contain the following optional parameters:
=
cache
key for a Moose metaclass. That's a nice approach when you know the incoming
hash is always JSON, but doesn't work as well when you can't predict the value
type (especially if the value is a cod
ib for Google OAuth 2.0
$Google::OAuth2::Client::Simple::VERSION = '0.004';
use Carp;
use Cpanel::JSON::XS;
use Furl;
use Moo;
use URI;
=head1 NAME
Google::OAuth2::Client::Simple - Client for Google
ype', 'application/x-www-form-urlencoded'],
content => \%params
);
return decode_json($response->decoded_content());
}
=head2 refresh_token($refresh_token)
For use when you require
ype', 'application/x-www-form-urlencoded'],
content => \%params
);
return decode_json($response->decoded_content());
}
=head2 revoke_token($access_token)
Revokes the access token on
;
use WebService::SOP::Auth::V1_1::Request::POST_JSON;
use WebService::SOP::Auth::V1_1::Request::PUT;
use WebService::SOP::Auth::V1_1::Request::PUT_JSON;
use WebService::SOP::Auth::V1_1::Util qw(is_si
UserAgent->new->request($req);
When making a POST request with JSON data to API:
my $req = $auth->create_request(
POST_JSON => 'http://<API_HOST>/path/to/endpoint' => {
hoge
w-form-urlencoded>.
=item C<POST_JSON>
For HTTP POST request to SOP endpoint with signature as request header
C<X-Sop-Sig> of request content type C<application/json>.
=item C<PUT>
For HTTP PUT re
actJSON;
use 5.010;
use strict;
use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(format_pretty);
our $VERSION = '0.12'; # VERSION
sub content_type { "application/json"
ata, $opts) = @_;
state $json;
$opts //= {};
if ($opts->{color} // $ENV{COLOR} // (-t STDOUT)) {
require JSON::Color;
JSON::Color::encode_json($data, {pretty=>0, linum=>0
});
} else {
if (!$json) {
require JSON::MaybeXS;
$json = JSON::MaybeXS->new->utf8->allow_nonref;
}
$json->encode($data);
}
}
1;
# ABSTRACT: Pr
>. The default serialization method is L<JSON>,
though one can specify any serialization format you want. L<YAML> and L<Storable> are
viable alternatives.
JSON was chosen as the default serialization
}
my $session_data = $session_object->$data_column;
# No way to check that it's valid JSON other than trying to deserialize it
my $session = try {
$self->_deserialize($session_
Dancer function, not from JSON.pm
return to_json({%$self}, { pretty => 0, convert_blessed => 1 });
}
# Default Deserialize method
sub _deserialize {
my ($self, $json) = @_;
my $settings
$WWW::LetsEncrypt::JWK::VERSION = '0.002';
use strict;
use warnings;
use Carp qw(confess);
use JSON;
use Moose::Role;
has 'key_type' => (
is => 'ro',
isa => 'Str',
required => 1,
);
ed together with WWW::LetsEncrypt::JWA as parents
will create a JSON Web Key that implements all of the functions needed for
signing JSON Web Signature objects. Specifically, this role deals with stor
blic Functions
=over 4
=item generate_new
This function, when implemented, should create a new JSON Web Key of a specific algorithm type.
Input
$number - key_length
$string - key id
Output
J
icroTemplate::_PerRequest';
}
1;
=head1 NAME
Catalyst::View::Text::MicroTemplate::PerRequest - JSON View that owns its data
=head1 SYNOPSIS
MyApp->inject_components(
'View::HTML' => {
;
}
sub endpoint :Chained(midpoint) Args(0) {
my ($self, $c) = @_;
$c->view('JSON')->created({
a => 1,
b => 2,
c => 3,
});
}
# template $HOM
tyle view that produces JSON is L<Catalyst::View::JSON::PerRequest>.
In fact this was written so that I could have a view that did HTML with an identical
interface as that JSON view, to make it easier
W::LetsEncrypt::Message::Directory;
$WWW::LetsEncrypt::Message::Directory::VERSION = '0.002';
use JSON;
use Moose;
extends 'WWW::LetsEncrypt::Message';
=pod
=head1 NAME
WWW::LetsEncrypt::Message::
if ($Response->code() == 200) {
my $json_data = decode_json($Response->content());
return {
successful => 1,
finished => 1,
directory => $json_data,
};
}
return {
successful =>
tion;
$WWW::LetsEncrypt::Message::Registration::VERSION = '0.002';
use strict;
use warnings;
use JSON;
use HTTP::Request;
use HTTP::Status qw(RC_CREATED RC_ACCEPTED RC_FORBIDDEN RC_CONFLICT);
use Moo
REATED) {
$self->_step('update') if $self->_step() eq 'new-reg';
my $server_response = decode_json($Response->content);
my $resp_ref = {%$server_response};
$resp_ref->{successful} = 1;
retu
l => 1,
finished => 1,
};
} elsif ($status_code == RC_FORBIDDEN) {
my $err_ref = decode_json($Response->content);
if ($err_ref->{type} =~ m/unauthorized$/
&& $err_ref->{detail} =~ m/^No
use Log::Defer;
use JSON::XS; ## or whatever
use Try::Tiny;
sub my_logger_function {
my $msg = shift;
my $encoded_msg = try {
JSON::XS->new->pretty(1)->encod
e($msg)
}
catch {
"Failed to JSON encode msg : $_"
};
print $encoded_msg; ## usually you'd append this to a file
}
my $logger = Log::Defer->new({
isualisation tool L<log-defer-viz> only support JSON at this time.
The currently recommended format to store logs in is newline-separated, minified JSON. The newline+minification is useful because it
(confess);
use Digest::SHA;
use HTTP::Request;
use HTTP::Status qw(RC_CREATED RC_FORBIDDEN);
use JSON;
use MIME::Base64 qw(encode_base64url);
use Moose;
use Moose::Util::TypeConstraints;
extends qw(
esponse) = @_;
my $output_ref;
if ($Response->code == RC_CREATED) {
my $response_ref = decode_json($Response->content);
if ($response_ref->{status} eq 'pending') {
my ($challenge_ref) = grep
return {error => 1};
}
} elsif ($Response->code == RC_FORBIDDEN) {
my $response_ref = decode_json($Response->content);
if ($response_ref->{type} eq 'urn:acme:error:unauthorized') {
if ($resp
rtificate::VERSION = '0.002';
use HTTP::Status qw(RC_OK RC_CREATED RC_ACCEPTED RC_FORBIDDEN);
use JSON;
use Moose;
extends 'WWW::LetsEncrypt::Message';
=pod
=head1 NAME
WWW::LetsEncrypt::Message::
qw(encode_base64url decode_base64url);
use Crypt::OpenSSL::Bignum;
use Crypt::OpenSSL::RSA;
use JSON;
use Moose;
with qw(WWW::LetsEncrypt::JWK WWW::LetsEncrypt::JWA);
sub generate_new {
my ($key_
thumbprint {
my ($self) = @_;
# RFC requires the keys to be sorted lexically.
my $JSON = JSON->new();
$JSON->canonical(1);
my %pubkey = $self->_get_public_key_components();
$pubkey{kty} = 'RS
f !$hash_method;
my $jsonified_sorted_pk = $JSON->encode(\%pubkey);
my $digested_jsonified_pk = $hash_method->($jsonified_sorted_pk);
return encode_base64url($digested_jsonified_pk);
}
sub _get