File::pushd qw/tempd/;
use Path::Class;
use Pod::Strip;
use Archive::Extract;
use HTTP::Tiny;
use JSON;
use namespace::autoclean;
#-------------------------------------------------------------------
) = @_;
my $mod = $self->source_module;
my $uri = $self->_cpanidx . join( "/", qw/cpanidx json mod/, $mod );
my $response = HTTP::Tiny->new->get( "$uri", { headers => { accept => '*' }, }
$mod via $uri: $response->{content}\n"
unless $response->{success};
my $meta = decode_json( $response->{content} )->[0];
return $meta->{dist_file};
}
has _short_distfile => (
is
ION = "1.02";
use Class::Load qw(load_class);
use Crypt::OpenSSL::PKCS12;
use JSON qw(decode_json encode_json);
use JSON::WebToken;
use LWP::UserAgent;
sub create {
my (%args) = @_;
my $version
>{private_key_file} =~ /\.json$/) {
open my $in, "<", $self->{private_key_file} or die "can't open $self->{private_key_file} : $!";
my $private_key_json = decode_json(join('', <$in>));
clo
se $in;
$self->{private_key} = $private_key_json->{private_key};
} elsif ($self->{private_key_file} =~ /\.p12$/) {
my $password = "notasecret";
my $pkcs12 = Crypt::OpenSSL::PKCS12->new_f
get_parameters_from_file
get_list_from_file
get_column_data
read_json_file
write_json_file
run
run_time
readable_second
check_positive_integer
ode_utf8 /;
use File::Path qw(make_path remove_tree);
use File::Find;
use File::Basename;
use JSON;
=head1 NAME
BioUtil::Util - Utilities for operation on data or file
Some great modules
get_parameters_from_file
get_list_from_file
get_column_data
read_json_file
write_json_file
run
run_time
readable_second
check_positive_integer
ERSION
my $files = File::ShareDir::Tarball::dist_dir( 'App-EventStreamr' );
set serializer => 'JSON';
# logging
set logpath => "$ENV{HOME}/.eventstreamr"; # need collect this somehow..
set logger
matches
post '/settings/:mac' => sub {
my $data->{mac} = params->{mac};
$data->{body} = from_json(request->body);
if ($data->{mac} eq "$self->{config}{macaddress}") {
my $manager = $self->{
-------------
# Post JSON content to restart an individual device eg: {"id":"dvswitch"}
post '/command/:command' => sub {
my $command = params->{command};
my $data = from_json(request->body);
in
seX::Role::JSONObject::Meta::Trait;
use v5.012;
use strict;
use warnings;
use version; our $VERSION = version->declare("v0.1.0");
use Moose::Role;
Moose::Util::meta_attribute_alias('JSONAttribute'
s => 'rw',
isa => 'Str',
predicate => 'has_json_attr',
);
1;
__END__
=encoding utf-8
=head1 NAME
MooseX::Role::JSONObject::Meta::Trait - rename a JSONObject attribute
=head1 SYNOPSIS
packa
oseX::Role::JSONObject::Meta::Trait;
with 'MooseX::Role::JSONObject';
has ipv4_address => (
is => 'rw',
isa => 'Str',
traits => ['JSONAttribute'],
json_attr => 'I
b "$Bin/../lib";
use File::Tail; # libfile-tail-perl
use HTTP::Tiny; # libhttp-tiny-perl
use JSON; # libjson-perl
# PODNAME: station-devmon
# ABSTRACT: station-devmon - Monitor Syslog for device eve
d";
my $json = to_json($device);
my %post_data = (
content => $json,
'content-type' => 'application/json',
'content-length' => length($json),
);
WebService::VirusTotal;
use 5.006;
use strict;
use warnings;
use Carp;
use LWP::UserAgent;
use JSON;
use Digest::SHA qw(sha1_hex sha256_hex);
use Digest::MD5 qw(md5_hex);
use List::Util qw(first);
lls the sha256 value out of the JSON response
# Note: there are many other values that could also be pulled out
my $json = JSON->new->allow_nonref;
my ($decjson, $sha, $respcode) = (undef, un
$decjson = $json->decode($results);
};
if (defined $decjson)
{
# if json->decode() fails it will call croak, so we catch it and display the returned text
$sha = $decjson->{"sha256"};
1;
use strict;
use warnings;
use base qw(Google::BigQuery);
use HTTP::Request;
use JSON qw(decode_json encode_json);
use URI::Escape;
sub new {
my ($class, %args) = @_;
my $self = $class->SUPE
:POST|PUT|PATCH)$/) {
$request->header('Content-Type' => 'application/json');
$request->content(encode_json($args{content}));
}
} else {
my $upload_path = $rest_descrip
d_part(
HTTP::Message->new(
['Content-Type' => 'application/json; charset=UTF-8'],
encode_json($args{content})
)
);
my $data;
open my $in, "<", $
'x($bad_char-1).'^';
return $msg;
}
1;
__END__
=pod
=head1 NAME
Parse::JCONF - Parse JCONF (JSON optimized for configs)
=head1 SYNOPSIS
use strict;
use Parse::JCONF;
my $raw_c
\"Moo\", \"Mo\")"
=head1 DESCRIPTION
JSON is good, but not very handy for configuration files. JCONF intended to fix this.
It has several differences with JSON format:
=over
=item bareword - the
ONF value
=item values in the object/array or root trines may be devided with comma "," (like in JSON) or with new line (or even several)
val = [1,2,3,4] # with comma
val = [ #
Bin);
use lib "$Bin/../lib";
use Proc::Daemon; # libproc-daemon-perl
use JSON; # libjson-perl
use Config::JSON; # libconfig-json-perl
use HTTP::Tiny; # libhttp-tiny-perl
use Log::Log4perl; # liblog-lo
/settings.json") {
$localconfig = Config::JSON->new("$Bin/../settings.json");
$localconfig = $localconfig->{config};
} else {
$localconfig = Config::JSON->create("$Bin/../settings.json");
$loc
nfig;
if (-e "$Bin/../station.json") {
$stationconfig = Config::JSON->new("$Bin/../station.json");
} else {
$stationconfig = Config::JSON->create("$Bin/../station.json");
$stationconfig->{config
kage App::EventStreamr::Roles::ConfigAPI;
use v5.010;
use strict;
use warnings;
use Config::JSON;
use JSON;
use Method::Signatures 20140224; # libmethod-signatures-perl
use HTTP::Tiny '0.053'; # libh
nfig() {
return $self->config_path."/controller.json";
}
method _build_controller() {
if ( -e $self->controller_config ) {
return Config::JSON->new($self->controller_config)->config->{control
== 201) {
# Status Post Data
my $json = to_json($self->_post_data());
$self->debug($json);
my %post_data = (
content => $json,
headers => {
'stat
server_info:
server: http://solr.example.com/productSearch/
format => JSON
server_version: 4.5
=head2 alias
Aliases allow you to reference the same underlying s
erAgent;
use JSON;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(new trigger resolve);
use constant SERVICE_URL => "https://events.pagerduty.com/generic/2010-04-15/create_event.json";
use consta
undef;
$data = eval { JSON::encode_json($request_body); };
if ($data) {
$return_body = eval { $self->{user_agent}->post($self->{url}, Content_Type => 'application/json', Content => $data); };
if (defined $return_body) {
my $result = JSON::decode_json($return_body->decoded_content);
if (defined $result && ref $result eq 'HASH') {
if ($@) {
if (defined $result->{errors} &&
package Marathon::Group;
use strict;
use warnings;
use parent 'Marathon::Remote';
use JSON::XS;
sub new {
my ($class, $conf, $parent) = @_;
my $self = bless {};
$conf = {} unless $conf &
/v2/groups', $self->get_updateable_values);
if ( $response ) {
$self->version( decode_json($response)->{version} );
return $self;
}
return undef;
}
sub update {
my ($
f->id . $self->_uri_args($args), $payload);
if ( $response ) {
$self->version( decode_json($response)->{version} );
return $self;
}
return undef;
}
sub delete {
my ($
my $json = $c->stash('json');
unless ( defined $json->{data} ) {
$json->{data} = {};
}
unless ( defined $c->match->stack->[0]){
$json->{messa
ash( 'json' => $json );
}
}
);
}
$app->helper( data => sub{
my $self = shift;
my %data = ref $_[0] ? %{ $_[0] } : @_;
my $json = $self->stash('json');
$json = {
data => {}, message => [] } unless defined $json;
@{ $json->{ data } }{ keys %data } = values %data;
$self->stash( json => $json );
return $self;
});
$app->helper( message => sub {
= "0.03";
use parent qw/Exporter/;
use MIME::Base64 qw/encode_base64url/;
use Digest::SHA;
use JSON::WebToken qw//;
use Net::OpenID::Connect::IDToken::Exception;
use Net::OpenID::Connect::IDToken:
, $extra_headers) = @_;
JSON::WebToken->encode($claims, $key, $alg, $extra_headers);
};
our $JWT_DECODE = sub {
my ($id_token, $key, $to_be_verified) = @_;
JSON::WebToken->decode($id_toke
}
}
Other errors like 'id_token itself is not valid JWT' might come from
underlying JSON::WebToken.
=head2 ERROR_IDTOKEN_INVALID_ALGORITHM
Thrown when invalid algorithm specified.
=he
gure out the end of the file
debug "File End: $file_end";
close($IN);
# Return JSON
to_json( { new_curr_pos => $file_end,
interval => $conf->{interval},
MooseX::Role::JSONObject;
use v5.012;
use strict;
use warnings;
use version; our $VERSION = version->declare("v0.1.0");
use Moose::Role;
use Method::Signatures;
use MooseX::Role::JSONObject::Util;
method to_json()
{
return MooseX::Role::JSONObject::Util::meta_to_json(
$self, $self->meta);
}
method from_json($class:, HashRef $data)
{
my $cls = ref $class || $class;
my $meta = Class::M
return MooseX::Role::JSONObject::Util::meta_from_json(
$data, $meta);
}
1;
__END__
=encoding utf-8
=head1 NAME
MooseX::Role::JSONObject - create/store an object in a JSON-like hash
=head1 SY
#!/usr/bin/perl
package MooseX::Role::JSONObject::Util;
use v5.012;
use strict;
use warnings;
use version; our $VERSION = version->declare("v0.1.0");
use List::Util qw/pairfirst/;
use Method::Sign
tribute $attr)
{
if (!$attr->has_type_constraint) {
if (!defined $val) {
die "MooseX::Role::JSONObject::SKIP\n";
} elsif (ref $val eq 'ARRAY') {
return ('array', '*');
} elsif (ref $val e
, '*');
}
return ['*'];
}
if (!defined $val && !$attr->is_required) {
die "MooseX::Role::JSONObject::SKIP\n";
}
my $type = $attr->type_constraint;
my @res;
again:
my @handlers = (
'Obje
;
use 5.006;
use strict;
use warnings FATAL => 'all';
use Carp qw( croak );
use Data::UUID;
use JSON::Any;
use LWP::UserAgent;
use URI;
our $VALID_NAME_RE = qr/^[a-z0-9][a-z0-9\-_ ]*$/;
=head1 NAM
host => 'http://localhost:5000',
ua => LWP::UserAgent->new,
json => JSON::Any->new,
client_id => Data::UUID->new->create_str,
%args,
};
ble
my $json = ( $resp->is_success )
? $resp->content
: '{"status": "failed", "response": "http error: sixpack is unreachable"}';
return $self->{json}->jsonToObj( $json );