Interface to the Globus research data sharing service
use strict;
use warnings;
use Carp ;
use JSON ;
use Net::OpenSSH ;
=pod
=head1 NAME
Globus - Object-Oriented interface to Globus
=head1 DES
f->{username}, $self->{key_path} ) ;
return {} unless $result =~ m{\w} ;
my $obj = decode_json $result ;
return wantarray ? %$obj : $obj ;
}
sub acl_add {
my ( $self, $endpoint, $
= _globus_action( $command, $self->{username}, $self->{key_path} ) ;
my $slist = decode_json $result ;
my @list = grep { $_->{permissions} ne 'rw' } @$slist ;
return wantarray ? @lis
se JSON::PP ();
our $VERSION = '0.16';
sub opt_c { shift->_elem('opt_c', @_) }
sub live_cpan_url {
my $self = shift;
my $module = shift;
if ($self->opt_c) {
my $module_json =
ibution");
if (!$module_json) {
die "Unable to fetch changes for $module";
}
my $module_details = JSON::PP::decode_json($module_json);
my $dist = $module_de
e);
my $content = $self->fetch_url($url);
if ($self->opt_c) {
$content = JSON::PP::decode_json($content)->{content};
$content = "=pod\n\n$content";
}
return $content;
DATE
our $VERSION = '0.08'; # VERSION
use 5.010;
use strict;
use warnings;
use HTTP::Tiny;
use JSON::MaybeXS;
sub check_latest_version {
my ($mod, $installed_version, $chkres) = @_;
my $r
$res->{reason}"] unless $res->{success};
eval { $res = JSON::MaybeXS::decode_json($res->{content}) };
return [500, "Can't decode JSON API response: $@"] if $@;
return [500, "Error from API
sInfo;
use strict;
use warnings;
use Moose;
use MooseX::NonMoose;
use namespace::autoclean;
use JSON;
use Data::Munge qw/elem/;
use Scalar::Util qw/reftype looks_like_number/;
extends 'DBIx::Class::
ame");
sub decoded_value
{
my $self = shift;
return if not defined $self->value;
return JSON->new->allow_nonref->decode($self->value);
}
sub viable_type_conversions {
my $self = shift;
f->decoded_value;
if (ref $value) {
if (ref $value =~ /Bool/) {
# JSON::Boolean, JSON::PP::Boolean, etc
$self->data_type('bool')
}
elsif (reftype $
exists $INC{$module};
return undef;
}
sub been_numeric {
my $value = shift;
# From Mojo::JSON
return 1 if B::svref_2object(\$value)->FLAGS & (B::SVp_IOK | B::SVp_NOK)
and 0 + $value e
uest;
use JSON;
use List::Util qw/first/;
use LWP::UserAgent;
use Moo;
use Ouch;
use URI;
use Sys::SigAction qw( timeout_call );
# ABSTRACT: API client for Stripe
my $REST_FORMAT = 'json';
# https
my $req = HTTP::Request->new (GET => $dns_uri);
$req->content_type('application/json');
my $lwp = LWP::UserAgent->new;
$lwp->timeout($timeout);
$
s_uri->query_form( $params );
my $res = $self->rest_call($dns_uri);
my $response = from_json($res->content);
unless (ref($response) eq 'ARRAY') {
return { ok => 0, msg => $respo
7-06-09.
=head1 SYNOPSIS
In your command-line script (e.g. named list-cpan-dists):
use JSON qw(decode_json);
use LWP::Simple;
use Perinci::CmdLine::Easy qw(run_cmdline_app);
run_cmdline_app(
status:latest&fields=name&size=5000"
or die "Can't query MetaCPAN";
$res = $json->decode($res);
die "MetaCPAN timed out\n" if $res->{timed_out};
my @dists;
Class => 'CPANPLUS', Style => 'gettext';
use CPANPLUS::Internals::Source::MetaCPAN::HTTP;
use JSON::PP ();
require Tie::Hash;
use vars qw[@ISA];
push @ISA, 'Tie::StdHash';
sub TIEHASH {
my $
urn unless $status eq '200';
return unless $str = $http->body;
eval { $href = JSON::PP::decode_json( $str ); };
return unless $href and keys %$href;
}
### expand author if n
return unless $str = $http->body;
my $dref;
eval { $dref = JSON::PP::decode_json( $str ); };
return unless $dref and keys %$dref;
( $href->{dist_file
ma->new( storage_class => q(Any) );
my $loaded = $schema->load( 'data_file1.xml', 'data_file2.json' );
=head1 Description
Selects storage class using the extension on the path
=head1 Configurat
nce;
eval {
require JSON::XS;
$instance = JSON::XS->new->utf8->allow_nonref;
1;
} or do {
require JSON;
$instance = JSON->new->utf8->allow_nonref;
}
;
has 'storage_class' => is => 'rw', isa => Str,
default => 'JSON', lazy => TRUE;
has 'tempdir' => is => 'ro', isa => Directory,
coerce
ibutes
Creates a new instance of the storage class which defaults to
L<File::DataClass::Storage::JSON>
Defines these attributes
=over 3
=item C<cache>
Instantiates and returns the L<Cache|File::D
d::Input::Feed::Run;
use strict;
use warnings;
use BusyBird::Input::Feed;
use LWP::UserAgent;
use JSON;
use Carp;
sub run {
my ($class, %opts) = @_;
my $download_url = $opts{download_url};
put::Feed->new(
defined($user_agent) ? (user_agent => $user_agent) : ()
);
my $json = JSON->new->utf8->ascii;
my $statuses = _parse_feed($input, $download_url);
if(defined($lev
->{busybird}{level} = $level;
}
}
my $statuses_json = $json->encode($statuses) . "\n";
_post_statuses(\$statuses_json, $post_url, $user_agent);
}
sub _parse_feed {
my ($input,
#!/usr/bin/env perl
use JSON::XS;
use Template;
use Data::Dumper;
use feature qw(say);
open(FI,"data/models.json");
my $data = JSON::XS::decode_json(join("",<FI>));
my $tt = Template->new();
foreach
mgur::API::Stats;
use Data::Dumper;
use LWP::UserAgent;
use HTTP::Message;
use HTTP::Request;
use JSON::XS;
use URI::Escape;
use Moo;
has client_secret=>(is=>'ro');
has client_id=>(is=>'ro',required
PI::Stats->new();});
sub request {
my ($this,$path,$method,$params) = @_;
$params->{_format}="json";
$this->ua->agent("Imgur::API/0.0,1");
my $auth;
if ($this->access_token) {
$auth="Bearer
cation/json") {
$this->stats->update($response);
my $json = JSON::XS::decode_json($response->decoded_content);
if (!$json->{success}) {
my $e = Imgur::API::Exception->new(code=>$json->{stat
strict;
use warnings;
package Apache::Tika;
use Encode qw/decode_utf8/;
use LWP::UserAgent;
use JSON::MaybeXS();
our $VERSION = '0.07';
sub new {
my ($this, %pars) = @_;
my $self = bless {}, $t
ua} // LWP::UserAgent->new();
$self->{url} = $pars{url} // 'http://localhost:9998';
$self->{json} = JSON::MaybeXS->new();
return $self;
}
sub _request {
my ($self, $method, $path, $headers, $bod
'put',
'meta',
{
'Accept' => 'application/json',
$contentType? ('Content-type' => $contentType) : ()
},
$bytes
);
return $self->{json}->decode($meta);
}
sub rmeta {
my ($self, $byt
cf = Mojo::CallFire->new(username => '...', password => '...');
say $cf->get('/calls')->result->json('/items/0/id');
=head1 DESCRIPTION
A simple interface to the CallFire API.
Currently only L<
#!/usr/bin/env perl
use JSON::XS;
use Template;
use Data::Dumper;
use feature qw(say);
open(FI,"data/endpoints.json");
my $data = JSON::XS::decode_json(join("",<FI>));
my $tt = Template->new();
fore
#!/usr/bin/env perl
use JSON::XS;
use Template;
use Data::Dumper;
use feature qw(say);
open(FI,"data/endpoints.json");
my $data = JSON::XS::decode_json(join("",<FI>));
my $tt = Template->new();
fore
se Data::Dumper;
use JSON::XS;
use HTML::TreeBuilder::LibXML;
use LWP::UserAgent;
use HTTP::Message;
use Template;
use Try::Tiny;
my $template = Template->new();
my $json = JSON::XS->new->pretty;
m
ok_down(_tag=>'div',class=>'textbox');
my ($example) = ($content->look_down(_tag=>"div",class=>"json"));
if ($example) {
my $ext = $example->as_text;
$ext=~s/\n//g;
$ext=~s/\s{2,}//g;
$ext=
t=~s/[^'|"](\w+):[^\/]/"$1":/g;
$ext=~s/""/","/g;
try {
$res->{example} = $json->encode($json->decode($ext));
} catch {
$res->{example} = $example->as_text;
};
}
$res->{des
use strict;
sub is_success { 1; }
sub new {
my ($class,$json) = @_;
my $this = $json->{data};
if (ref($this) ne "HASH") {
$this={data=>$json->{data}};
}
return bless $this,$class;
}
1;