ount descriptor URI is fetched via HTTP GET with an Accept header
asking for RDF/XML, Turtle, RDF/JSON or XRD. The result is parsed for account
description data if it has status code 200 (OK).
The fo
oading file: %s", $@ || $!);
}
}
sub dump_config {
my $self = shift;
require JSON;
print JSON->new->pretty->utf8->allow_blessed(1)->convert_blessed(1)->encode({
config =>
ts;
if (ref $hosts eq 'CODE') {
return $hosts->();
}
return $hosts;
}
sub TO_JSON {
my $self = shift;
return {
name => $self->name,
hosts => $self->get_hos
content_type =~ m`(n3|turtle|text/plain)`;
$parser = RDF::Trine::Parser::RDFJSON->new if $response->content_type =~ m`(json)`;
$parser = RDF::Trine::Parser::RDFXML->new unless defined $parser;
$pa
>env_proxy;
$ua->default_header('Accept' => 'application/rdf+xml, text/turtle, application/x-rdf+json');
my $response = $ua->get($uri);
if ($response->is_success)
{
$self->_response_into_mod
::Log::LogDispatch> this can be thought of as a common logging interface.
package MyApp::View::JSON;
extends 'MyApp::View';
with 'MooseX::Role::LogHandler';
sub bar {
$self->logger->d
nger::CPAN;
use 5.010;
use common::sense;
use utf8;
use Digest::MD5 0 qw(md5_hex);
use JSON 2.00 qw(from_json);
use LWP::Simple 0 qw(get);
use parent qw(WWW::Finger);
BEGIN {
$WWW::Finger::CPAN::
uri = sprintf('http://api.metacpan.org/v0/author/%s', uc $user);
$self->{metacpan_data} = from_json(get($uri));
}
$self->{metacpan_data};
}
sub releases
{
my $self = shift;
unless ($self->
0AND%%20status:latest&size=100', uc $user);
$self->{releases} = [ map { $_->{_source} } @{ from_json(get($uri))->{hits}->{hits} } ];
}
return wantarray
? @{ $self->{releases} }
: scalar @{ $
WWW::Finger::BitworkingFingerProtocol;
use 5.010;
use common::sense;
use utf8;
use Carp 0;
use JSON 2.00;
use LWP::UserAgent 0;
use URI 0;
use URI::Escape 0;
use parent qw(WWW::Finger);
BEGIN {
UserAgent->new;
$ua->timeout(10);
$ua->env_proxy;
$ua->default_header('Accept' => 'application/json');
my $host_get = $ua->get("http://$host/.well-known/finger");
return undef unless $host_ge
pe :-(
### return undef unless $host_get->content_type =~ m#^application/(\S+\+)?json$#i;
my $host_data = from_json( $host_get->decoded_content );
my $template = $host_data->{'finger'};
retur
2 C<ht_tiny>
=begin MetaPOD::JSON v1.1.0
{
"namespace":"Net::TribalWarsMap::API::HTTP",
"interface":"class",
"inherits":"Moo::Object"
}
=end MetaPOD::JSON
=head1 AUTHOR
Kent Fredric
# ABSTRACT: provides perl API to Forecast.io
package Forecast::IO;
use strict;
use warnings;
use JSON;
use HTTP::Tiny;
use Moo;
my $api = "https://api.forecast.io/forecast";
my $docs = "https://de
se->{status} $response->{reason}\n"
unless $response->{success};
my $forecast = decode_json( $response->{content} );
while ( my ( $key, $val ) = each %args ) {
unless ( exists(
g => "User '" . $developer->username . "' has been successfully updated.");
return $self->add_json_header(list_changed => 1);
}
=head2 list
Show a list of all developers. Uses the F<Admin/Develo
ge(msg => "New user '" . $developer->username . "' successfully created.");
return $self->add_json_header(list_changed => 1);
}
=head2 delete
Delete a Developer and all data associated with him
ect '"
. $proj->name
. "'.");
}
}
$self->add_json_header(update_nav => 1) if $dev->id == $self->developer->id;
return $self->devs({}, $proj);
}
removed from project '"
. $proj->name
. "'.");
}
$self->add_json_header(update_nav => 1) if $dev->id == $self->developer->id;
return $self->devs({}, $proj);
}
msg => "New project '" . $project->name . "' successfully created.");
}
return $self->add_json_header(list_changed => 1, update_nav => 1);
}
=head2 details
Show the details about a project.
ibraries
to load configuration data from multiple different file formats. It
supports XML, YAML, JSON, Apache-style configuration, Windows INI
files, and even Perl code.)
=head1 EXPORTS
By defaul
;
builder {
enable 'FixIEXDomainRequestBug',
force_content_type => 'application/json';
$app;
};
=head2 Custom Provider
Use some custom code to provide a valid mimetype
my $env = shift;
if($env->{PATH_INFO} =~ m{^/api}) {
return 'application/json';
} else {
return 'application/x-www-form-urlencoded';
}
est->new($env);
## Assume a request url like "http://myapp.com/path?format=application/json"
return $req->query_parameters->get('format')
};
$app;
};
=head1 ATT
package Mail::SendGrid::SmtpApiHeader;
use strict;
use warnings;
use JSON;
our $VERSION = '0.02';
sub new {
my $class = shift;
return bless { 'data' => { } }, ref $class || $class;
}
sub ad
$JSON;
sub asJSON {
my $self = shift;
$JSON ||= _build_json();
return $JSON->encode($self->{data});
}
my $JSON_PRETTY;
sub asJSONPretty {
my $self = shift;
$JSON_PRETTY ||= _build_json()
(1);
return $JSON_PRETTY->encode($self->{data});
}
sub as_string {
my $self = shift;
my $json = $self->asJSON;
$json =~ s/(.{1,72})(\s)/$1\n /g;
my $str = "X-SMTPAPI: $json";
return $s
Application::Plugin::TT;
use CGI::Application::Plugin::LogDispatch;
use CGI::Application::Plugin::JSON qw(:all);
use Template::Plugin::Cycle;
use CGI::Cookie;
# This has nice output, but can't get it
gs) = @_;
my $msgs = $self->json_header_value('messages') || [];
push(@$msgs, {type => ($args{type} || 'info'), msg => ($args{msg} || '')});
$self->add_json_header(messages => $msgs);
}
=
use base 'Test::WWW::Mechanize';
use Smolder::Conf;
use Smolder::TestData qw(base_url);
use JSON qw(from_json);
use Test::Builder;
use Test::More;
=head1 NAME
Smolder::Mech
=head1 DESCRIPTION
L<T
return $self->SUPER::request(@_);
}
=head1 contains_message
This method will look in the C<X-JSON> HTTP header
of the response, look through each message in the
C<messages> array and see if any o
lf, $match) = @_;
my $resp = $self->response();
my $json = from_json($self->response->header('X-JSON') || '{}');
my $msgs = $json->{messages} || [];
my $diag = "contains message $match
} else {
return $html;
}
}
=head2 get_pref_details
This run mode will return a JSON header which contains the name-value
pairs for this preferences data.
=cut
sub get_pref_details
_ => $pref->$_ } qw(email_type email_freq email_limit show_passing);
}
return $self->add_json_header(%data);
}
=head2 update_pref
Update the information coming from the C<show> run mode.
If
trict;
use warnings;
use Carp ();
use Fcntl qw(F_GETFL F_SETFL O_NONBLOCK SEEK_SET SEEK_END);
use JSON;
use Net::OAuth;
$Net::OAuth::PROTOCOL_VERSION = Net::OAuth::PROTOCOL_VERSION_1_0A;
use URI;
use
t
request_token
request_secret
access_token
access_secret
root
no_decode_json
error
code
request_url
request_method
timeout
oauth_callback
callback
oaut
timeout => $args->{timeout} || (60 * 60 * 24),
no_decode_json => $args->{no_decode_json} || 0,
no_uri_escape => $args->{no_uri_escape} || 0,
env_proxy
package Geo::Coder::Mapquest;
use strict;
use warnings;
use Carp qw(croak);
use Encode ();
use JSON;
use LWP::UserAgent;
use URI;
use URI::Escape qw(uri_unescape);
our $VERSION = '0.06';
$VERSION =
f the response from 'application/json' so
# HTTP::Message will decode the character encoding.
$res->content_type('text/plain');
my $data = eval { from_json($res->decoded_content) };
r
f the response from 'application/json' so
# HTTP::Message will decode the character encoding.
$res->content_type('text/plain');
my $data = eval { from_json($res->decoded_content) };
r
ead1 VERSION
version 1.03
=head1 SYNOPSIS
$json_storage = $json_format->wrap($storage);
$json_storage->write({ a => "b" });
$in = $json_storage->in("client1");
$data = $in->read();