libraries
to load configuration data from multiple different file formats. It supports XML, YAML,
JSON, Apache-style configuration, Windows INI files, and even Perl code.
The rationale for this modul
he following:
L<Config::General|Config::General>
L<Config::Tiny|Config::Tiny>
L<JSON|JSON>
L<YAML|YAML>
L<JSON::Syck|JSON::Syck>
L<YAML::Syck|YAML::Syck>
L<XML::Simple|XML::Simple>
=head1 INCOMPATIBI
package Plack::Middleware::SocketIO::Connection;
use strict;
use warnings;
use JSON ();
use Try::Tiny;
sub new {
my $class = shift;
my $self = {@_};
bless $self, $class;
$self->{o
$self = shift;
my ($message) = @_;
if (ref $message) {
$message = '~j~' . JSON::encode_json($message);
}
return '~m~' . length($message) . '~m~' . $message;
}
sub _generate
.*)/) {
my $json;
try {
$json = JSON::decode_json($1);
};
return $json if defined $json;
return $
package WebService::CloudFlare::Host::Role::Response;
use Moose::Role;
use JSON;
use Data::Dumper;
use Moose::Util::TypeConstraints;
requires 'res_map';
sub BUILDARGS {
my ( $class, $http ) = @_
00."
unless $http->code == 200;
my $json = decode_json( $http->content );
my %map = $class->res_map;
my $args = { __JSON__ => $json };
%map = __PACKAGE__->add_map_defaults( %
tmp_json = $json;
for my $elem ( @elems ) {
next OUTER unless exists $tmp_json->{$elem};
$tmp_json = $tmp_json->{$elem};
}
$args->{$key} = $tmp_json;
Request Object.
Once the object has been made, an HTTP call to the CloudFlare API
is made. The JSON returned is used to construct a Response object
loaded from Response:: with the same name as the
g'>, C<1.32>, and etc, to describe the value
range of data table field.
=item *
It can generate JSON or SQL insert statements to ease importing to RDMBSes like MySQL/PostgreSQL.
=back
Below is a v
/data/departments.schema.json
Wrote ./data/departments.rows.json
Wrote ./data/employees.schema.json
Wrote ./data/employees.rows.json
We see that it generates two F<.json> data files for the C<d
ctively. For example, the F<data/emplyees.rows.json> file on my machine resulting from
a particular run looks like this:
$ cat data/employees.rows.json
[["id","name","age","tel","birthday","heigh
no strict 'refs';
*{"main::getlinkstats"} = *{"WWW::Shorten::Googl::getlinkstats"};
}
use JSON::Any;
use Carp;
use constant API_URL => 'https://www.googleapis.com/urlshortener/v1/url';
use co
my $url = shift or croak 'No URL passed to makeashorterlink';
my $json = JSON::Any->new;
my $content = $json->objToJson( { longUrl => $url, } );
my $res = _request( 'post', API_URL, Con
on/json';
my $resp = $ua->$method( $url, %headers, @args );
die "Request failed - " . $resp->status_line unless $resp->is_success;
my $json = JSON::Any->new;
my $obj = $json->jsonTo
package PocketIO::Connection;
use strict;
use warnings;
use AnyEvent;
use JSON ();
use Encode ();
use Try::Tiny;
use PocketIO::Pool;
use constant DEBUG => $ENV{POCKETIO_CONNECTION_DEBUG};
sub new
$self = shift;
my ($message) = @_;
if (ref $message) {
$message = '~j~' . JSON::encode_json($message);
}
else {
$message = Encode::encode('UTF-8', $message);
}
my $json;
try {
$json = JSON::decode_json(Encode::encode('UTF-8', $1));
};
return $json if defined $json;
e of mine, and remove the exception origin
# from the end of the string as it will mess up the JSON
if($@ =~ /(ERROR:.*)at \/.*/){
# Exception is mine, handle it
$c->stash->{'success'} = '"
package PocketIO::Transport::Base;
use strict;
use warnings;
use JSON ();
use Encode ();
use Try::Tiny;
use Scalar::Util qw(weaken);
use Plack::Request;
use PocketIO::Handle;
use PocketIO::Pool;
if(!response.responseText.match(/ERROR: /)){
file_id = Ext.util.JSON.decode(response.responseText).success;
Ext.fly(file_upload_box).remove();
Ext.fly(file_
the JSON
try{
file_id = Ext.util.JSON.decode(response.responseText).success;
Ext.fly(file_control).insertHtml('afterBegin', '$error_image'+file_id);
}catch(e){
//JSON deco
if(!response.responseText.match(/ERROR: /)){
file_id = Ext.util.JSON.decode(response.responseText).success;
Ext.fly(file_upload_box).remove();
Ext.f
otably they are XML, YAML and JSON.
The URIs need to end with C<.xml>, C<.yml> and C<.json> for XML, YAML and JSON, respectively.
=over
=item B<GET> I</nlp/models.(json|xml|yml)>
Returns an array
strings.
=item B<GET> I</nlp/languages.(json|xml|yml)>
Returns an array of supported languages. Default is "en" for English.
=item B<GET> I</nlp/info.(json|xml|yml)>
Returns a hashref of details
T> I</nlp/relations.(json|xml|yml)>
The user can get a list of all the english grammatical relations supported by
the NLP backend.
=item B<GET/POST> I</nlp/parse/B<$model>.(json|xml|yml)>
The user
:Dumper;
use URI::Escape;
use HTTP::Request::Common;
use HTTP::Response;
use LWP::UserAgent;
use JSON;
use utf8;
# ABSTRACT: API para enviar SMS através da NSMS (http://www.nsms.com.br/)
our $VERSI
=> 1,
default => sub {
my $self = shift;
join( '/', $self->baseurl, 'get', 'json' )
. '?to=55'
. $self->to
. '&content='
. uri_esc
> 'Bool',
default => 0
);
sub _json_to_struct {
my ( $self, $ret ) = @_;
$ret = $ret->content if ref($ret) eq 'HTTP::Response';
my $st = decode_json($ret);
print Dumper($st) if $s
package WWW::ProximoBus;
use strict;
use warnings;
use Any::Moose;
use Carp;
use JSON;
use LWP::UserAgent;
our $VERSION = '0.01';
has 'api_host' => ( is => 'rw', default => 'proximobus.appspot.com
_for($path);
my $res = $self->ua->get($uri);
if ($res->is_success) {
return JSON::decode_json($res->content);
}
else {
die "ProximoBus HTTP error " . $res->code . ": "
gency.json";
return $self->get($path);
}
sub routes {
my $self = shift;
my ($agency) = @_;
croak "need an agency" unless ($agency);
my $path = "/agencies/$agency/routes.json";
my %map = (
json => 'application/json',
xml => 'application/xml',
);
builder {
enable 'SetAccept', from => 'suffix', mapping => \%map;
$app;
};
# now /foo.json behaves as /fo
o, with Accept: application/json
# or
builder {
enable 'SetAccept', from => 'param', param => 'format', mapping => \%map;
$app;
};
# now /foo?format=xml behaves as /foo, with Accept:
request
URI. It can extract from either the suffix of the path (ex. /foo.json) or
from the query string (ex. /foo?format=json) for HEAD and GET requests. The
value is looked up in a mapping table an
package Persevere::Client;
use warnings;
use strict;
use JSON;
use LWP::UserAgent;
use HTTP::Request qw(GET HEAD POST PUT DELETE);
use HTTP::Status;
use HTTP::Headers;
use HTTP::Response;
use HTTP::C
e Encode qw(encode);
=head1 NAME
Persevere::Client - A Simple to use Interface to Persevere the JSON Database
=head1 VERSION
Version 0.31
=cut
our $VERSION = '0.31';
sub new{
my $class = shif
opt{host} || 'localhost') . ':' .
($opt{port} || '8080') . '/';
}
$self{json} = ($opt{json} || JSON->new->utf8->allow_blessed);
$self{ua} = ($opt{ua} || LWP::UserAgent->new(agent =
ider_url);
if( $resp->is_success ) {
my $x;
unless( eval 'require JSON::XS' and
$x=eval {JSON::XS::decode_json($resp->content)} ) {
eval 'require YAML' and $x=eval {YAML::Load($re
package App::perlrocks::Helpers;
use strict;
use warnings;
use HTTP::Tiny;
use JSON qw(from_json to_json);
use Exporter::Lite;
our @EXPORT = qw(metacpan_request);
sub metacpan_request {
my ($pat
{
content => defined($data) ? to_json($data) : ''
}
);
if ($response->{success}) {
my $data = from_json($response->{content});
return $cb ? $cb->($
data) : $data;
}
die "Request failed: " . to_json($response);
}
1;
ck
=cut
sub get {
my $api = shift;
my @args;
my $uri = sprintf '/request-properties.json', @args;
$api->base->call("GET", $uri, @_);
}
=pod
=back
=cut
### END auto-generated
1;
$api = shift;
my @args;
push @args, shift; # id
my $uri = sprintf '/relationships/%s.json', @args;
$api->base->call("GET", $uri, @_);
}
=pod
=item get_status
my $res = $tp->re
shift;
my @args;
push @args, shift; # id
my $uri = sprintf '/relationships/%s/status.json', @args;
$api->base->call("GET", $uri, @_);
}
sub status {
my $self = shift;
Carp::
shift;
my @args;
push @args, shift; # id
my $uri = sprintf '/relationships/%s/status.json', @args;
$api->base->call("PUT", $uri, @_);
}
=pod
=back
=cut
### END auto-generated
1;
TML::Mason
HTML::Parser
IO::All
IO::Stringy
Image::Info
Imager
Iterator
Iterator::Util
JSON
JSON::XS
Lingua::EN::Inflect
Lingua::Strfname
List::MoreUtils
List::Util
Locale::Maketext
Luc
:Deep
Test::Differences
Test::Exception
Test::File
Test::File::Contents
Test::Harness
Test::JSON
Test::MockModule
Test::More
Test::NoWarnings
Test::Number::Delta
Test::Output
Test::Perl::C