er be gathered
my @never_gather = grep -e, qw(
Makefile.PL ppport.h README.md README.pod META.json
cpanfile TODO CONTRIBUTING LICENCE LICENSE INSTALL
inc/ExtUtils/MakeMaker/Dist/Zilla/Deve
on.max_target_perl'} < '5.008');
warn '[@Author::ETHER] ', colored('.git is missing and META.json is present -- this looks like a CPAN download rather than a git repository. You should probably r
ake') . ' instead of using dzil commands!', 'yellow'), "\n"
if not -d '.git' and -f 'META.json' and not $self->_plugin_removed('Git::GatherDir');
# only set x_static_install using auto mo
f (SvOBJECT(ref)) {
if (reftype < SVt_PVAV) { // blessed scalar ref
if (sv_isa(sv, "JSON::PP::Boolean")) {
return SViv_to_neo4j_bool(ref);
}
}
if (reftype =
ewSVsv(neo4j_bool_value(value) ? &PL_sv_yes : &PL_sv_no);
#else
HV* boolean_stash = gv_stashpv("JSON::PP::Boolean", GV_ADD);
SV* scalar = newSViv( (IV) neo4j_bool_value(value) );
return sv_bless
nfig()|Log::Report::Domain/"Attributes">.
Example of such configuration file: (JSON syntax and Perl syntax)
=== JSON === ==== Perl == =
{{
"context_rules" : {
-- ---- --------------
Null undef
Bool Perl core bool (v5.36+) or JSON::PP::Boolean
Int scalar
Float scalar
String scalar
Bytes
SvRV(sv);
if (SvTYPE(ref) < SVt_PVAV) { // scalar ref
if (SvOBJECT(ref) && sv_isa(sv, "JSON::PP::Boolean")) {
return &PL_sv_yes;
}
if (SvIOK(ref) && SvIV(ref) >> 1 == 0)
}
if (-f 'META.json') {
my $meta = CPAN::Meta->load_file('META.json');
if (!$meta->dynamic_config) {
return { type => 'metafile', path => 'META.json' };
}
PL';
my @cmd = ($^X, $build_file);
warn "Executing $build_file to generate MYMETA.json and to determine requirements...\n";
local %ENV = (
PERL5_CPAN_IS_RUNNING =>
}
if (!-f 'MYMETA.json') {
die "Error: No MYMETA.json after executing $build_file\n";
}
return { type => 'metafile', path => 'MYMETA.json' };
}
return;
}
nd_as(JSON => {
error => 1,
error_description => $msg->toString,
}, {
content_type => 'application/json; charset=UTF-8',
});
};
example: Return JSON resp
lication/json
fatal_handler sub {
my ($dsl, $msg, $reason, $default) = @_;
(my $ctype = $dsl->request->header('content-type')) =~ s/;.*//;
return if $ctype ne 'application/json';
s
ror' : 'Bad Request';
$dsl->send_as(JSON => {
error => 1,
description => $msg->toString,
}, {
content_type => 'application/json; charset=UTF-8',
});
};
=item $
y $hash = $tx->req->params->to_hash;
my $all = $tx->req->uploads;
my $value = $tx->req->json;
=head2 res
C<has res : rw L<Mojo::Message::Response|SPVM::Mojo::Message::Response>;>
HTTP res
ader");
my $bytes = $tx->res->body;
my $str = $tx->res->text;
my $value = $tx->res->json;
=head2 connection
C<has connection : rw L<Mojo::Connection|SPVM::Mojo::Connection>;>
Connecti
#!/usr/bin/env perl
package
Greetings_CLI_JSON;
use MOP4Import::Base::CLI_JSON -as_base
, [fields =>
[name => doc => 'Name of someone to be greeted'
, default => 'world'
],
qw
pfile);
use List::Util qw(max);
use POSIX qw(strftime);
use Pod::Usage;
use Term::ANSIColor;
use JSON;
use WWW::Noss::Curl qw(curl curl_error http_status_string);
use WWW::Noss::DB;
use WWW::Noss::F
$/ = undef; readline $fh };
close $fh;
my $json_obj = JSON->new->relaxed;
my $json = $json_obj->decode($slurp);
unless (ref $json eq 'HASH') {
die "$self->{ ConfFile } is no
id $PRGNAM configuration file\n";
}
if (defined $json->{ feeds }) {
if (not ref $json->{ feeds }) {
my $p = $json->{ feeds } =~ s/^~/@{[ home ]}/r;
$self->{ Fe
eval { require LWP::Simple::WithCache; require JSON::Parse } )) {
$self->_debug("Look up $ip on geoplugin");
LWP::Simple::WithCache->import();
JSON::Parse->import();
if(my $data = LWP::Simpl
e::WithCache::get("http://www.geoplugin.net/json.gp?ip=$ip")) {
$self->{_country} = JSON::Parse::parse_json($data)->{'geoplugin_countryCode'};
}
}
unless($self->{_country}) {
$self->_debug("L
l { require LWP::Simple::WithCache; require JSON::Parse } ) {
$self->_debug("Look up $ip on ip-api.com");
LWP::Simple::WithCache->import();
JSON::Parse->import();
if(my $data = LWP::
JSON API request with Basic authentication
my $url = (my $_ = Mojo::URL->new("https://example.com/test.json"), $_->set_userinfo("sri:☃"), $_);
my $value = $ua->get($url)->result->json;
# JSON
POST (application/json) with TLS certificate authentication
my $tx = ($ua->set_cert("tls.crt"), $ua->set_key("tls.key"), $ua->post("https://example.com" => [(object)json => {top => "secret"}]));
p("socks://127.0.0.1:9050");
$ua->get("api.3g2upl4pq6kufc4m.onion/?q=mojolicious&format=json")->result->json;
# GET request via UNIX domain socket "/tmp/myapp.sock" (percent encoded slash)
say
ings;
our $VERSION = '2.00';
use List::Util qw(all any max none);
use DBD::SQLite;
use DBI;
use JSON;
use WWW::Noss::FeedReader qw(read_feed);
use WWW::Noss::Util qw(resolve_url);
my %DAY_MAP = (
encode_json($feedref->{ category }) : undef),
$feedref->{ generator },
$feedref->{ image },
$feedref->{ rights },
(defined $feedref->{ skiphours } ? encode_json($feedr
ef->{ skiphours }) : undef),
(defined $feedref->{ skipdays } ? encode_json($feedref->{ skipdays }) : undef),
);
my $upsert_post = $self->{ DB }->prepare(
q{
INSERT INTO post
[(object)form => {a => "b"}])->req->to_string;
# PUT request with JSON data
say $t->tx(PUT => "example.com" => [(object)json => {a => "b"}])->req->to_string;
=head1 Generators
These content ge
ntent. See L</"tx"> for more.
=head2 json
$t->tx(PATCH => "http://example.com" => [(object)json => {a => "b"}]);
Generate JSON content with L<JSON|SPVM::JSON>. See L</"tx"> for more.
=head2 mult
nt::Transactor::Callback::Generator>;>
Registered content generators, by default only C<form>, C<json> and C<multipart> are already defined.
=head2 name
C<has name : rw string;>
Value for C<User-A
format '$format', in $use //template
Cast by C<translationFunction()>
=item Fault: cannot open JSON file for context at $fn: $!
Cast by C<readConfig()>
=item Error: extension to domain '$name' al
urn Astro::ADS::Result->new( {error => $error_obj} );
}
my $json = $response->json;
return $self->parse_response( $json );
}
sub query_tree {
my ($self, $terms) = @_;
my $url =
my $response = $self->post_response( $url, $bibcode_list );
my $json = $response->json;
return $self->parse_response( $json );
}
sub gather_search_terms {
my ($self, $terms) = @_;
m
o::ADS::QTree;
use Astro::ADS::Result;
sub parse_response {
my ($self, $json) = @_;
unless ($json && exists $json->{responseHeader}) {
warn 'No response to parse';
return;
ws fl> } = @{$json->{responseHeader}{params}}{ qw<q rows fl> };
$result_params->{status} = @{$json->{responseHeader}}{ status };
@{$result_params}{ qw<numFound start> } = @{$json->{response}}{
numFound start> };
$result_params->{numFoundExact} = $json->{response}{numFoundExact} ? 1 : 0;
my @papers;
for my $paper ( @{$json->{response}->{docs}} ) {
push @papers, Astro::AD
need to do form submission
# hashrefs are sent as JSON
my $tx = ref $content eq 'HASH'
? $self->ua->build_tx( POST => $url, json => $content )
: $self->ua->build_tx( POST => $
=item L<cpanfile|https://metacpan.org/dist/Module-CPANfile/view/lib/cpanfile.pod>
=item L<META.json|https://metacpan.org/pod/CPAN::Meta::Spec> (with dynamic_config false)
=item C<Build.PL>
=item
package DBD::libsql::Hrana;
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request;
use JSON;
use Protocol::WebSocket;
use IO::Socket::SSL;
use Carp;
our $VERSION = "0.05";
# Hrana Protocol
t => $options{timeout} || 30,
agent => "DBD::libsql/$VERSION",
),
json => JSON->new->utf8,
connection_id => undef,
closed => 0,
}, $class;
# De
=> 'application/json');
if ($self->{auth_token}) {
$request->header('Authorization' => 'Bearer ' . $self->{auth_token});
}
$request->content($self->{json}->encode({