ape_ijson
my $escaped_js = escape_ijson($raw_js);
JavaScript-escapes the input string except for the apostrophe and returns it,
so it can be used within a JSON element.
=cut
sub escape_ijson {
C<RAYGUN_API_KEY> environment variable.
=cut
use LWP::UserAgent;
use URI;
use Mozilla::CA;
use JSON;
use WebService::Raygun::Message;
has api_key => (
is => 'rw',
isa => 'Str',
$ua = $self->user_agent;
my $json = JSON->new->allow_nonref;
my $jsoned = $json->pretty->encode( $message->prepare_raygun );
### json : $jsoned
my $req = HTTP::Request->new( P
req->header( 'Content-Type' => 'application/json' );
$req->header( 'X-ApiKey' => $api_key );
$req->content($jsoned);
### json message : $jsoned;
my $response = $ua->request($req);
s://metacpan.org/pod/WebService::Raygun'
};
}
=head2 prepare_raygun
Converts a Perl hash to JSON.
=cut
sub prepare_raygun {
my $self = shift;
my $formatter = DateTime::Format::Str
to GitHub after release
use strict;
use warnings;
our $VERSION = '0.002'; # VERSION
use JSON qw(encode_json);
use Moose;
use Try::Tiny;
use Git::Wrapper;
use File::Basename;
use File::Slurp qw(read
y $response = HTTP::Tiny->new->request('POST', $url, {
content => (ref($payload) ? encode_json($payload) : $payload),
headers => $headers,
});
$self->_last_status($response->{
package Sailthru::Client;
use strict;
use warnings;
use Carp;
use JSON::XS;
use LWP::UserAgent;
use Digest::MD5 qw( md5_hex );
use Params::Validate qw( :all );
use Readonly;
use URI;
our $VERSION =
LAR } );
my ( $action, $data, $request_type ) = @params;
my $payload = $self->_prepare_json_payload($data);
my $action_uri = $API_URI . $action;
my $response = $self->_http_reques
reset => $response->header('x-rate-limit-reset')
};
}
return decode_json( $response->content );
}
# args:
# * uri - scalar
# * data - hashref
# * method - scalar
sub _ht
webservice
use Carp;
use HTTP::Tiny;
use URI::Escape qw( uri_escape );
use JSON::MaybeXS qw( decode_json encode_json JSON );
use Try::Tiny;
use Exception::Class (
'SMS::Send::Retarus::Exception'
> {
# to ensure the response is JSON
'accept' => 'application/json; charset=utf-8',
'content-type' => 'application/json; charset=utf-8',
},
timeout
content => encode_json(\%message),
}
);
if ( $response->{success} ) {
my $content;
try {
$content = decode_json( $response->{content} );
default_headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'Authorization' => 'Basic ' . encode_base64($self->api_ke
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
package Text::Tradition::Witness;
use vars qw( %tags );
use JSON;
use Moose;
use Text::Tradition::Datatypes;
use Text::TEI::Markup qw( word_tag_wrap );
use TryCatch;
=head1 NAME
Text::Tradition::Wi
d.
=item * sourcetype - What sort of witness data this is. Options are
'xmldesc', 'plaintext', 'json', or 'collation' (the last should only be
used by Collation parsers.)
=item * file
=item * stri
e JSON witnesses via object
open( JSIN, 't/data/witnesses/testwit.json' ) or die "Could not open JSON test input";
binmode( JSIN, ':encoding(UTF-8)' );
my @lines = <JSIN>;
close JSIN;
$trad->add_json_
package Text::Tradition;
use JSON qw / from_json /;
use Module::Load;
use Moose;
use Moose::Util qw/ does_role apply_all_roles /;
use Safe::Isa;
use Text::Tradition::Collation;
use Text::Tradition::E
CollateX
=item * CTE - a TEI XML format produced by Classical Text Editor
=item * JSON - an alignment table in JSON format, as produced by CollateX and
other tools
=item * TEI - a TEI parallel seg
priate parser on the given data
my @format_standalone = qw/ Self CollateText CollateX CTE JSON TEI Tabular /;
my @format_basetext = qw/ KUL /;
my $use_base;
my $format
rieves a specific report.
=head1 SYNOPSIS
# default options
my %options = (
as_json => 0, # the default
as_hash => 0, # the defau
:Fact, as a CPAN::Testers::Report object.
If you wish to manipulate this differently, use the as_json or as_hash to
return more simplified forms.
# get by id
my $result = $query->report( re
turn as JSON
my $result = $query->report( report => 40000000, as_json => 1 );
# force return as a hash
my $result = $query->report( report => 40000000, as_hash => 1 );
The as_json and as
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
File::Path;
use File::Slurp;
use Getopt::ArgvFile default=>1;
use Getopt::Long;
use IO::File;
use JSON;
use LWP::UserAgent;
use Math::Random::MT;
use Metabase::Resource;
use MIME::Base64;
use MIME::Qu
mode => 'daily',
mailrc => 'data/01mailrc.txt'
);
my $sponsorfile = 'sponsors.json';
my (%AUTHORS,%PREFS,@SPONSORS,$MT,$IHEART,$serializer);
my %MODES = (
daily => { type =
rializer->new(
detect_compression => 1,
detect_sereal => 1,
detect_json => 1,
);
return $self;
}
sub check_reports {
my $self = shift;
my $mode
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/
urceType',
as 'Str',
where { $_ =~ /^(xmldesc|plaintext|json|collation)$/ },
message { 'Source type must be one of xmldesc, plaintext, json, collation' };
subtype 'Sigil',
as 'Str',
where { $_
eclare("v0.1.2");
use 5.010;
use Carp;
use failures qw/vero::api/;
use Mojo::UserAgent;
use Mojo::JSON 'j';
use Moo;
use namespace::autoclean;
has ua => (
is => 'rw',
builder => 1,
);
su
$email;
my $tx = $self->ua->post(
'https://api.getvero.com/api/v2/users/track.json',
json => {
auth_token => $self->token,
($id ? (id => $id) : ()
pi->throw("Vero API returned error: code $code, error $err, data " . j($tx->res->json));
}
return $tx->res->json;
}
sub track_event {
my ($self, $event_name, %info) = @_;
my $id =
o;
with qw/
Google::Client::Role::Token
Google::Client::Role::FurlAgent
/;
use Carp;
use Cpanel::JSON::XS;
has base_url => (
is => 'ro',
default => 'https://www.googleapis.com/drive/v3/files
ovided") unless ($id);
$content = $content ? encode_json($content) : undef;
my $url = $self->_url("/$id/copy", $params);
my $json = $self->_request(
method => 'POST',
url
=> $url,
content => $content
);
return $json;
}
sub create {
my ($self, $params, $content) = @_;
unless ( $content && %$content ) {
confess("No content provided to cr
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
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