head1 SYNOPSIS
use Dancer2::RPCPlugin::DispatchItem;
use Dancer2::Plugin::RPC::JSON;
jsonrpc '/json' => {
publish => sub {
return {
'system.ping' => Da
opicalCyclone;
use strict;
use warnings;
use HTTP::Tiny ();
use HTTP::Status qw/:constants/;
use JSON::XS ();
use Util::H2O qw/h2o/;
use Weather::NHC::TropicalCyclone::Storm ();
our $VERSION
= q{0.34};
our $DEFAULT_URL = q{https://www.nhc.noaa.gov/CurrentStorms.json};
our $DEFAULT_RSS_ATLANTIC = q{https://www.nhc.noaa.gov/index-at.xml};
our $DEFAULT_RSS_E
= 10;
# container class for requesting JSON and providing
# iterator access and meta operations for the storms
# contained in the JSON returned by NHC
sub new {
my $pkg = shift;
ckResultFactory;
use Dancer2::RPCPlugin::ErrorResponse;
use Dancer2::RPCPlugin::FlattenData;
use JSON;
use Scalar::Util 'blessed';
use Time::HiRes 'time';
plugin_keywords PLUGIN_NAME;
sub restrpc {
my ($ct) = (split /;\s*/, $http_request->content_type, 2);
if ($ct ne 'application/json') {
$dsl->pass();
}
$dsl->app->log(
debug => "[handle_res
$dsl->response->content_type('application/json');
my $response;
my $method_args = $http_request->body
? from_json($http_request->body)
: undef;
o::UserAgent;
my $tx = Mojo::UserAgent->new->post(
'https://fastapi.metacpan.org/v1/file' => json => {
"query"=> {
"match_all"=> {}
},
"filter"=> {
istribution",
"release"
],
"size"=> 20
}
);
my $data = $tx->res->json;
my @files = map {
+{
dist => $_->{fields}->{distribution},
path => (sprin
#!/usr/bin/perl
use strict;
use warnings;
use Mojo::File qw(curfile);
use Mojo::JSON qw(encode_json);
use Data::Printer;
use CPANfile::Parse::PPI;
my @data;
my $files = curfile->dirname->child(qw(.
ch( sub {
my $parser = CPANfile::Parse::PPI->new( $_->to_string );
push @data, {
file => $_->basename,
results => $parser->modules,
};
});
print( encode_json \@data );
ad::GitLab;
use strict;
use warnings;
use 5.008004;
use Carp qw( croak );
use URI;
use JSON::PP qw( decode_json );
use URI::Escape qw( uri_escape );
use Alien::Build::Plugin;
use File::Basename qw( b
if($res->{content})
{
$rel = decode_json $res->{content};
}
elsif($res->{path})
{
$rel = decode_json path($res->{path})->slurp_raw;
}
else
`message` TEXT, -- Message content (BASE64)
`attributes` TEXT, -- Message attributes (JSON)
`published` BIGINT(20), -- The publication time (unixtime)
`scheduled` BIGINT(20
=> 30*24*60*60, # 30 days max (how time to hold of messages)
MAXTIME => 300, # 5 min
JSON_ATTRS => [
{ # For serialize
utf8 => 0,
pretty => 1,
ect
`message` TEXT, -- Message content (BASE64)
`attributes` TEXT, -- Message attributes (JSON)
`published` BIGINT(20), -- The publication time (unixtime)
`scheduled` BIGINT(20), -- Th
PATH, Alien::ZMQ::latest->bin_dir;
}
}
use ZMQ::FFI 1.18 qw( ZMQ_PUB ZMQ_REP ZMQ_ROUTER );
use JSON::MaybeXS;
use Path::Class;
use IO::Async::Loop;
use IO::Async::Handle;
use IO::Handle;
use IO::As
ync::Loop->new; }
#}}}
# Connection configuration {{{
# Read in connection info from JSON file {{{
# path to JSON file with connection data
has connection_file => ( is => 'ro', trigger => 1 );
sub _t
on_data => ( is => 'lazy' );
sub _build_connection_data {
my ($self) = @_;
# read JSON file
my $data = decode_json file($self->connection_file)->slurp;
$self->_connection_data_config( $data );
$d
"Content-Length" => $content_size,
"Accept" => 'application/json,text/plain',
'Content-Type' => 'application/octet-stream',
using webservices
=head1 SYNOPSIS
Run:
wsgetmail [options] --config=wsgetmail.json
where C<wsgetmail.json> looks like:
{
"client_id": "abcd1234-xxxx-xxxx-xxxx-1234abcdef99",
"ten
config hashref takes all the same keys and values as the
# command line tool configuration JSON.
}});
while (my $message = $getmail->get_next_message()) {
$getmail->process_mess
nfiguration file, you can test it by running:
wsgetmail --debug --dry-run --config=wsgetmail.json
This will read and deliver messages, but will not mark them as read or
delete them. If there are
sage::ZMQ;
$Devel::IPerl::Message::ZMQ::VERSION = '0.012';
use strict;
use warnings;
use Moo;
use JSON::MaybeXS;
use namespace::autoclean;
use Digest::SHA qw(hmac_sha256_hex);
extends qw(Devel::IPerl
_uuids => \@uuids,
header => decode_json($header),
parent_header => decode_json($parent_header),
metadata => decode_json($metadata),
content => decode_json($content),
blobs => [ @blobs_rest
lized;
my @blob_order = qw( header parent_header metadata content );
$serialized->{$_} = encode_json( $self->$_ ) for @blob_order;
# implement HMAC signature
my $hmac_signature;
if( $self->has_s
a::Connection;
use strict;
use Moo::Role;
use JSON::XS;
our $VERSION = '0.11';
sub decode_response {
my( $self, $body ) = @_;
return decode_json( $body );
}
sub process_response {
my (
nd $code <= 209 ) {
if ( defined $body and length $body ) {
# Let's hope it's JSON
$body = $self->decode_response($body)
if $is_encoded;
ret
gle_aircraft_position_by_hex_id("a0f73c");
say $adsb->get_json_response;
$adsb->aircraft_live_position_by_hex_id("a0f73c");
say $adsb->get_json_response;
die;
my $registration = 'N161UW';
my $positio
istration is flight $flight and its current position is $latitude by $longitude";
say $adsb->get_json_response();
say Dumper $adsb->aircraft_last_position_by_hex_id("a0f73c");
say Dumper $adsb->airc
`message` TEXT, -- Message content (BASE64)
`attributes` TEXT, -- Message attributes (JSON)
`published` BIGINT(20), -- The publication time (unixtime)
`scheduled` BIGINT(20
l::MS365;
=head1 NAME
App::wsgetmail::MS365 - Fetch mail from Microsoft 365
=cut
use Moo;
use JSON;
use App::wsgetmail::MS365::Client;
use App::wsgetmail::MS365::Message;
use File::Temp;
=head1
{'Content-type'=> 'application/json',
Content => encode_json({isRead => $JSON::true }) });
unless ($response->is_success) {
r : " . $response->content if $self->debug;
return undef;
}
my $folders = decode_json( $response->content );
return $folders->{value}[0];
}
##############
sub _fetch_messages {
lient - Low-level client to the Microsoft Graph API
=cut
use Moo;
use URI::Escape;
use URI;
use JSON;
use LWP::UserAgent;
use Azure::AD::ClientCredentials;
=head1 DESCRIPTION
This class performs t
>content;
# check details
if ($response->is_success) {
my $token_details = decode_json( $response->content );
$access_token = "Bearer " . $token_details->{access_token};
}
::NBConvert::VERSION = '0.012';
use strict;
use warnings;
use Getopt::Long;
use Path::Class;
use JSON::MaybeXS;
use Markdown::Pod;
use HTML::FromANSI;
use Moo;
has ansi_css => ( is => 'ro',
default
($self) = @_;
my $file = shift @ARGV;
$self->notebook_file( file($file) );
my $data = decode_json( $self->notebook_file->slurp );
my $output = $self->to_pod( $data );
print $output;
}
sub to
sponds with JSON, and this interface
parses it into a hash for you to read. A complete example of accessing the information is in the
synopsis. If you want to mess with the "raw" JSON response,
just call get_json_response(). This
could be useful if you want to inspect the result to determine which pieces of data you want. You
could also use Data::Dumper on the hash to see everything form
s:
$adsb->do_call('country/Austria');
=head2 get_json_response
This is the only method that doesn't make an API call; it returns the full JSON response
from the previous call. This is useful if
ers, json => \%payload);
# blocking
unless ($cb) {
$tx = $ua->start($tx);
if (my $err = $tx->error) {
return $err;
}
die "Failed to send message\n" unless $tx->res->json->{o
$tx_) = @_;
my ($err, $json);
$json = $tx_->res->json unless $err = $tx_->error;
($err //= {})->{message} ||= 'Failed to send message'
unless $tx->res->json->{ok};
Mojo::IOLoop->
next_tick(sub { $self->$cb($err, $json, $tx_) });
});
return $self;
}
1;
__END__
=head1 NAME
Mojar::Message::Telegram - Send messages via Telegram.
=head1 SYNOPSIS
use Mojar::Message::Teleg
package Apache::Tika::Async;
use strict;
use Moo 2;
use JSON::XS qw(decode_json);
use File::Temp 'tempfile';
our $VERSION = '0.11';
=head1 NAME
Apache::Tika::Async - connect to Apache Tika
=head1
@_;
$line =~ m!"([^"]+)"!g;
}
sub get_meta {
my( $self, $file )= @_;
#return decode_json($self->fetch( filename => $file, type => 'meta' ));
# Hacky CSV-to-hash decode :-/
return