H) = @H;
} else {
confess("unknown request $q");
}
}
};
my @a = qw/Cpanel::JSON::XS JSON::XS JSON::PP/;
App::rs->import(iautoload => ['Carp',
[qw'Compress::Zlib memGunzip'],
y $c = $r->{c};
$c = memGunzip($c) if eval { $r->{hv}{'content-encoding'} eq 'gzip' };
if ($o->{json}) { jr($c) }
elsif ($o->{plain}) { $c }
elsif ($o->{html}) { html_parse($c) }
elsif ($o->{sav
MS::Response::Message;
use JSON::PP;
# ABSTRACT: Module that represents a response from Nexmo SMS API!
our $VERSION = '0.01';
# create getter/setter
my @attrs = qw(json message_count status);
for
return $self if !$param{json};
# decode json
my $coder = JSON::PP->new->utf8->pretty->allow_nonref;
my $perl = $coder->decode( $param{json} );
$self->message_count
se from Nexmo.
use Nexmo::SMS::Response;
my $nexmo = Nexmo::SMS::Response->new(
json => '{
"message-count":"1",
"messages":[
{
"st
:SMS::TextMessage;
use strict;
use warnings;
use Nexmo::SMS::Response;
use LWP::UserAgent;
use JSON::PP;
# ABSTRACT: Module that respresents a text message for the Nexmo SMS API!
our $VERSION = '
f $response;
return;
}
my $json = $response->content;
my $response_object = Nexmo::SMS::Response->new( json => $json );
if ( $response_object->is_error ) {
ge;
my $nexmo = Nexmo::SMS::TextMessage->new(
server => 'http://rest.nexmo.com/sms/json',
username => 'testuser1',
password => 'testpasswd2',
text => 'This i
see L<Device::Power::Synaccess::NP05B> for details.
=head1 OPTIONS
-p Pretty-format json output
-q Do not print results of command to stdout
--addr=<#> Dotted IP address of
dmin)
=head1 COMMANDS
Command results are written to stdout as JSON of one of the two formats:
[<operation>, "OK", <optional JSON object>]
[<operation>, "ERROR", <error description>]
Comma
signature($dist) or return;
}
require CPAN::Meta;
my($meta_file) = grep -f, qw(META.json META.yml);
if ($meta_file) {
$self->chat("Checking configure dependencies from $meta_
le($meta_file) };
} elsif ($dist->{dist} && $dist->{version}) {
$self->chat("META.yml/json not found. Creating skeleton for it.\n");
$dist->{cpanmeta} = CPAN::Meta->new({ name => $
require JSON::PP;
open my $fh, ">", "blib/meta/install.json" or die $!;
print $fh JSON::PP::encode_json($local);
File::Copy::copy("MYMETA.json", "blib/meta/MYMETA.json");
my @c
e warning_message);
our $VERSION = "1.004";
use Moose::Role;
use HTTP::Tiny;
use JSON::XS qw(encode_json decode_json);
use URI::Escape qw(uri_escape);
has 'issue' => (
is => 'rw',
$self->gitlab_client->request($method,$url);
if ($res->{success}) {
my $data = decode_json($res->{content});
return $data;
}
error_message(join(" ",$res->{status}, $res->{r
use Nexmo::SMS::Response::Message;
my $nexmo = Nexmo::SMS::Response::Message->new(
json => '{
"status":"4",
"message-id":"message001",
"client-
THODS
=head2 new
create a new object
my $foo = Nexmo::SMS::Response::Message->new(
json => '
{
"status":"4",
"message-id":"message001",
# ABSTRACT: HiD GitRepository Class
use Moose;
use File::Basename;
use File::ShareDir ':ALL';
use JSON;
use DateTime;
use DateTime::TimeZone;
use Data::Dumper;
use strict;
use warnings;
our $VERSION
y $json_text = do {
open(my $json_fh, "<:encoding(UTF-8)", $shared."/extensions.json")
or die("Can't open \$filename\": $!\n");
local $/;
<$json_fh>
};
my $extensions=from_json($json_t
n_value => 'dump';
use HTTP::Request;
use HTTP::Headers;
use LWP::UserAgent;
use URI::Escape;
use JSON;
has blocks => ( is => 'ro', required => 1 );
has page_root => ( is => 'ro', required => 1 );
ha
$to =~ s/\$\{dollar\}/\$/g;
my ($wrap_jsonp_callback, $callback, $wrap_string_callback, $missing_envs, $headers) =
($rewrite->wrap_jsonp_callback, $rewrite->callback, $rewrite->wrap_s
$body;
warn "Cannot use wrap_jsonp_callback and wrap_string callback at the same time!" if $wrap_jsonp_callback && $wrap_string_callback;
if ($wrap_jsonp_callback && $callback) {
$
eadBIDSJson
read TR MRstart and crate MRend from BIDS style json output
(e.g. created by dcm2niix).
must already have nDcms (number of volumes in 4d) set
=cut
sub readBIDSJson() {
use JSON qw/dec
;
my $jsonfile=shift;
open my $JS, '<', $jsonfile or
croak "could not open BIDS JSON '$jsonfile'";
my $data = decode_json(do{local $/; <$JS>}) or
croak "could not parse JSON in '$jsonfile'"
s($offby) > $maxDiffSec);
return 1;
}
# DICOM Acq Time is fmt like HHMMSS.SS (172745.487500)
# JSON BIDs AcqTime like 2018-06-15T17:27:45.487500
sub getMRAcqSecs {
$_=shift;
m/^(?<HH>\d{2})(?<M
});
}
if (!-d '.git' and -f 'META.json' and !exists $removed{'Git::GatherDir'})
{
_warn_me(
'.git is missing and META.json is present -- this looks like a CPAN downlo
check_all_prereqs => 1
}
],
qw(PruneCruft ManifestSkip MetaYAML MetaJSON),
['License' => { filename => $self->license }],
['ReadmeFromPod' => { type =>
d "decode" subroutines in
#pod modules like L<JSON>, L<JSON::XS>, etc.
#pod
#pod use zim 'JSON::XS';
#pod
#pod imports C<encode_json> and C<decode_json>, which is probably
#pod what you want while
of "encode" and "decode" subroutines in
modules like L<JSON>, L<JSON::XS>, etc.
use zim 'JSON::XS';
imports C<encode_json> and C<decode_json>, which is probably
what you want while writing quick
use Plack::Request;
use Plack::Response;
use LWP::UserAgent;
use URI::Escape;
use Path::Tiny;
use JSON;
has sites => ( is => 'ro', required => 1 );
has _ports => ( is => 'rw', default => sub {{}} );
ite}->{url};
my $data_file = path($site.'.json');
die "Missing JSON publisher data file for ".$site unless $data_file->is_file;
my $data = decode_json($data_file->slurp_utf8);
my %urls;
for
he parameters that get passed to the L<Log::Any::Adapter>.
=head2 consume
Consumes a message by JSON encoding it and printing it, followed by \n
=head1 AUTHOR
Alexander Hartmaier <abraxxa@cpan.org
=> exists( $data->{message} )
# ? delete( $data->{message} )
# : encode_json($data),
# '@fields' => $data,
# exists( $data->{uuid} ) ? ( id => delete( $
use File::Basename;
use File::Spec::Functions qw(catfile tmpdir);
use Carp;
use IO::Handle;
use JSON;
use Time::HiRes 'gettimeofday';
use parent 'Exporter';
our @EXPORT_OK;
our $VERSION = '1.01';
{
$data = $_[0];
}
else {
$data = [$_[0]];
}
print STDERR encode_json($data), "\n";
}
sub date {
my($fh) = ($_[0] && $_[0] =~ /^STDOUT$/i ? 'STDOUT' : 'STDERR');
a timestamp to STDERR (C<date('STDOUT')> prints it to STDOUT).
You can also dump random data as JSON to STDERR by calling any function name you want. Just import the name you want to use.
=head1 A
strict;
use POSIX qw/strftime/;
use Data::Dumper;
use Mail::Sendmail();
use CGI qw( escape );
use JSON::XS;
use CGI::OptimalQuery::Base();
sub escapeHTML { CGI::OptimalQuery::Base::escapeHTML(@_) }
id("","","","");
}
$$o{output_handler}->($$o{httpHeader}->('application/json').encode_json({ status => "ok", msg => "search saved successfully", id => $rec{id} }));
}; if ($@) {
ndler}->("err", $err);
}
$$o{output_handler}->($$o{httpHeader}->('application/json').encode_json({ status => "error", msg => $err }));
}
return undef;
}
}
sub on_open {
my (
package CGI::OptimalQuery::LoadSearchTool;
use strict;
use JSON::XS();
use CGI::OptimalQuery::Base();
sub escapeHTML { CGI::OptimalQuery::Base::escapeHTML(@_) }
sub load_default_saved_search {
my
tch
$App::DuckPAN::Fathead::VERSION = '1021';
use Moo;
with 'App::DuckPAN::HasApp';
use DBI;
use JSON;
use Path::Tiny;
use HTML::TreeBuilder;
use HTML::Element;
use Data::Printer return_value => 'dum
$out->{data} = { %$data, %extra_data };
return $out;
}
# Emulate internal processing to build JSON
# matching DDG API result format
sub _parse_disambiguations {
my ($self, $disambiguations, $out)
$text
};
}
push @out, $result;
}
return \@out;
}
# Emulate internal processing to build JSON
# matching DDG API result format
sub _get_image {
my ($self, $image) = @_;
my $url = "";
if ($
loadCSV href=#>CSV (Excel)</a>,
<a class=OQDownloadHTML href=#>HTML</a>,
<a class=OQDownloadJSON href=#>JSON</a>,
<a class=OQDownloadXML href=#>XML</a>";
}
sub activate {
my ($o) = @_;
$$o{schema