: $mime=~/^text\/json/i ? "json"
: $mime=~/^application\/json/i ? "json"
: $mime=~/^v
^audio\/mpeg/i ? "mp3"
: $mime=~/^application\/json/i ? "json"
: "dat"
_post(
'https://file.' . $self->domain .'/cgi-bin/mmwebwx-bin/webwxuploadmedia?f=json',
{ json=>1,
Referer=>'https://' . $self->domain . '/',
ua_request_timeo
=> 1,
},
};
my $callback = sub {
my $json = shift;
$msg->_parse_send_status_data($json);
if(!$msg->is_success and $msg->ttl > 0){
$self->
);
}
$self->emit(send_message => $msg);
}
};
#Mojo::JSON::to_json will escape the slash charactor '/' into '\/'
#Weixin Server doesn't supported this fea
my $json = $self->to_json($post);
$json =~ s#__SLASH__#/#g;
# dirty work done
$self->http_post($self->gen_url($api,@query_string),{json=>1,'Content-Type'=>'application/json'},$json,$cal
gle::Ads::Common::Constants::VERSION};
use Crypt::OpenSSL::RSA;
use HTTP::Request;
use JSON::Parse qw(parse_json);
use LWP::UserAgent;
use MIME::Base64 qw(encode_base64 decode_base64);
use utf8;
use
itional_scopes> :default<>);
my %pem_file_of : ATTR(:name<pem_file> :default<>);
my %json_file_of : ATTR(:name<json_file> :default<>);
my %__crypt_module_of : ATTR(:name<__crypt_module> :default<>);
oAuth2ServiceAccountPEMFile}
|| $pem_file_of{$ident};
$json_file_of{$ident} = $properties->{oAuth2ServiceAccountJSONFile}
|| $json_file_of{$ident};
$additional_scopes_of{$ident} = $propert
;
my $json = $self->_rt_data_raw;
return if not $json;
require JSON::MaybeXS; JSON::MaybeXS->VERSION('1.001000');
my $all_data = JSON::MaybeXS->new(utf8 => 0)->decode($json);
ret
t.json');
return if not $data;
return $data;
}
sub _github_issue_count
{
my ($self, $owner_name, $repo_name) = @_;
$self->log_debug('fetching github issues data...');
my $json =
' . $repo_name);
return if not $json;
require JSON::MaybeXS; JSON::MaybeXS->VERSION('1.001000');
my $data = JSON::MaybeXS->new(utf8 => 0)->decode($json);
$data->{open_issues_count};
}
tion with allowed values
'o|output=?' => ['Use ARG as output format', 'values' => [qw(xml html json)]]
# One or more occurences of a value (result is ARRAYREF)
'i|input=s@' => 'Create resul
:Base64 qw( encode_base64url decode_base64url decode_base64 encode_base64 );
use HTTP::Tiny;
use JSON;
use Digest::SHA qw( sha256 );
use Carp;
my $USERAGENT = "Protocol::ACME v$VERSION";
my $NONCE_
=> "Failed to fetch the directory for $self->{host}", resp => $resp );
}
my $data = _decode_json( $resp->{content} );
if ( ! $self->{version} )
{
if ( exists $data->{'new-reg'} )
{
encode_json( $obj );
my $json = $self->_create_jws( $msg );
$self->{log}->debug( "Sending registration message" );
my $resp = $self->_request_post( $self->{links}->{'newAccount'}, $json );
package WebService::HIBP;
use strict;
use warnings;
use JSON();
use URI::Escape();
use LWP::UserAgent();
use Digest::SHA();
use Encode();
use HTTP::Status();
use Unicode::Normalize();
use WebService:
( $response->is_success() ) {
my $json = JSON::decode_json( $response->decoded_content() );
my @classes;
foreach my $class ( @{$json} ) {
push @classes, $class;
if ( $response->is_success() ) {
my $json = JSON::decode_json( $response->decoded_content() );
return WebService::HIBP::Breach->new( %{$json} );
}
elsif ( $response->code() ==
age::Passing::Output::Fluentd;
use Moo;
use namespace::autoclean;
use Try::Tiny;
use JSON::MaybeXS qw( decode_json );
use Message::Passing::Exception::Decoding;
with qw(
Message::Passing::Fluentd:
pp_log' });
sub consume {
my ($self, $msg) = @_;
$msg = try {
ref($msg) ? $msg : decode_json($msg)
} catch {
$self->error->consume(Message::Passing::Exception::Decoding->new(
exc
rely used for performance.
=item L<JSON> and L<JSON::XS>
One of these modules is required when you want to read or write JSON data
via L<AnyEvent::Handle>. L<JSON> is also written in pure-perl, but
can take
advantage of the ultra-high-speed L<JSON::XS> module when it is installed.
=item L<Net::SSLeay>
Implementing TLS/SSL in Perl is certainly interesting, but not very
worthwhile: If this modul
c-spec.yaml";
my $pm = "$Bin/../lib/App/AppSpec/Spec.pm";
my $yp = YAML::PP->new( schema => [qw/ JSON /] );
my $SPEC = $yp->load_file($specfile);
local $Data::Dumper::Sortkeys = 1;
local $Data::Dump
is about as fast as the octet string serialiser, but supports
complex data structures (similar to JSON) and is faster than any of the
other serialisers. If you have the L<CBOR::XS> module available, i
} }
)
=item C<$AnyEvent::Fork::RPC::JSON_SERIALISER> - uses L<JSON::XS> or L<JSON>
This serialiser creates JSON arrays - you have to make sure the L<JSON>
module is installed for this serialiser
to work. It can be beneficial for
sharing when you preload the L<JSON> module in a template process.
L<JSON> (with L<JSON::XS> installed) is slower than the octet string
serialiser, but usually much
bbix server.
=back
=cut
our $NOP = sub { };
my $json = eval { require JSON::XS; JSON::XS->new } || do { require JSON::PP; JSON::PP->new };
$json->utf8;
sub new {
my $class = shift;
my $sel
length $_[0]{rbuf}) {
delete $self->{hdl};
my $res = eval { $json->decode (substr $_[0]{rbuf}, 13) }
or return $fail->("protocol error");
$self->{on_clear}();
}
}
},
;
my $json = $json->encode ({
request => "sender data",
clock => int AE::now,
data =>
ot when the
underlying handle signals EOF.
=item json => L<JSON>, L<JSON::PP> or L<JSON::XS> object
This is the json coder object used by the C<json> read and write types.
If you don't supply it, t
nd use a
suitable one (on demand), which will write and expect UTF-8 encoded
JSON texts (either using L<JSON::XS> or L<JSON>). The written texts are
guaranteed not to contain any newline character.
F
originally
JSON was self-delimited, but Dougles Crockford thought it was a splendid
idea to redefine JSON incompatibly, so this is no longer true.
For protocols that used back-to-back JSON texts, thi
en you can do
I<formatted> I/O. For example, this would JSON-encode your data before
pushing it to the write queue:
$handle->push_write (json => [1, 2, 3]);
This pretty much summarises the write
n => 'JSON::PP', schema => [qw/ JSON /] );
my $spec = $yp->load_file($file);
return $self->validate_spec($spec);
}
sub validate_spec {
my ($self, $spec) = @_;
eval { require JSON::Val
}
or die "JSON::Validator is needed for validating a spec file";
my $json_validator = JSON::Validator->new;
$json_validator->schema($SCHEMA);
my @errors = $json_validator->validat
r - Formatter plugin for Map::Tube.
=head1 VERSION
Version 0.17
=cut
use 5.006;
use YAML;
use JSON qw();
use Map::Tube::Plugin::Formatter::Utils qw(xml get_data);
use Moo::Role;
use namespace::au
= $map->get_node_by_name('Baker Street');
print $node->to_xml, "\n\n";
print $node->to_json, "\n\n";
print $node->to_yaml, "\n\n";
print $node->to_string, "\n\n";
my $line
= $map->get_line_by_name('Metropolitan');
print $line->to_xml, "\n\n";
print $line->to_json, "\n\n";
print $line->to_yaml, "\n\n";
print $line->to_string, "\n\n";
my $route
iag"-like function to get debug output
our $DEBUG;
use Carp qw/carp croak/;
use Cpanel::JSON::XS qw/encode_json/;
use File::Temp qw//;
use File::Which qw/which/;
use List::Util qw/reduce any/;
use Te
_check_options) {
push @check_options, { key => $key, value => $value }
}
my $config = encode_json +{
CheckOptions => \@check_options,
Checks => $checks,
WarningsAsErrors => $errors,
};
m
rio->{summary};
}
# 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
MetaNoIndex>
#pod * L<GitHub::Meta|Dist::Zilla::Plugin::GitHub::Meta>
#pod * L<MetaJSON|Dist::Zilla::Plugin::MetaJSON>
#pod * L<MetaYAML|Dist::Zilla::Plugin::MetaYAML>
#pod * L<MetaProvides::Package|D
anifest|Dist::Zilla::Plugin::Test::DistManifest>
#pod * L<Test::CPAN::Meta::JSON|Dist::Zilla::Plugin::Test::CPAN::Meta::JSON>
#pod * L<MetaTests|Dist::Zilla::Plugin::MetaTests>
#pod * L<PodSyntaxTests
Zilla::Plugin::Test::DistManifest;
require Dist::Zilla::Plugin::Test::CPAN::Meta::JSON;
require Test::CPAN::Meta::JSON;
require Test::CPAN::Meta;
require Test::Pod::Coverage;
require Pod::Coverage::Tr
package Catmandu::Importer::getJSON;
our $VERSION = '0.52';
our $CACHE;
use Catmandu::Sane;
use Moo;
use JSON;
use Furl;
use Scalar::Util qw(blessed);
use URI::Template;
with 'Catmandu::Importer';
=> 'ro' );
has headers => (
is => 'ro',
default => sub { [ 'Accept' => 'application/json' ] }
);
has wait => ( is => 'ro' );
has cache => ( is => 'ro', trigger => 1 );
has client => (
d $_[0]->{$_} }
qw(timeout agent proxy),
);
}
);
has json => ( is => 'ro', default => sub { JSON->new->utf8(1) } );
has time => ( is => 'rw' );
has warn => ( is => 'ro', defa