use 5.010;
use strict;
use warnings;
use WWW::Challonge;
use Carp qw/carp croak/;
use JSON qw/to_json from_json/;
sub __is_kill;
sub __args_are_valid;
=head1 NAME
WWW::Challonge::Participant - A
e the PUT request:
my $response = $client->request(WWW::Challonge::__json_request(
"$HOST/tournaments/$url/participants/$id.json", "PUT", $params));
# Check for any errors:
WWW::Challonge::__han
he POST call:
my $response = $client->request(WWW::Challonge::__json_request(
"$HOST/tournaments/$url/participants/$id/check_in.json", "POST",
$params));
# Check for any errors:
WWW::Challonge
1 SYNOPSIS
This module came into existence out of the need to be able to send I<objects>
over JSON. JSON does not allow any blessed references to be sent by default and
if sent, provides no generic w
ay to resurrect these objects again after
decoding. This can now all be done like this:
use JSON;
use Class::Storage qw(packObjects unpackObjects);
my $object = bless { a => 1 }, 'MyModu
=> 1 }
print $writeHandle encode_json($packed), "\n";
# And on the other "side":
my $jsonString = <$readHandle>;
my $packed = decode_json($jsonString);
my $unpackedObject = unpa
package VK::App;
use strict;
use warnings;
use LWP;
use LWP::Protocol::https;
use JSON;
our $VERSION = 0.12;
sub new {
my ($class, %args) = @_;
die "USAGE:\nVK::App->new(api_id => .
rn $content if ($self->{format} eq "XML");
return $content if ($self->{format} eq "JSON");
return decode_json($content);
}
1;
__END__
#################### DOCUMENTATION ###############
l,groups,messages,offline',
# Data format that will receive as a result of requests 'JSON', 'XML' or 'Perl'.
# Perl object by default.
format => 'Perl',
);
.vmd.cookie", # Name of the file to restore cookies from and save cookies to
format => 'Perl', # JSON, XML or Perl. Perl by default
scope => 'friends,photos,audio,video,wall,groups,messages,offline'
VERSION
Version 0.01
=cut
our $VERSION = '0.02';
use Moo;
use LWP::UserAgent;
use JSON qw/to_json from_json/;
use Data::Dumper;
has sessionid => (
is => 'rw',
);
has csrftoken => (
is => '
eader( 'Content-Type' => 'application/json' );
# 必须加额外的这个垃圾头
$req->header( 'x-csrftoken' => $self->csrftoken );
$req->content( to_json( \%post ) );
my $res = $self->ua-
>request( $req );
if ( $res && $res->is_success ) {
my $json = from_json( $res->content );
# 输出数据
print_result( $json );
}
}
sub login {
my $self = shift;
my $uri = 'http
::Accessor);
use JSON;
__PACKAGE__->mk_accessors(qw/ sns arn /);
sub Publish
{
my ($self, $msg, $subj) = @_;
# XXX croak on invalid arn
my $structure = undef;
# support JSON payload
if (ref
($msg) eq 'HASH') {
$structure = 'json';
$msg = encode_json($msg);
}
my $r = $self->sns->dispatch({
'Action' => 'Publish',
'TopicArn' => $self->arn,
'Message' => $msg,
'MessageStru
e JSON;
__PACKAGE__->mk_accessors(qw/ sns arn /);
sub Publish
{
my ($self, $msg, $subj, $attr) = @_;
# XXX croak on invalid arn
my $structure = undef;
my $attributes = undef;
# support JSON
gz => 'application/x-gzip',
htm => 'text/html',
html => 'text/html',
json => 'application/json',
mp3 => 'audio/mpeg',
pdf => 'application/pdf',
ppt => 'application/vn
package POE::Filter::JSONMaybeXS;
our $AUTHORITY = 'cpan:GETTY';
# ABSTRACT: A POE filter using JSON::MaybeXS
$POE::Filter::JSONMaybeXS::VERSION = '0.002';
use Carp;
use JSON::MaybeXS;
use strict;
us
# BUFFER
JSON::MaybeXS->new( %opts ) # OBJ
], ref $class || $class );
}
sub get {
my ($self, $lines) = @_;
my $ret = [];
foreach my $json (@$lines) {
if ( my $data
= eval { ($self->[ OBJ ]->decode( $json )) } ) {
push( @$ret, $data );
} else {
warn "Couldn't convert json: $@";
}
}
return $ret;
}
sub get_one_start {
my ($self, $lines) =
rvice::Instapaper;
use 5.008001;
use strict;
use warnings;
use OAuth::Lite::Consumer;
use JSON qw(decode_json);
use Carp qw(croak);
our $VERSION = "0.02";
my $endpoint = "https://www.instapaper.com
$self, %params) = @_;
my $res = $self->request('POST', '/bookmarks/list', \%params);
@{decode_json($res->decoded_content)->{bookmarks}};
}
sub add_bookmark {
my ($self, $url, %params) = @_;
$
e/') ? $self->handle_save :
();
}
sub handle_test {
my ($self) = @_;
$self->read_json;
my $yaml = $self->{env}{post_data}{yaml};
my ($sec,$min,$hour,$mday,$mon,$year) = gmtime
day, $hour, $min, $sec,
),
};
$self->response_json($result);
}
sub handle_save {
my ($self) = @_;
$self->read_json;
my $yaml = $self->{env}{post_data}{yaml};
my $stamp
v}{post_data}{stamp};
io->file("data/$stamp.yaml")->assert->print($yaml);
$self->response_json({stamp => $stamp});
}
sub yaml_pm {
my ($self, $yaml) = @_;
return eval {
Data::
se strict;
our $VERSION = '0.05';
use Moose;
use CPAN::Patches::SPc;
use Carp;
use IO::Any;
use JSON::Util;
use YAML::Syck;
use File::chdir;
use Scalar::Util 'blessed';
use Module::Pluggable require
pec->catfile($path, 'META.yml');
my $json = File::Spec->catfile($path, 'META.json');
if (-f $json) {
my $meta = eval { JSON::Util->decode([$json]) };
return $meta
i
ile($yml) };
return $meta
if $meta;
}
croak 'failed to read META.(yml|json)';
}
sub read_meta_intrusive {
my $self = shift;
my $path = shift || '.';
my $build
= Lego::From::PNG->new({ filename => 'my_png.png' });
$object->process(view => 'JSON'); # Data is returned as JSON
=head1 DESCRIPTION
Base class for formatting data returned from processing a PNG
those bricks.
Argument : view => 'a view' - optionally format the return data. options include: JSON and HTML
Throws :
Comment :
See Also :
=head2 whitelist
Usage : ->whitelist()
P
package OIDC::Lite::Util::JWT;
use strict;
use warnings;
use JSON::XS qw/decode_json encode_json/;
use MIME::Base64 qw/encode_base64url decode_base64url/;
use constant {
JWT_ALG_LEN => 2,
JWT_ALG_ECDSA => q{ES},
};
=head1 NAME
OIDC::Lite::Util::JWT - JSON Web Token
=head1 SYNOPSIS
TBD
=head1 DESCRIPTION
JSON Web Token utility class.
=head1 METHODS
=head2 header( $jwt )
Ret
ayload_segment, $crypt_segment) = @$segments;
my $header;
eval {
$header = decode_json(decode_base64url($header_segment));
};
return if $@;
return $header;
}
=head2 payloa
age metadata:
=over 8
=item * content_type => $ct
This should be a MIME type like "application/json" or "text/plain". This is
exactly like an HTTP Content-Type header.
Note that RabbitMQ doesn't r
package WWW::Marvel::Client;
use strict;
use warnings;
use Carp;
use Digest::MD5;
use JSON;
use LWP::UserAgent;
use URI;
sub new {
my ($class, $args) = @_;
my $self = bless {}, $class;
for my $k (
i({ path => 'characters', params => \%p });
my $http_res = $self->get($uri);
return $self->_get_json_content($http_res);
}
sub get {
my ($self, $uri) = @_;
my $attempts_limit = 3;
my $http_res;
gest;
}
sub _get_json_content {
my ($self, $http_res) = @_;
my $content = $self->json->decode( $http_res->decoded_content );
return $content;
}
sub json { $_[0]->{_json} //= JSON->new()->allow_no
package Captcha::NocaptchaMailru;
use strict;
use warnings;
use LWP::UserAgent;
use JSON;
use URI::Escape;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(
nocaptcha_generate_captcha
sub _get_json_by_url {
my $agent = LWP::UserAgent->new();
my $resp = $agent->get($_[0]);
return 'request failed' unless $resp->is_success;
my $json = eval {
decode_json($resp->
decoded_content);
};
return 'JSON parsing failed' if $@;
return $json;
}
sub _pack_params {
my ($hash) = @_;
my @pairs;
for my $key (keys %$hash) {
push @pairs, join('
y' => (
is => 'rw',
isa => Maybe [ Str | InstanceOf ['Search::Query::Dialect'] ]
);
has 'json_query' => ( is => 'rw', isa => Str );
has 'title' => ( is => 'rw', isa => Maybe [Str], builder =>
=> 1, # include results
format => 'XML', # or JSON
b => 'AND', # or OR
);
print $response;
=head1 DESCRIPTION
Search
=item query
=item parsed_query
As returned by Search::Query.
=item json_query
Same as parsed_query, but the object tree is JSON encoded instead
of stringified.
=item author
=item pps
Pages-per-
onse::ExtJS;
use Moose;
use Carp;
extends 'Search::OpenSearch::Response::JSON';
use Types::Standard qw( HashRef Bool );
use JSON;
use Sort::SQL;
our $VERSION = '0.409';
has 'metaData' => ( is => 'rw
debug
? JSON->new->utf8->pretty(1)->encode($resp)
: encode_json($resp);
}
1;
__END__
=head1 NAME
Search::OpenSearch::Response::ExtJS - provide search results in JSON format for Ext
de results
t => 'ExtJS', # or JSON, XML
);
print $response;
=head1 DESCRIPTION
Search::OpenSearch::Response::ExtJS serializes to JSON suitable
for the ExtJS Javascript library.
=
f => 1, # include facets
format => 'XML', # or JSON
);
print $response;
=head1 DESCRIPTION
Search::OpenSearch is a framework for various backend