dJSON;
$Limper::SendJSON::VERSION = '0.003';
use base 'Limper';
use 5.10.0;
use strict;
use warnings;
package # newline because Dist::Zilla::Plugin::PkgVersion and PAUSE indexer
Limper;
use JSON:
push @Limper::EXPORT, qw/send_json/;
sub send_json {
my ($data, @options) = @_;
response->{headers}{'Content-Type'} //= 'application/json';
try {
JSON::MaybeXS->new(@options)->enc
or Pod::Coverage
=head1 NAME
Limper::SendJSON - adds a send_json function to Limper
=head1 VERSION
version 0.003
=head1 SYNOPSIS
use Limper::SendJSON;
use Limper; # this must come after al
Same thing, faster to type.
-policy A VM::EC2::Security::Policy object, or a JSON string
complying with the IAM policy syntax.
The duration must be no shorte
'SIGNATURE' ) {
push( @files, 'SIGNATURE' );
}
# check META.json if it's there
if ( -e 'META.json' ) {
push( @files, 'META.json' );
}
plan tests => ( ( scalar @files ) * 4 ) + ( ( scalar @p
check for metadata dependencies
use Test::More;
use File::Slurp 9999.13;
use YAML::Any 0.72;
use JSON::Any 1.25;
use File::Find::Rule 0.32;
use Perl::PrereqScanner 1.000;
use Test::Deep 0.108;
use CP
a
my $runtime_req;
my $test_req;
my $provides;
if ( -e 'META.json' ) {
my $file = read_file( 'META.json' );
my $metadata = JSON::Any->new->Load( $file );
$runtime_req = $metadata->{'prereqs'
$provides = $metadata->{'provides'} if exists $metadata->{'provides'};
} else {
die 'No META.(json|yml) found!';
}
# Okay, scan the files
my $found_runtime = CPAN::Meta::Requirements->new;
my
JSON string that can be passed to
VM::EC2->get_federation_token(), or other AWS libraries.
=head1 STRING OVERLOADING
When used in a string context, this object will interpolate into the
policy JSON
text. In addition,
please see DISCLAIMER.txt for disclaimers of warranty.
=cut
use strict;
use JSON;
use VM::EC2;
use Carp 'croak';
use overload
'""' => 'as_string',
fallback => 1;
su
cal $self->{statements};
$self->deny('*');
return $self->as_string;
}
my $json = JSON->new();
$json->canonical(1);
return $json->encode({Statement => \@list});
}
1;
oken from its JSON representation (e.g. as returned
# from instance metadata of an instance that is assigned an IAM role
my $token = VM::EC2::Security::Credentials->new_from_json($json);
# open a
ew_from_json {
my $class = shift;
my ($data,$endpoint) = @_;
eval "require JSON; 1" or die "no JSON module installed: $@"
unless JSON->can('decode');
my $hash = JSON::from_json($data)
already, and will have the following format
=over
=item id
identifier of the user
=item data
json data, in the following form:
{
_id: "njfranck",
login: "njfranck",
name: "Nicolas F
ane;
use Moo;
use Types::Standard qw( Bool );
use URI::Template;
extends 'Catmandu::Importer::getJSON';
our $AUTHORITY = 'cpan:JONASS';
our $VERSION = '0.001';
has api => (
is => 'ro',
def
',
lazy => 1,
builder => sub {
URI::Template->new( $_[0]->api . '{/topic,reference}?format=json' );
}
);
has '+from' => (
is => 'ro',
lazy => 1,
builder => \&_build_from,
);
has d
ies Parltrack for entities.
=head1 CONFIGURATION
This importer extends L<Catmandu::Importer::getJSON>, so it can be configured
with options C<agent>, C<timeout>, C<headers>, C<proxy>, and C<dry>. Ad
ould "just work". The plugin will figure
out everything it needs from your C<distmeta> (i.e. META.json) and
C<Changes> file (if it exists). Here are a few hints though...
=over
=item *
For this mod
presents people as structured resources, while META.json represents
them as strings. This module expects authors and contributors listed in
META.json to conform to one of the following formats:
Jo
_perlscript_ok($options);
_from_perlmodule_ok($options);
_from_metayml_ok($options);
_from_metajson_ok($options);
_check_for_license_file($options);
if (not $options->{strict}) {
$test->ok($pa
om_metajson_ok
#######
sub _from_metajson_ok {
my $options = shift;
my $test = Test::Builder->new;
if (-e 'META.json') {
try {
my $meta_json = Parse::CPAN::Meta->load_file('META.json');
or = $meta_json->{author}[0];
my @guess_json
= _hack_guess_license_from_meta(@{$meta_json->{license}});
my @guess_json_meta_name;
my @guess_json_url;
for (0 .. $#guess_json) {
pus
me=>"elsheshtawy", phone=>{mobile=>"012222333", home=>"02222444"}};
$encoded = $app->freeze->json($data);
$encoded = $app->freeze->yaml($data);
$encoded = $app->freeze->storable($data);
->xml($data);
# also serialize method is an alias for freeze
$encoded = $app->serialize->json($data);
=head1 DESCRIPTION
Nile::Serializer - Data structures Serializer
=cut
#use Nile::Base
~~~~~~~~~~~~~~~~~
=head2 json()
$data = {fname=>"ahmed", lname=>"elsheshtawy", phone=>{mobile=>"012222333", home=>"02222444"}};
$encoded = $app->freeze->json($data);
# returns:
end
my $json = $mailjet->send('apikey');
All "post" methos are called on send_post
my $data = ( 'name' =>'Name' , 'DateType'=> "str", 'NameSpace' : 'static' );
my $json = $mailjet-
actmetadata' , %data);
All "put" methos are called on send_put
my $data = ( 'title' => 'Update title of the Newsletter' );
my $json = $mailjet->send_put('newsletter/123' , %data);
=cut
uccess) {
if ($response->header('content-type') eq 'application/json') {
my $content = from_json($response->decoded_content);
$error = $content->{error};
~~~~
=head2 Json
$json = $app->freeze->Json;
$encoded = $json->utf8->encode($data);
Returns L<JSON> object.
=cut
has 'Json' => (
is => 'rw',
isa => 'JSON',
la
zy => 1,
default => sub {
load JSON;
JSON->new;
}
);
=head2 Yaml
$yaml = $app->freeze->Yaml;
Returns L<YAML> object.
=cut
has 'Yaml' => (
is
efault => sub {
load YAML;
YAML->new;
}
);
=head2 Storable
$json = $app->freeze->Storable;
Returns "Storable" string. L<Storable> deos not suppot new method.
=c
uery} = undef;
$self->{_filter} = undef;
$self->{_chromosome} = undef;
$self->{_format} = "json";
bless($self, $class);
return $self;
}
sub search_protein() {
my $self = shift;
my %p
type_text {
my ($self, $content_type) = @_;
return $content_type =~ /(\bx(?:ht)?ml\b|text|json|javascript)/;
}
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sub result
S_NUMERIC_VALUE
do not process numeric value.
use JSON;
use Data::Recursive::Encode;
my $data = { int => 1 };
is encode_json( Data::Recursive::Encode->encode_utf8($data) ); #=> '{"
int":"1"}'
local $Data::Recursive::Encode::DO_NOT_PROCESS_NUMERIC_VALUE = 1;
is encode_json( Data::Recursive::Encode->encode_utf8($data) ); #=> '{"int":1}'
=back
=head1 METHODS
=over 4
=i
Nile::Deserializer - Data structures deserializer
=head1 SYNOPSIS
$data = $app->thaw->json($encoded);
$data = $app->thaw->yaml($encoded);
$data = $app->thaw->storable($encoded);
l($encoded);
# also deserialize method is an alias for freeze
$data = $app->deserialize->json($encoded);
=head1 DESCRIPTION
Nile::Deserializer - Data structures deserializer
=cut
use Nile
~~~~~~~~~~~~~~~~~
=head2 json()
$encoded = qq!{"lname":"elsheshtawy","fname":"ahmed","phone":{"home":"02222444","mobile":"012222333"}}!;
$data = $app->thaw->json($encoded);
# return
d from the API webpage.
For the moment the results obtained from the API are in pure HTML, XML or JSON.
=head2 Search functionalities
=head3 Search Protein
Search proteins matching the query or sea
$np->search_cv(-query => "colon", -filter => "keyword");
=head3 Format:
Output format maybe in JSON (default), HTML or XML.
@result = $np->search_protein(-query => "kinase", -filter => "disease"
_info(-query => "NX_P13051", -retrieve => "expression");
=head3 Format:
Output format maybe in JSON (default), HTML or XML.
@result = $np->get_protein_info(-query => "NX_P13051", -retrieve => "ex
ER::ignores_guts($type) if $type ne "manifest";
return <<'HERE'
^_
^\.
^MYMETA\.yml$
^MYMETA\.json$
^_build
^Build$
^blib
^MANIFEST\.
^README\.pod$
# Avoid version control files.
\bRCS\b
\bCVS\b