ndef)
=item * L<JPL::Class> (undef)
=item * L<JPL::Compile> (undef)
=item * L<JSON::PP> (2.27300_01)
=item * L<JSON::PP::Boolean> (undef)
=item * L<List::Util> (1.42_02)
=item * L<List::Util::PP
(undef)
=item * L<JPL::Class> (undef)
=item * L<JPL::Compile> (undef)
=item * L<JSON::PP> (2.94)
=item * L<JSON::PP::Boolean> (2.94)
=item * L<List::Util> (1.48)
=item * L<List::Util::PP> (unde
(undef)
=item * L<JPL::Class> (undef)
=item * L<JPL::Compile> (undef)
=item * L<JSON::PP> (2.97001)
=item * L<JSON::PP::Boolean> (2.97001)
=item * L<List::Util> (1.49)
=item * L<List::Util::PP>
(undef)
=item * L<JPL::Class> (undef)
=item * L<JPL::Compile> (undef)
=item * L<JSON::PP> (2.27200)
=item * L<JSON::PP::Boolean> (undef)
=item * L<List::Util> (1.23)
=item * L<List::Util::PP> (1
(undef)
=item * L<JPL::Class> (undef)
=item * L<JPL::Compile> (undef)
=item * L<JSON::PP> (2.97001)
=item * L<JSON::PP::Boolean> (2.97001)
=item * L<List::Util> (1.50)
=item * L<List::Util::PP>
(undef)
=item * L<JPL::Class> (undef)
=item * L<JPL::Compile> (undef)
=item * L<JSON::PP> (2.97000)
=item * L<JSON::PP::Boolean> (2.97000)
=item * L<List::Util> (1.49)
=item * L<List::Util::PP>
(undef)
=item * L<JPL::Class> (undef)
=item * L<JPL::Compile> (undef)
=item * L<JSON::PP> (2.27105)
=item * L<JSON::PP::Boolean> (undef)
=item * L<List::Util> (1.23)
=item * L<List::Util::PP> (1
(undef)
=item * L<JPL::Class> (undef)
=item * L<JPL::Compile> (undef)
=item * L<JSON::PP> (2.97001)
=item * L<JSON::PP::Boolean> (2.97001)
=item * L<List::Util> (1.50)
=item * L<List::Util::PP>
(undef)
=item * L<JPL::Class> (undef)
=item * L<JPL::Compile> (undef)
=item * L<JSON::PP> (undef)
=item * L<JSON::PP::Boolean> (undef)
=item * L<List::Util> (1.14)
=item * L<List::Util::PP> (un
::AccessToken::Response::VERSION = '1.1205';
use Moo;
use URI;
use URI::QueryParam;
use Ouch;
use JSON;
has response => (
is => 'ro',
required=> 1,
);
has token => (
is => 'ro'
sponse->content =~ m/\A { .+ } \z/xm) {
# From v2.3 they return JSON object.
return JSON->new->decode($response->content)->{access_token};
}
els
sponse->content =~ m/\A { .+ } \z/xm) {
# From v2.3 they return JSON object.
return JSON->new->decode($response->content)->{expires_in};
}
else
irectly in the code. This is a terrible practice. Instead use a config file system like L<Config::JSON> to store your settings.
=head2 Assumptions
This recipe assumes that you know and have L<Plack>
'user')
->limit_results(10)
->request;
$out .= eval{$response->as_json};
if ($@) {
$out .= 'ERROR: '.$@->[1];
}
}
# close everythin
n access token.
=head1 RECIPE
use Facebook::Graph;
use Ouch;
use Config::JSON;
# init
my $fb_config = Config::JSON->new('/path/to/my.conf')->get('facebook');
my $fb = Facebook::Graph->new($fb
MooseX::HasDefaults::RO;
use MooseX::StrictConstructor;
use namespace::autoclean;
use Carp;
use JSON;
use LWP::UserAgent;
use Crypt::JWT qw(encode_jwt);
our $VERSION = '1.000002';
has credentials_
th) or die("Can't open credentials file: $!");
my $creds_json = do {local $/; <$fh>};
my $creds = JSON::decode_json($creds_json);
my $payload = {
iss => $creds->{client_email}
assertion => $jwt,
}
);
if ($response->is_success) {
my $r = decode_json($response->decoded_content);
$self->_token($r->{access_token});
$self->_token_exp
= '2.0.3';
# ABSTRACT: GET actions on treebanks on the web
use PMLTQ::Base 'PMLTQ::Command';
use JSON;
use YAML::Tiny;
use Hash::Merge 'merge';
has usage => sub { shift->extract_usage };
sub run {
"Subcommand must be set.";
return 0;
}
my $ua = $self->ua;
$self->login($ua);
my $json = JSON->new;
if($subcommand eq 'list'){
my $treebanks = $self->get_all_treebanks($ua);
my
_};
my $ret = $tb->{$_} // "<UNKNOWN FIELD $_>";
ref($ret) ? $json->encode($ret) : $ret;
} split(/[,; |]/,$config->{info}->{fields}) )} @$treebank
:Request::Common;
use LWP::UserAgent;
use File::Temp;
use Encode;
use Pod::Usage 'pod2usage';
use JSON;
my $extension_dir;
my %opts;
has usage => sub { shift->extract_usage };
sub run {
my $self
query-file|f=s',
'query-pml-file|p=s',
'filters|F=s',
'no-filters',
'old-api',
'output-json',
'netgraph-query|G=s',
'print-servers|P',
'config-file|c=s',
'node-types|n',
'relat
,
%auth,
'old-api'=>$opts{'old-api'},
'output-json'=>$opts{'output-json'},
'baseurl' => $conf->{baseurl}
});
#} else { ## NEW A
s_actions) {
foreach my $action (@{$self->actions}) {
push @$post, actions => JSON->new->encode($action);
}
}
if ($self->has_privacy) {
my %privacy = %{$sel
new->encode(\%privacy);
}
if ($self->has_properties) {
push @$post, properties => JSON->new->encode($self->properties);
}
return $post;
};
1;
=head1 NAME
Facebook::Graph::Pu
MooseX::HasDefaults::RO;
use MooseX::StrictConstructor;
use namespace::autoclean;
use Carp;
use JSON;
use LWP::UserAgent;
use Params::Validate qw(:all);
use URI;
use XML::Simple;
use version;
our $
scope => "http://api.microsofttranslator.com",
});
my $resp_data = JSON::decode_json $r->decoded_content;
$self->_token($resp_data->{access_token});
$self->_token_expi
h. Also, I tend to work on a lot of protocol-based systems that use error codes (HTTP, FTP, SMTP, JSON-RPC) rather than error classes, so that feels more natural to me. Consider the difference between
, all you need to do is:
ouch $code, $message, $data;
ouch -32700, 'Parse error.', $request; # JSON-RPC 2.0 error
ouch 441, 'You need to specify an email address.', 'email'; # form processing erro
pe. Try to stick to codes used in whatever domain you happen to be working in. HTTP Status codes. JSON-RPC error codes, etc.
=item message
A human readable error message.
=item data
Optional. Anyt
tralia - Interface to the Australia PostCode.
=head1 VERSION
Version 0.12
=cut
use 5.006;
use JSON;
use Data::Dumper;
use Address::PostCode::UserAgent;
use Address::PostCode::Australia::Place;
use
ends 'Address::PostCode::UserAgent';
our $BASE_URL = 'https://auspost.com.au/api/postcode/search.json';
has 'auth_key' => (is => 'ro', required => 1);
=head1 DESCRIPTION
Interface to the API provid
;
my $response = $self->get($url, { 'auth-key' => $self->auth_key });
my $contents = from_json($response->{'content'});
my $places = [];
if (ref($contents->{'localities'}->{'locality'
Code::India - Interface to the India PinCode.
=head1 VERSION
Version 0.13
=cut
use 5.006;
use JSON;
use Data::Dumper;
use Address::PostCode::UserAgent;
use Address::PostCode::India::Place;
use Mo
?pincode=%d", $BASE_URL, $pin_code);
my $response = $self->get($url);
my $contents = from_json($response->{'content'});
return Address::PostCode::India::Place->new($contents->[0]);
}
=he