e HTTP::Exception '4XX';
use JSON::XS;
use YAML::Syck;
my $Mime_types;
$YAML::Syck::ImplicitUnicode = 1;
$Mime_types = {
'application/json' => sub { &decode_json($_[1]) },
'text/yaml'
e::FormatOutput
=back
=head1 CONSTANTS
=head2 DEFAULT MIME TYPES
=over 4
=item * application/json
=item * text/yaml
=item * text/plain
=item * application/x-www-form-urlencoded
As default t
efined'?'application/json':'application/x-www-form-urlencoded';
\$.ajax({
type: methodType,
url: url,
headers: {
Accept : 'application/json; charset=utf-8',
lass=\"form-control\">
<option selected=\"selected\">text/html</option>
<option>application/json</option>
<option>text\/yaml</option>
<option>text/plain</option>
</select>
<button type=\
lass=\"form-control\">
<option selected=\"selected\">text/html</option>
<option>application/json</option>
<option>text/yaml</option>
<option>text/plain</option>
</select>
<label class=\"
ns qw(catfile tmpdir);
use Mojo::Util qw(slurp spurt steady_time);
use Mojo::JSON qw(encode_json decode_json);
has initialized => sub { 0 };
has qw(file);
use constant DEBUG =>
) {
spurt(encode_json($hash), $state->file);
$state->_unlock($fh);
return $hash;
}
elsif (-f $state->file) {
my $ret = decode_json(slurp($state->file));
use File::Spec::Functions qw(catfile tmpdir);
use IO::Handle;
use Mojo::JSON qw(encode_json decode_json);
use POSIX qw(:sys_wait_h);
use Time::HiRes qw(usleep);
use Mojo::Util
mes.com API interface for Perl
# pragmas
use utf8;
use 5.10.0;
#imports
use Moo;
use Carp;
use JSON;
use Try::Tiny;
use LWP::UserAgent;
# version
our $VERSION = 0.01;
# attributes
has '_ua' => (
, form => $args
);
my $json = {};
try {
$json = JSON::decode_json($res->decoded_content)
}
catch {
warn "JSON Decode Exception: $_";
};
return $json;
}
1;
__END__
=encoding u
t_t type);
uintptr_t ngx_escape_html(u_char *dst, u_char *src, size_t size);
uintptr_t ngx_escape_json(u_char *dst, u_char *src, size_t size);
typedef struct {
ngx_rbtree_node_t node;
asure
use Encode qw/ decode_utf8 encode_utf8 /;
use Exporter 'import';
use Graph;
use JSON qw/ to_json decode_json /;
use LWP::UserAgent;
use Set::Scalar;
use Text::Tradition::Analysis::Result;
use Te
;
my $json = JSON->new->allow_blessed->convert_blessed->utf8->encode(
[ values %problems ] );
# Send it off and get the result
# print STDERR "Sending request: " . decode_utf8( $json ) . "\n
->{solver_url}, 'Content-Type' => 'application/json',
'Content' => $json );
my $answer;
if( $resp->is_success ) {
$answer = decode_json( $resp->content );
throw( "Unexpected answ
lysis::Result;
use Moose;
use Digest::MD5 qw/ md5_hex /;
use Encode qw/ encode_utf8 /;
use JSON qw/ to_json /;
use Set::Scalar;
use Text::Tradition::Error;
=head1 NAME
=encoding utf8
Text::Traditi
), $expected, "Got expected witness class for $wit" );
}
}
# Now write it out to JSON
my $struct = $result->TO_JSON;
my $newresult = Text::Tradition::Analysis::Result->new( $struct );
is( $result->o
oreach my $m ( $set1->members ) {
return 0 unless $all{$m};
}
return 1;
}
sub TO_JSON {
my $self = shift;
# Required values: graph and setlist
my $data = {
graph => $self->graph
ewline; set $opts->{'linesep'} to the
empty string or to a space if the result is to be sent via JSON.
If a situational version of the stemma is required, the arguments for
situation_graph should b
ID. Returns any new stemmata that were created.
=begin testing
use Text::Tradition;
use JSON qw/ from_json /;
my $t = Text::Tradition->new(
'name' => 'Stemweb test',
'input' => 'Self',
mweb_jobid' => '4',
);
is( $t->stemma_count, 0, "No stemmas added yet" );
my $answer = from_json( '{"status": 0, "job_id": "4", "algorithm": "RHM", "format": "newick", "start_time": "2013-10-26
e::FurlAgent::VERSION = '0.005';
use strict;
use warnings;
use Moo::Role;
use Carp;
use Cpanel::JSON::XS;
use Furl;
use URI;
has ua => (
is => 'ro',
default => sub { return Furl->new(); }
)
parameters
# accepted by L<Furl::request|https://metacpan.org/pod/Furl>. Returns the responses
# JSON.
# Will add an Authorization header with the access_token attributes value to the request.
# Can
h an error if the response code was not a successful one, or if there was
# an error decoding the JSON data. For requests that do not return any content, will
# just return undef to indicate we have r
=> 'all';
use parent qw( Plack::Middleware );
use Plack::Util;
use HTTP::Exception '4XX';
use JSON::XS;
use YAML::Syck;
use URI::Escape::XS qw/decodeURIComponent/;
use Encode;
our $VERSION = '0.1
1") ? return 1 : return 0;
}
### Set default mime types
my $MIME_TYPES = {
'application/json' => sub { JSON::XS->new->utf8->allow_nonref->encode($_[0]) },
'text/yaml' => sub {
local $
tml($data, $env, $header); #struct, env
return Encode::encode_utf8($ret) if $ret;
}
return JSON::XS->new->utf8->allow_nonref->encode($data); # Just show content
}
};
sub prepare_app {
my $se
le->set_cache_key('user-10-access-token');
# eg: use a Google::Client::Files client:
my $json = $google->files->list(); # lists all files available by calling: GET https://www.googleapis.com/
ALPR;
use 5.014000;
use strict;
use warnings;
use Image::OpenALPR::PlateResult;
use JSON::MaybeXS qw/decode_json/;
use XSLoader;
BEGIN {
our $VERSION = '0.001001';
XSLoader::load('Image::OpenALPR
;
my $json = ref $data eq 'SCALAR' ? $alpr->recognizeArray($$data) : $alpr->recognizeFile($data);
$json = decode_json $json;
my @plates = map { Image::OpenALPR::PlateResult->new($_) } @{$json->{res
se;
use namespace::autoclean;
use Types::Standard qw/Str HashRef/;
use Path::Tiny;
use JSON::MaybeXS 'decode_json';
with 'Badge::Depot';
# ABSTRACT: Travis plugin for Badge::Depot
our $AUTHORITY = 'c
my $self = shift;
return {} if !path('META.json')->exists;
my $json = path('META.json')->slurp_utf8;
my $data = decode_json($json);
return {} if !exists $data->{'resources'}{'r
r configuration. It looks for the C<resources/repository/web> setting in C<META.json>:
=over 4
=item *
If C<META.json> doesn't exist in the dist root, C<user> and C<repo> are required.
=item *
If
();
use CPAN::Testers::Report 1.999001 ();
use File::Glob ();
use JSON::MaybeXS;
use Metabase::User::Profile 0.016 ();
use Metabase::User::Secret 0.016 ();
use Met
:confess __PACKAGE__. ": could not read ID file '$self->{id_file}'"
. "\n$!";
my $data = JSON::MaybeXS->new(ascii => 1)->decode( do { local $/; <$fh> } );
my $profile = eval { Metabase::Us
=> 'http://metabase.example.com:3000/',
id_file => '/home/jdoe/.metabase/metabase_id.json',
],
);
# use space-separated in a CPAN::Reporter config.ini
transport = Met
}
sub inflated_rw_type { 'List::Objects::WithUtils::Hash::Inflated::RW' }
=for Pod::Coverage TO_JSON TO_ZPL damn type
=cut
sub is_mutable { 1 }
sub is_immutable { ! $_[0]->is_mutable }
sub type
$_[0]
}
sub export { %{ $_[0] } }
sub unbless { +{ %{ $_[0] } } }
{ no warnings 'once';
*TO_JSON = *unbless;
*TO_ZPL = *unbless;
*damn = *unbless;
}
sub clear { %{ $_[0] } = (); $_
e methods documented below, these objects provide a
C<TO_JSON> method exporting a plain HASH-type reference for convenience when
feeding L<JSON::Tiny> or similar, as well as a C<TO_ZPL> method for
com
:Storage::CHI::VERSION = '0.004';
use Mojo::Base qw/Mojolicious::Sessions::ThreeS::Storage/;
use JSON;
=head1 NAME
Mojolicious::Sessions::ThreeS::Storage::CHI - An adapter to store sessions in a CH
S->new({ storage => $storage , state => ... } );
Note that you WILL have to depend on CHI and on JSON in your application to use this storage.
This distribution does not add these to the runtime dep
43200;
has 'chi';
has 'json' => sub{
my $json = JSON->new();
$json->ascii( 1 );
# Encode stuff in ascii so there is no risk
# of bad decoding.
return $json;
};
=head1 METHODS
=h
package Qiniu::Auth;
use strict;
use Qiniu::Util qw/encode_json safe_b64_encode hmac_sha1/;
use Moo;
our $VERSION = '0.05';
use constant DEFAULT_AUTH_SECONDS => 3600;
has [qw/access_key secret_key
map { $_ => $Fields->{$_} }
grep { $Fields->{$_} } keys %$Fields;
return encode_json(\%args)
}
sub private_url {
my $self = shift;
my $download_url = shift;
my $e = tim
se strict;
use REST::Client;
use MIME::Base64;
use Cpanel::JSON::XS qw(encode_json);
use IDCHECKIO::ResponseIDCIO;
use JSON::Parse 'parse_json';
=head1 NAME
IDCHECKIO::Client - Client to use the ID
cation/json");
$self->{_client}->addHeader("Authorization", "");
my $auth = encode_base64("$self->{_user}:$self->{_pwd}");
$self->{_client}->addHeader("Content-Type", "application/json");
$
$line2,
'line3' => $line3,
};
my $json_data = encode_json $data;
my $result;
$self->{_client}->POST($url, $json_data);
my $json = parse_json($self->{_client}->responseContent());
if
'import';
use Mojo::JSON qw(decode_json encode_json);
use Digest::SHA qw(hmac_sha1);
use MIME::Base64 qw(decode_base64 encode_base64);
our @EXPORT_OK = ( qw(decode_json encode_json safe_b64_encode enc