:Dumper;
use DateTime;
use Email::Stuffer;
use Encode;
use File::Slurp;
use FindBin qw($Bin);
use JSON;
use Log::AutoDump;
use Plack::Handler::FCGI;
use Plack::Request;
use Template;
use Term::ANSICol
se . '/templates';
}
sub _build_filename
{
my $self = shift;
return $self->base . '/app.json';
}
=head3 base
The base directory of the application, detected using L<FindBin>.
=head3 dev
<gt>base . '/templates'>.
=head3 filename
Filename for the config file, default is C<app.json> and only JSON is currently supported.
=head3 config
The config as a hash-reference.
=head2 Instance
DateTime;
use Digest::SHA1 qw(sha1_hex);
use Encode;
use File::Slurp;
use FindBin qw($Bin);
use JSON;
use Log::AutoDump;
use Plack::Handler::FCGI;
use Plack::Request;
use Template;
use Term::ANSICol
>_base . '/editor.json';
}
=head3 processes
Number of FastCGI process to spawn, 5 by default.
=head3 filename
Filename for the config file, default is C<editor.json> and only JSON is currently sup
filename, { binmode => ':utf8' } );
my $config = undef;
eval {
$config = decode_json $string;
};
if ( $@ )
{
_print_red( "[ FAIL ]\n" );
print "Config fi
ar::ECMAScript_262_5::Pattern;
use MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::JSON;
use MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::URI;
use MarpaX::Languages::E
my $JSON = MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::JSON->new();
$self->{_JSON} = {
grammar => $JSON,
impl => MarpaX::Languages::ECMAScript::AST::Impl->new($JSON->gramm
ar_option(), $JSON->recce_option())
};
my $URI = MarpaX::Languages::ECMAScript::AST::Grammar::ECMAScript_262_5::URI->new();
$self->{_URI} = {
grammar => $URI,
impl => MarpaX::Languages:
my $app_name = $self->app_name;
my $is_text = qr/\b(?:text|xml|javascript|json)\b/;
state $cache = {};
if ($cache->{$app_name}{$path_info}) {
my ($self) = @_;
return $self->{_grammar}->pattern;
}
sub JSON {
my ($self) = @_;
return $self->{_grammar}->JSON;
}
sub URI {
my ($self) = @_;
return $self->{_grammar}->UR
gNumericLiteral grammar.
=head2 pattern($self)
Returns the pattern grammar.
=head2 JSON($self)
Returns the JSON grammar.
=head2 URI($self)
Returns the URI grammar.
=head2 spacesAny($self)
Retu
a::App::Command::weaverconf::VERSION = '0.05';
use Dist::Zilla::App -command;
use Moose 0.91;
use JSON::MaybeXS ();
use List::Util qw(first);
use MooseX::Types::Moose qw(Str CodeRef);
use MooseX::Type
ar
#pod output format. The following formats are currently available:
#pod
#pod =for :list
#pod * json
#pod the default
#pod * lisp
#pod a plist of lists of plists
#pod
#pod =cut
has formatters => (
> sub { Dist::Zilla::App::CommandHelper::weaverconf::SExpGen->new->visit($_[0]) },
json => sub { JSON::MaybeXS->new(utf8 => 1, pretty => 1, canonical => 1)->encode($_[0]) },
};
}
sub abst
Service::Rakuten::API;
use 5.008005;
use strict;
use warnings;
use LWP::UserAgent;
use Mouse;
use JSON;
use URI;
our $VERSION = "0.06";
use WebService::Rakuten::API::Provider::Travel;
use WebService::
appid => __YOURAPI__
);
my $items = $rakuten->ichiba({keyword => '遊戯王',format => 'json'});
print $items->{Items}->[0]->{Item}->{itemName};
=head1 DESCRIPTION
WebService::Rakuten
SMS service
use Carp;
use HTTP::Tiny;
use URI::Escape qw( uri_escape );
use JSON::MaybeXS qw( decode_json encode_json JSON );
use base 'SMS::Send::Driver';
sub new {
my $class = shift;
my
# to ensure the response is JSON and not the XML default
'accept' => 'application/json; charset=utf-8',
'content-type' => 'application/json; charset=utf-8',
},
nt => encode_json(\%message),
}
);
# for example a timeout error
die $response->{content}
unless $response->{success};
my $response_message = decode_json( $response->
:Field::JSONmulti;
# ABSTRACT: a script tag which sets multiple vars using JSON 'data', encoded from list of perl data supplied via field for HTML::FormHandler.
$HTML::FormHandlerX::Field::JSONmulti::
VERSION = '0.004';
use Moose;
extends 'HTML::FormHandlerX::Field::JSON';
use namespace::autoclean;
use JavaScript::Minifier::XS qw();
sub wrap_data {
my $self = shift;
my @data_args = @_;
le list bit seems a bit pointless right now, why not just create and array ref and assign the one json object?
## The plan is to allow different data_key for each list element, but sensible implement
binmode $fh;
print $fh $tile;
=cut
use strict;
use warnings;
use LWP::UserAgent;
use URI;
use JSON;
use Math::Trig;
use constant HOST => 'cloudmade.com';
use constant DEBUG => $ENV{GEO_CLOUDMADE_
vice("geocoding/v2/find.js", [%params], 'geocoding');
return unless $content;
my $ref = from_json($content, {utf8 => 1});
my @objs;
push @objs, bless $_, 'Geo::Cloudmade::Result' foreach (@{$
vice("geocoding/v2/find.js", [%params], 'geocoding');
return unless $content;
my $ref = from_json($content, {utf8 => 1});
my @objs;
push @objs, bless $_, 'Geo::Cloudmade::Result' foreach (@{$
l->query_form(applicationId => $context->appid,format=>$arg->{format},keyword =>$arg->{keyword});
my $res = $context->furl->get($url);
my $response = JSON::decode_json($res->decoded_content);
}
1;
$cgi->set_header('myheader', 'whatever');
# change content type
$cgi->set_content_type('text/json');
# output HTTP headers, including added cookies, the CSRF cookie,
# and the new header
prin
GgpkZ4; path=/
# Date: Sun, 29 Jul 2012 04:08:06 GMT
# Myheader: whatever
# Content-Type: text/json; charset=ISO-8859-1
=head1 INSTALLATION
CGI::Plus can be installed with the usual routine:
pe
$cgi->set_header('myheader', 'whatever');
# change content type
$cgi->set_content_type('text/json');
# output HTTP headers, including added cookies, the CSRF cookie,
# and the new header
prin
GgpkZ4; path=/
# Date: Sun, 29 Jul 2012 04:08:06 GMT
# Myheader: whatever
# Content-Type: text/json; charset=ISO-8859-1
=head1 INSTALLATION
CGI::Plus can be installed with the usual routine:
pe
}
}
_add_aliases(qw( application/mp4 video/mp4 ));
_add_aliases(qw( application/json text/json ));
_add_aliases(qw( application/cals-1840 image/cals-1840 image/cals image/x-cals appli
L<PSGI|McBain::WithPSGI> and L<Gearman::XS|McBain::WithGearmanXS> runners,
however, are both JSON-in JSON-out interfaces.
A C<McBain> API is built of one or more B<topics>, in a hierarchical structu
in::WithPSGI> - Turn an API into a Plack based, JSON-to-JSON
RESTful web application.
=item * L<McBain::WithGearmanXS> - Turn an API into a JSON-to-JSON
Gearman worker.
=item * L<McBain::WithWebSock
t> - Turn an API into a WebSocket server.
=item * L<McBain::WithZeroMQ> - Turn an API into a JSON-to-JSON ZeroMQ REP worker.
=back
The latter four completely change the way your API is used, and ye
----------------------------------------------------------------
sub JSON {
my ($self) = @_;
return $self->{_grammar}->JSON;
}
# ---------------------------------------------------------------
mar.
=head2 pattern($self)
Return the generic Pattern for this grammar.
=head2 JSON($self)
Return the generic JSON for this grammar.
=head2 URI($self)
Return the generic URI for this grammar.
=
ngs;
use strict;
use Carp;
use JSON::MaybeXS qw/JSON/;
use Plack::Request;
use Plack::Component;
our $VERSION = "2.001001";
$VERSION = eval $VERSION;
my $json = JSON->new->utf8->allow_blessed->conv
created web service will be a JSON-in JSON-out service. Requests to your application
are expected to have a C<Content-Type> of C<application/json; charset=UTF-8>. The JSON body
of a request will be th
e formatted into JSON as
well.
Note that if an API method does not return a hash-ref, this runner module will automatically
turn it into a hash-ref to ensure that conversion into JSON will be possibl
package Geo::Coder::TomTom;
use strict;
use warnings;
use Carp qw(croak);
use Encode ();
use JSON;
use LWP::UserAgent;
use URI;
our $VERSION = '0.04';
$VERSION = eval $VERSION;
sub new {
my ($
=> 'json',
%params,
);
my $res = $self->{response} = $self->ua->get($uri);
return unless $res->is_success;
# Change the content type of the response from 'application/json' s
my $content = $res->decoded_content;
return unless $content;
my $data = eval { from_json($content) };
return unless $data;
# Result is a list only if there is more than one item
;
my $url = URI->new(BASEHOTELURL);
$url->query_form(applicationId=> $context->appid,format=>'json',largeClassCode => $arg->{largeClassCode},middleClassCode=>$arg->{middleClassCode},smallClassCode
use strict;
my $JSON;
for ( qw/JSON::MaybeXS JSON JSON::PP/ ) {
last if $JSON = eval "use $_; '$_'";
}
$JSON or die <<'...';
ERROR: No JSON Perl modules are installed.
This Perl program is being
b' command. It requires
one of the 'JSON::MaybeXS', 'JSON' or 'JSON::PP' Perl modules, but it seems
that you have none of these installed.
Please install the 'JSON::MaybeXS' module from CPAN, and try
again.
...
{
my $data = decode_json(do {local $/; <>});
die "Unknown JSON result" unless
ref($data) =~ /^(HASH|ARRAY)$/;
walk($data, '');
};
sub walk {
my ($node, $path) = @_;
if (re