hat. That way you can
# interactively browse XML or YAML files. Supported suffixes are: xml,
# json, csv, yml, ini, conf.
# If the data structure evaulates, you'll be dropped into an interactive
#
elsif ($arg =~ /\.json$/i) {
eval { require JSON; };
die "Sorry, JSON is not installed, JSON not supported!\n" if($@);
my $json = JSON->new->utf8();
$code = $json->decode(slurp($arg)
leware::WOVN::Store;
use strict;
use warnings;
use utf8;
use parent 'Class::Accessor::Fast';
use JSON;
use LWP::UserAgent;
use Plack::Middleware::WOVN::Lang;
__PACKAGE__->mk_accessors(qw/ config_lo
en&url=$url");
my $values = {};
if ( $res->is_success ) {
$values = eval { JSON::decode_json( $res->content ) } || {};
}
$values;
}
1;
__END__
=head1 NAME
Plack::Middlewa
ON = eval $VERSION;
use Carp;
use Future;
use Future::Utils qw( repeat );
use JSON::MaybeXS qw( encode_json decode_json );
use Data::Dump 'pp';
use File::stat;
use List::Util 1.29 qw( pairmap );
us
shift;
return $v if !ref $v or blessed $v;
return $v if ref $v ne "HASH";
return encode_json( $v );
}
sub _uri_for_path
{
my $self = shift;
my ( $path, %params ) = @_;
$path = "/$
};
# Some parameter values can be JSON-encoded objects
$uri->query_form( pairmap { $a => _maybe_encode $b } %params );
return $uri;
}
sub _do_GET_json
{
my $self = shift;
my ( $path,
undef;
}
sub _do_GET_json
{
my $self = shift;
my ( $path, @args ) = @_;
$self->{matrix}->_do_GET_json( "/rooms/$self->{room_id}" . $path, @args );
}
sub _do_PUT_json
{
my $self = shift
>{matrix}->_do_PUT_json( "/rooms/$self->{room_id}" . $path, $content );
}
sub _do_POST_json
{
my $self = shift;
my ( $path, $content ) = @_;
$self->{matrix}->_do_POST_json( "/rooms/$self->{
ew room name.
=cut
sub set_name
{
my $self = shift;
my ( $name ) = @_;
$self->_do_PUT_json( "/state/m.room.name", { name => $name } )
->then_done();
}
=head2 aliases
@aliases =
sts into stash. Then, Extends with Class::Trigger!
=head1 SYNOPSIS
use Stash::REST;
use JSON;
$obj = Stash::REST->new(
do_request => sub {
my $req = shift;
},
decode_response => sub {
my $res = shift;
return decode_json($res->content);
}
);
# you can write/read stash anytime
$obj->stash('foo') #
u can use this to modify the default HTTP::Request::Common header for $data
# POST body with JSON:
$obj->rest_post(
'/post-with-params?api_key=1',
stash => 'testparams',
se 5.008005;
use Mouse;
our $VERSION = "0.01";
use Furl;
use URI;
use Carp ();
use JSON qw(decode_json encode_json);
my $api_base_uri = 'https://www.pivotaltracker.com/services/v5/';
has 'token' =
$self->timeout );
},
);
no Mouse;
sub _request {
my ($self, $method, $end_point, $data_json, @additional_header) = @_;
my $ua = $self->ua;
my $uri = $self->api_base_uri . $end_poin
= Furl::Request->new($method, $uri, ['X-TrackerToken' => $self->token, @additional_header], $data_json);
my $res = $ua->request($req);
unless ( $res->is_success ) {
Carp::croak $res->s
.hiv.lanl.gov/content/sequence/LOCATE/locate.html>
web tool and is also used to power
L<a simple, JSON-based web API|https://indra.mullins.microbiol.washington.edu/locate-sequence/>
for the same tool
tself.
=head1 EXAMPLE RESULTS
# Using @sequences from the SYNOPSIS above
use JSON;
print encode_json(\@sequences);
__END__
[
{
"query" : "sequence_1",
rictures 1;
use utf8;
use 5.018;
=head1 NAME
Bio::WebService::LANL::SequenceLocator::Server - A JSON web API for LANL's HIV sequence locator
=head1 SYNOPSIS
After installation:
plackup `perld
managed service:
examples/service start
=head1 DESCRIPTION
This server powers
L<a simple, JSON-based web API|https://indra.mullins.microbiol.washington.edu/locate-sequence/>
for the L<LANL's H
Simple;
use Bio::WebService::LANL::SequenceLocator;
use File::Share qw< dist_file >;
use JSON qw< encode_json >;
use Text::CSV;
use Plack::App::File;
use Path::Tiny;
use IO::String;
has contact => (
s;
use MooseX::App::Simple;
use Email::MIME::Kit::Bulk;
use Email::MIME::Kit::Bulk::Target;
use JSON;
use MooseX::Types::Path::Tiny qw/ Path /;
use PerlX::Maybe;
option kit => (
is => 'ro
=> 'ro',
isa => Path,
lazy => 1,
default => sub { shift->kit->child('targets.json') },
);
sub BUILD {
my $self = shift;
die 'Kit directory must have a manifest'
rep {
my $f = $_->basename;
$f =~ /^manifest\./ && $f =~ /\.json$/
} $self->kit->children;
die 'Cannot find target specification (' . $self->_
et::Moip::V2::Endpoint;
use IO::Socket::SSL;
use MIME::Base64;
use Furl;
use JSON::MaybeXS ();
use Moo;
my $JSON = JSON::MaybeXS->new->utf8;
has 'path', is => 'ro', required => 1;
has 'api_url',
on/json',
'Authorization' => $self->_authorization_string
]);
}
sub post {
my ($self, $data) = @_;
$self->ua->post($self->url, [
'Content-Type' => 'application/json',
'Authorization' => $self->_authorization_string
], $JSON->encode($data) );
}
sub oauth_get {
my $self = shift;
local $self->{is_oauth} = 1;
$self->get(@_);
}
sub oauth_post
::Socket::SSL;
use MIME::Base64;
use Furl;
use JSON::MaybeXS ();
use Moo;
use URI;
use Net::Moip::V2::Endpoint;
our $VERSION = "0.06";
my $JSON = JSON::MaybeXS->new->utf8;
has 'ua', is => 'ro', de
> 'no-cache'
], $body);
return { error => $res->status_line } if $res->code >= 500;
$JSON->decode($res->content);
}
sub endpoint {
my ($self, $path, $params) = @_;
die "Syntax
my $endpoint = shift;
$self->endpoint($endpoint)->post(@_);
}
sub decode_json {
my $self = shift;
$JSON->decode($_[0]);
}
1;
__END__
=encoding utf-8
=head1 NAME
Net::Moip::V2 -
use App::Environ;
use App::Environ::Config;
App::Environ::Config->register( qw( foo.yml bar.json ) );
App::Environ->send_event('initialize');
my $config = App::Environ::Config->instance;
= '0.01';
$VERSION = eval $VERSION;
use Mojo::DOM;
use Mojo::IOLoop;
use Mojo::JSON qw(encode_json j);
use Mojo::JSON::Pointer;
use Mojo::UserAgent;
use Mojo::Util qw(decode encode getopt);
use Scal
$method, $url, \%headers, $content));
my $res = $tx->result;
# JSON Pointer
next unless defined $selector;
_json($buffer, $selector) and next if !length $selector || $selector =~ m!^/
ld_start_line, $_[0]->headers->to_string, "\n\n" }
sub _json {
return unless my $data = j(shift);
return unless defined($data = Mojo::JSON::Pointer->new($data)->get(shift));
return _say($data)
d/;
use TOML::Dumper::Name;
use TOML::Dumper::String;
our @BOOLEAN_CLASSES = qw/
JSON::PP::Boolean
JSON::XS::Boolean
/;
sub new {
my ($class, %args) = @_;
my ($name, $atom) = @args{
::Kit::Bulk::ManifestReader::JSON;
use Moose;
extends 'Email::MIME::Kit';
has '+_manifest_reader_seed' => (
default => '=Email::MIME::Kit::Bulk::ManifestReader::JSON',
);
has language => (
::Kit>. It defaults the C<manifest_reader>
attribute to L<Email::MIME::Kit::Bulk::ManifestReader::JSON>, and add a new
C<language> attribute.
=head1 AUTHORS
=over 4
=item *
Jesse Luehrs <doy@c
@parts,
],
);
}
# XXX Email::MIME::Kit reads the manifest.json file as latin1
# fix this in a better way once that is fixed?
my $subject = $email->heade
>.json> to generate its associated email. If no language
is given, the regular C<manifest.json> will be used instead.
If C<emk_bulk> is used, it'll look in the I<kit> directory for a
C<targets.json>
file, which it'll use to create the email targets.
The format of the C<targets.json> file is a simple serialization of
the L<Email::MIME::Kit::Bulk::Target> constructor arguments:
[
{
decoder
=begin MetaPOD::JSON v1.1.0
{
"namespace":"MetaPOD::Exception::Decode::Data",
"interface":"class",
"inherits":"MetaPOD::Exception"
}
=end MetaPOD::JSON
=head1 AUTHOR
Kent Fre
ginal API interface and
simply supplies an OO interface in perl to abstract the need to construct JSON and
web calls. It also uses all of the standard perl modules around these. Below is the
list of a
u with the examples for each of the calls. Each call returns a hashref
that contains the response JSON from Docusign. Errors are passed back with a single
reference $response->{error}. This will conta
) = $role->_supported_versions;
=begin MetaPOD::JSON v1.1.0
{
"namespace": "MetaPOD::Role::Format",
"interface": "role"
}
=end MetaPOD::JSON
=head1 AUTHOR
Kent Fredric <kentnl@cpan.org>
version v0.4.0
=begin MetaPOD::JSON v1.1.0
{
"namespace":"MetaPOD::Exception",
"interface":"class",
"inherits":"Throwable::Error"
}
=end MetaPOD::JSON
=head1 AUTHOR
Kent Fredric <ke