f completing argument element value)
_
schema => 'code*',
},
per_arg_json => {
summary => 'Will be passed to Perinci::Sub::GetArgs::Argv',
schema
m_meta(
meta => $meta,
common_opts => $copts,
per_arg_json => $args{per_arg_json},
per_arg_yaml => $args{per_arg_yaml},
ignore_converted_code => 1,
ing function arguments.
=item * B<meta>* => I<hash>
Rinci function metadata.
=item * B<per_arg_json> => I<bool>
Will be passed to Perinci::Sub::GetArgs::Argv.
=item * B<per_arg_yaml> => I<bool>
ssName Object Str Int Bool HashRef ArrayRef Maybe Optional);
use Type::Params qw( compile );
use JSON::MaybeXS 1.001000 ();
use HTTP::Request;
use LWP::UserAgent;
use HTTP::CookieJar::LWP;
use Data::
eck = compile(Object);
my ($self) = $check->(@_);
return $self->{'debug'};
}
#Convenient JSON-HTTP fetcher
sub _doRequest {
state $check = compile(
Object, Str,
Optional [
warn "$method " . $self->apiurl . "/$path" if $self->debug;
my $coder = JSON::MaybeXS->new;
#Data sent is JSON, and encoded per user preference
my $content =
$data
? Encode
base qw(Plack::Middleware);
use strict;
use warnings;
use English;
use Error::Pure qw(err);
use JSON::XS;
use LWP::Authen::OAuth2;
use Plack::Response;
use Plack::Session;
use Plack::Util::Accessor
ode' => $oauth2_code);
my $token_string_json = $session->get('oauth2.obj')->token_string;
my $token_string_hr = JSON::XS->new->decode($token_string_json);
$session->set('oauth2.token_string', $
redirect path.
No service provider.
=head1 DEPENDENCIES
L<English>,
L<Error::Pure>,
L<JSON::XS>,
L<LWP::Authen::OAuth2>,
L<Plack::Middleware>,
L<Plack::Response>,
L<Plack::Session>,
L<Plac
$pkg->meta;
}
# dzil also wants to get abstract for main module to put in dist's
# META.{yml,json}
sub before_build {
my $self = shift;
my $name = $self->zilla->name;
my $class = $n
inal_remote_address;
unless (exists $addresses{$remote_ip}) {
return $c->render(json => {'code' => 403, 'message' => qq{client address $remote_ip is forbidden}});
}
}
and decode URL encoded strings
=item * entity encode HTML
=item * build query strings
=item * JSON encode data structures
=back
=head1 INTERFACE
=over
=item C<< new >>
Create a new C<< HTML::
sub _json_encode_ref {
my ( $self, $seen, $obj ) = @_;
my $type = ref $obj;
if ( 'HASH' eq $type ) {
return '{' . join(
',',
map {
$self->_json_encode
. $self->_json_encode( $seen, $obj->{$_} )
} sort keys %$obj
) . '}';
}
elsif ( 'ARRAY' eq $type ) {
return
'['
. join( ',', map { $self->_json_encode( $s
# 16-04-21 - Properly implement live testing without real Stripe keys
#
use HTTP::Tiny;
use JSON::PP;
use Data::Dumper;
use strict;
use warnings;
our $VERSION = '1.3';
$VERSION = eval $
e {
my $content = $response->{'content'};
eval {
$content = decode_json($response->{'content'});
};
if ($@) {
$self->{'error'} = $content;
ntent;
if ($self->{'error'}) {
return $intent;
} else {
return decode_json($intent)->{'id'};
}
}
sub get_ids {
my ($self, %attrs) = @_;
$self->{'public
$headers ) {
$headers = [];
}
elsif ( not ref $headers ) {
require JSON::MaybeXS;
$headers = JSON::MaybeXS::decode_json $headers;
}
return $self->error( 500 ) if 'ARRAY' ne ref $headers;
thout
leading slash. The value of a key may be either an array reference or a string
containing a JSON encoding of an array. In either case it is taken to mean the
L<PSGI> header array for the resourc
gs FATAL => 'all';
use Net::Simplify;
use Net::Simplify::Constants;
use Net::Simplify::Jws;
use JSON;
use URI::Encode qw(uri_encode);
use REST::Client;
use Mozilla::CA;
use MIME::Base64 qw(encode_ba
$jws_payload = encode_json($params) if defined $params;
};
if ($@) {
croak(Net::Simplify::BadRequestException->new("Error encoding parameters as JSON: " . $@));
}
er_agent}";
}
my $headers = {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'User-Agent' => $user_agent
};
my $method;
my $payload
ss qw( file dir );
use Git::Wrapper;
use File::Temp qw( tempdir );
use File::chdir;
use JSON::PP qw( decode_json );
use URI;
use PerlX::Maybe qw( maybe );
use File::Copy::Recursive qw( rcopy );
use Fi
or fetching $uri";
say $res->{reason};
return 2;
}
$cache->{$cpanid} = decode_json($res->{content})
}
my $email = $cache->{$cpanid}->{email};
$email = $email->[0] if ref($em
dition of the library
=back
See C<Changes> file
=head1 DEPENDENCIES
L<Config::General>,
L<JSON>, L<JSON::XS>,
L<List::Util>,
L<MIME::Lite>,
L<Perl::OSType>,
L<Sys::Syslog>,
L<Term::ANSIColor>,
L<T
rnings FATAL => 'all';
use Time::HiRes qw(gettimeofday);
use Math::Random::Secure qw(irand);
use JSON;
use MIME::Base64 qw(decode_base64 decode_base64url encode_base64url);
use Crypt::Mac::HMAC qw( h
$token) {
$$header{$JWS_HDR_TOKEN} = $token;
}
my $p1 = encode_base64url(encode_json $header);
my $p2 = "";
$p2 = encode_base64url($payload) if defined $payload;
my $ms
::Simplify::IllegalArgumentException->new("Invalid JWS message"));
}
my $header = decode_json(decode_base64url($parts[0]));
_verify_header($header, $url, $auth->public_key);
if (!_v
se Scalar::Util;
use POSIX ();
use FileHandle ();
use Errno ();
use Fcntl ();
use Socket ();
use JSON::XS ();
my $title_image;
# should go to utility module
sub dir_is_movie($) {
-f "$_[0]/VIDEO
y $ffmpeg = qx{ffprobe -v quiet -show_format -of json -- \Q$path};
# ffmpeg doesn't properly encode json
$ffmpeg = eval { JSON::XS->new->latin1->decode ($ffmpeg) };
= qx{ffprobe -v quiet -show_streams -of json -- $ffmpeg_protocol:\Q$path};
# ffmpeg doesn't properly encode json
$ffmpeg = eval { JSON::XS->new->latin1->decode ($ffmpeg) };
;
$response_obj->code(HTTP_REQUEST_TIMEOUT);
$response_obj->body( encode_json({
timeout => 1,
other_info => {...},
}));
age JSONSchema::Validator::Constraints::Draft7;
# ABSTRACT: JSON Schema Draft7 specification constraints
use strict;
use warnings;
use JSONSchema::Validator::JSONPointer 'json_pointer';
use JSONSch
ema::Validator::Error 'error';
use JSONSchema::Validator::Util qw(is_type serialize unbool);
use parent 'JSONSchema::Validator::Constraints::Draft6';
sub if {
my ($self, $instance, $if, $schema,
return 1 unless exists $schema->{then};
my $then = $schema->{then};
my $spath = json_pointer->append($schema_path, 'then');
return $self->validator->_validate_schema($instanc
package JSONSchema::Validator::URIResolver;
# ABSTRACT: URI resolver
use strict;
use warnings;
use Carp 'croak';
use Scalar::Util 'weaken';
use URI;
use URI::Escape;
use Encode;
use JSONSchema::V
alidator::JSONPointer 'json_pointer';
use JSONSchema::Validator::Util qw(get_resource decode_content);
# what keys contain the schema? Required to find an $id in a schema
my $SEARCH_ID = {
value
;
my $pointer = json_pointer->new(
scope => $uri->as_string,
value => $schema,
validator => $self->validator
);
# try to use fragment as json pointer
$pointer
if ($ospec && $ospec eq 'format=s') {
complete_array_elem(array=>[qw/json text xml yaml/], word=>$word);
} else {
complete_user(word=>$word);
spec};
if ($ospec && $ospec eq 'format=s') {
complete_array_elem(array=>[qw/json text xml yaml/], word=>$word);
} else {
complete_user(word=>$word);
package JSONSchema::Validator::Format;
# ABSTRACT: Formats of JSON Schema specification
use strict;
use warnings;
use Time::Piece;
use Scalar::Util 'looks_like_number';
our @ISA = 'Exporter';
our
validate_int64
validate_float validate_double
validate_regex
validate_json_pointer validate_relative_json_pointer
validate_uri validate_uri_reference
validate_iri validate_iri_ref
m) >= 0;
return 1 if $sign < 0 && (($abs . '8') cmp $num) >= 0;
return 0;
}
sub validate_json_pointer {
# from rfc6901:
# CORE::state $pointer_regexp = do {
# my $escaped = qr
package JSONSchema::Validator::OAS30;
# ABSTRACT: Validator for OpenAPI Specification 3.0
use strict;
use warnings;
use Carp 'croak';
use JSONSchema::Validator::JSONPointer;
use JSONSchema::Validat
or::Error 'error';
use JSONSchema::Validator::Constraints::OAS30;
use JSONSchema::Validator::URIResolver;
use JSONSchema::Validator::Util 'json_decode';
use parent 'JSONSchema::Validator::Draft4';
u
deprecated} // 1;
$self->{validate_deprecated} = $validate_deprecated;
my $constraints = JSONSchema::Validator::Constraints::OAS30->new(validator => $self, strict => $params{strict} // 0);
package JSONSchema::Validator::Error;
# ABSTRACT: Error class
use strict;
use warnings;
use overload
'""' => sub { $_[0]->to_string },
fallback => 1;
our @ISA = 'Exporter';
our @EXPORT_OK
ng_list}) {
push @$res, "$msg: $err_str";
}
}
return $res;
}
sub TO_JSON {
my $self = shift;
my $res = {
message => $self->message
};
$res->{inst
ext} = [
map { $_->TO_JSON }
@{$self->context}
];
}
return $res;
}
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
JSONSchema::Validator::Error - Error c