= $self->_ua->post(
$url, $headers,
form => $post,
$cb ? sub { $self->$cb($_[1]->res->json || {error => $_[1]->error || 'Unknown error'}) } : (),
);
return $self if $cb; # non-bloc
king
my $res = $tx->error;
die $res->{message} || 'Unknown error' if $res;
$res = $tx->res->json;
die $res->{error} if $res->{error};
return $res;
}
sub _api_sign_request {
my ($self, $ar
ameters given
L</cloud_name>, L</api_key> and L</api_secret>. C<$res> in the callback
will be the json response from cloudinary:
{
url => $str,
secure_url => $str,
public_id =>
-dist.json>. This file gets copied into C<config/envui.json> for
normal usage during the C<perl Makefile.PL> stage. Edit this file to modify the
web application before runtime.
This is a C<JSON> file
eturns a JSON data structure which contains all the zone properties
my %zonecfg = %{$zone->getZoneProperties($zonename)};
=head2 setZoneProperties
applies the properties provided in a JSON data st
I
# PODNAME: Footprintless::Plugin::Atlassian::Confluence::RequestBuilder
use HTTP::Request;
use JSON;
use Log::Any;
my $logger = Log::Any->get_logger();
sub new {
return bless( {}, shift )->_i
self->_url( "/rest/api/content", %options ),
[ 'Content-Type' => 'application/json' ],
encode_json($content)
);
}
sub delete_content {
my ( $self, $id ) = @_;
return HTTP
->_url( "/rest/api/content/$id", %options ),
[ 'Content-Type' => 'application/json' ],
encode_json($content)
);
}
sub _url {
my ( $self, $path, %query_params ) = @_;
my $
e' => sub {
redirect $mojito->create_page(scalar params);
};
post '/preview' => sub {
to_json( $mojito->preview_page(scalar params) );
};
get '/page/:id' => sub {
return $mojito->view_pa
e=collection_${collection_id}.epub";
return $epub_doc;
};
post '/publish' => sub {
to_json( $mojito->publish_page(scalar params) );
};
get '/calendar/year/:year/month/:month' => sub {
- URL of notification.
# string settings - Http notification settings serialized to JSON (default None)
sub UpdateHttpNotification
{
shift;
my @params = [api
ey that gives you access to our SMTP and HTTP API's.
# ApiTypes::Campaign campaign - Json representation of a campaign
# Returns int
sub Add
{
shift;
ey that gives you access to our SMTP and HTTP API's.
# ApiTypes::Campaign campaign - Json representation of a campaign
# Returns int
sub Update
{
shift;
=> 'post',
response => '$mojito->publish_page($params)',
response_type => 'json',
status_code => 200,
},
{
name => 'CollectedPage',
direct ' . $message->{response};
}
elsif ( $message->{response_type} =~ m/json/i ) {
$response = 'to_json( ' . $message->{response} . ' )';
}
$response =~ s/\$params/scalar param
$message_response . ')';
}
elsif ( $message->{response_type} =~ m/json/i ) {
$response = '$self->render( json => $self' . $message_response . ' )';
}
my $place_holders;
my
рым полезным образом:
use DateTime;
use JSON;
my $now = DateTime->now;
print encode_json { time => ~~$now };
=head2 Дюймочервь на палке (Inc
}
require HTTP::Tiny;
$self->{_http} = HTTP::Tiny->new;
require JSON::XS;
$self->{_json} = JSON::XS->new;
require URI::Encode;
$self->{_urienc} = URI::Encode->new;
- $res->{reason}"
unless $res->{success};
my $decoded;
eval { $decoded = $self->{_json}->decode($res->{content}) };
die "Can't decode response from $url: $@" if $@;
log_trace(
045_200)),
};
log_trace("API POST request: %s", $form);
my $encoded_form = $self->{_json}->encode($form);
my $options = {
headers => {
"X-API-Token" => $self->{k
);
use Perinci::AccessUtil qw(insert_riap_stuffs_to_res);
use Data::Clean::JSON;
use Log::ger::Output;
use Log::ger::Util;
use Perinci::Result::Format 0.31;
use Scalar::Util qw(
sewhere (e.g.
# when doing access logging).
my $cleanser = Data::Clean::JSON->get_cleanser;
# to avoid sending colored YAML/JSON output
$Perinci::Result::Format::Enable_Decoration = 0;
sub prepare_a
my $fmt = $rreq->{fmt} // $env->{'periahs.default_fmt'} // 'json';
my $formatter;
for ($fmt, "json") { # fallback to json if unknown format
$formatter = $Perinci::Result::Format:
sha1);
use English qw{ -no_match_vars };
use Fcntl ':flock';
use File::HomeDir qw{ my_home };
use JSON;
use POSIX;
use URL::Encode qw{ url_encode };
use Text::QRCode;
use Term::ANSIColor;
use App::OA
ent
sub new {
my ( $class ) = @_;
my $self = {
'filename' => my_home() . '/.oath.json',
};
bless $self, $class;
return $self;
}
sub usage {
my ( $self ) = @_;
pri
PK3PXP\n\n";
print "--file filename\n";
print " filename for database, default ~/.oath.json\n\n";
print "--help\n";
print " show this help\n\n";
print "--init\n";
print "
max_args_len
max_resp_len
);
use JSON::MaybeXS;
use Plack::Util;
use POSIX;
use Scalar::Util qw(blessed);
use Time::HiRes qw(gettimeofd
r = "tcp:$env->{SERVER_PORT}";
}
state $json = JSON::MaybeXS->new->allow_nonref->allow_blessed->convert_blessed;
local *UNIVERSAL::TO_JSON = sub { "$_[0]" };
my $rreq = $env->{'riap.
y ($args_s, $args_len, $args_partial);
if ($rreq->{args} && !$skip_args) {
$args_s = $json->encode($rreq->{args});
$args_len = length($args_s);
$args_partial = $args_len >
s)
sub __parse_json {
require Data::Clean::FromJSON;
require JSON::MaybeXS;
my $str = shift;
state $json = JSON::MaybeXS->new->allow_nonref;
# to rid of those JSON::XS::Boolean
, or we use a fork of JSON::XS which doesn't
# produce those in the first place (probably only when performance is
# critical).
state $cleanser = Data::Clean::FromJSON->get_cleanser;
my $res;
eval { $res = $json->decode($str); $cleanser->clean_in_place($res) };
my $e = $@;
return (!$e, $e, $res);
}
sub __parse_yaml {
require YAML::Syck;
my $str = shift;
rict ;
use warnings ;
use Moo ;
use MooX::Types::MooseLike::Base qw/InstanceOf HashRef Str/ ;
use JSON ;
use Data::UUID ;
use Try::Tiny ;
use POSIX qw( strftime) ;
use Time::HiRes qw(gettimeofday tv_i
self->{debug} ) {
$self->_debug(
"ACTUAL QUERY: $query\nQUERY PARAMS: " . to_json( \@params ) ) ;
my $sql = _build_sql_stmt( $query, $p ) ;
$self->_debug( 'BUILT Q
$result{success} = 1 ;
$self->_debug(
'QUERY RESPONSE: ' . to_json( $result{rows} ) . "\n" ) ;
} else {
if ($rv) {
$result{row_c
Defaults are not suitable because they are just `MetaJSON` and `MetaYAML`.
"$name/Manifest::Write",
"$name/MetaJSON",
"$name/MetaYAML",
],
test, uses `Test::CPAN::Meta`, checks `META.yml`.
[ 'Test::CPAN::Meta::JSON' ], # Uses `Test::CPAN::Meta::JSON`.
[ 'Test::CPAN::Changes' ],
# Does not check that `Cha
[ 'MetaYAML' ], # Generate `META.yml`.
[ 'MetaJSON' ], # Generate `META.json`.
#
# Installer
#
$self->installer ? (
!^/api/(?<f>json|yaml|j|y)/
(?<uri>[^?/]+(?:/[^?/]+)?)!x,
sub {
my ($env, $m) = @_;
$env->{"riap.request"}{fmt} = $m->{f} =~ /j/ ? 'json' : 'yaml';
allowing format by sticking C<.json> or C<.yaml> at the end of
Riap URI:
enable "PeriAHS::ParseRequest"
match_uri => qr!^(?<uri>[^?/]+(?:/[^?/]+)?)(?:\.(?<fmt>json|yaml))!x;
=head2 I need even
jolicious::Lite;
use Mojito;
use Mojito::Auth;
use Mojito::Model::Config;
use Plack::Builder;
use JSON;
use Data::Dumper::Concise;
# Make a shortcut the the mojito app object
app->helper(
mojito
te_page( $_[0]->req->params->to_hash ) );
};
post '/preview' => sub {
$_[0]->render(
json => $_[0]->mojito->preview_page( $_[0]->req->params->to_hash ) );
};
get '/page/:id' => sub {
ender(data => $output);
};
post '/publish' => sub {
my ($self) = (shift);
$self->render( json => $self->mojito->publish_page($self->req->params->to_hash) );
};
get '/calendar/year/:year/mont
::Diff 0.93;
our @EXPORT_OK = qw(
diff
patch
);
=head1 NAME
Struct::Diff::MergePatch - JSON Merge Patch
(L<rfc7396|https://tools.ietf.org/html/rfc7396>) for perl structures
=begin html
<a
<http://search.cpan.org/dist/Struct-Diff-MergePatch/>
=back
=head1 SEE ALSO
L<Struct::Diff>, L<JSON::MergePatch>,
L<rfc7396|https://tools.ietf.org/html/rfc7396>
=head1 LICENSE AND COPYRIGHT
Copyr
se JSON::MaybeXS;
my $json = JSON::MaybeXS->new->allow_nonref;
sub errpage {
my ($env, $rres) = @_;
my $fmt = $env->{'riap.request'}{fmt} //
$env->{"periahs.default_fmt"} // 'json';
else {
$pres = [
200,
["Content-Type" => "application/json"],
[$json->encode($rres)]
];
}
log_trace("Returning error page: %s", $pres);
unction>) as an error
page PSGI response, either in HTML/JSON/plaintext (according to C<<
$env->{"riap.request"}{fmt} >>). Will default to JSON if C<fmt> is unsupported.
$env is PSGI environment.
=h
Confluence REST API
# PODNAME: Footprintless::Plugin::Atlassian::Confluence::ResponseParser
use JSON;
sub new {
return bless( {}, shift )->_init(@_);
}
sub create_content {
my ( $self, $ht
->is_success() ) {
$response{success} = 1;
$response{content} = $content ? decode_json($content) : '';
}
else {
$response{success} = 0;
$response{content} = $ht
se->code()
message => 'Success', # $http_response->message()
content => {} # decode_json($http_response->decoded_content())
};
=head1 CONSTRUCTORS
=head2 new()
Constructs a new res