e strict;
use warnings;
use feature ':5.10';
use base qw{ Tie::Handle Exporter };
use Symbol;
use JSON;
use Errno qw{ ENOENT EISDIR EINVAL EPERM EACCES EAGAIN ECANCELED EFBIG };
use Fcntl qw{ SEEK_CUR
sponse->code != 200;
$self->{'meta'} = from_json($response->content())
if $self->{'closed'};
unless ($self->{'upload_id'}) {
$response = from_json($response->content());
$self->{'upload_id'}
eaders__);
my $code = $response->code();
if ($code == 200) {
$meta = $self->{'meta'} = from_json($response->content());
# XXX: Dropbox returns metadata for recently deleted files
if ($meta-
:Repositorio::Server::Yum::Errata;
use Mojo::Base 'Mojolicious::Controller';
use File::Spec;
use JSON::XS;
use List::MoreUtils 'firstidx';
use Data::Dumper;
require IO::All;
our $VERSION = '1.2.1';
->debug("Looking for errata: $errata_dir");
if ( !-d $errata_dir ) {
return $self->render( json => {}, status => 404 );
}
my $package = $self->param("package");
my $arch = $self->para
rch, substr( $package, 0, 1 ),
$package, "errata.json"
)
)
{
return $self->render( json => {} );
}
my $ref = decode_json(
IO::All->new(
File::Spec->catfile(
::Docker::Search;
use Mojo::Base 'Mojolicious::Controller';
use File::Spec;
require IO::All;
use JSON::XS;
use Data::Dumper;
our $VERSION = '1.2.1'; # VERSION
sub search {
my ($self) = @_;
my
Spec->catdir( $self->app->get_repo_dir( repo => $self->repo->{name} ),
"repository" );
my @json_files;
my @dirs = ($repo_dir);
for my $dir (@dirs) {
opendir( my $dh, $dir );
while (
}
if ( -f File::Spec->catfile( $dir, $entry, "repo.json" ) ) {
push @json_files, File::Spec->catfile( $dir, $entry, "repo.json" );
}
}
closedir($dh);
}
my $search =
:Validate qw(:all);
use File::Spec;
use JSON::XS;
sub register {
my ( $self, $app ) = @_;
$app->helper(
config => sub {
my $config = decode_json( $ENV{REPO_CONFIG} );
return $con
ious::Controller';
our $VERSION = '1.2.1'; # VERSION
sub index {
my ($self) = @_;
$self->render( json => { ok => 1 } );
}
sub ping {
my ($self) = @_;
$self->render( text => 'true' );
}
1;
r;
use File::Spec;
use File::Path 'make_path', 'remove_tree';
use File::Basename qw'dirname';
use JSON::XS;
use MIME::Base64;
require IO::All;
our $VERSION = '1.2.1'; # VERSION
sub get_repo_images {
catfile( $repo_dir, "repo.json" );
if ( -f $repo_file ) {
my $content = IO::All->new($repo_file)->slurp;
$self->res->headers->add( 'Content-Type', 'application/json' );
$self->render( t
binmode $fh;
print $fh $tx->res->body;
close $fh;
my $ref = $tx->res->json;
my $repo_dir = $self->app->get_repo_dir( repo => $self->repo->{name} );
for my $
move_tree';
use Digest::MD5 'md5_base64';
use Rex::Repositorio::Server::Docker::Helper::Auth;
use JSON::XS;
use Data::Dumper;
our $VERSION = '1.2.1'; # VERSION
# TODO: implement authentication and a
name} );
my $user_dir = File::Spec->catdir( $repo_dir, "users" );
my $ref = $self->req->json;
my $username = $ref->{username};
if ( !-d File::Spec->catdir( $user_dir, $username ) ) {
( $user_dir, $username, "user.json" ) )
or die($!);
my $ref = $self->req->json;
$ref->{password} = md5_base64( $ref->{password} );
print $fh encode_json($ref);
close($fh);
$
>new(
network => $self->network,
hash => $response->{headers}->{hash},
json => $response->{content},
secret => $self->secret,
);
}
=head2 sandbox_data
Indi
be Str/;
use JSON::MaybeXS;
use Moo::Role;
with 'Business::Giropay::Role::Network';
=head1 ATTRIBUTES
=head2 json
The json message data returned from giropay. Required.
=cut
has json => (
is
L</json> data converted to a hash reference.
=cut
has data => (
is => 'lazy',
isa => HashRef,
init_arg => undef,
);
sub _build_data {
return decode_json( shift->json );
= hmac_md5_hex( $self->json, $self->secret );
croak(
"Returned HMAC hash ", $self->hash,
" does not match expected hash ", $verify, " for json ", $self->json
) unless $verify
File::Basename qw'dirname';
use File::Spec;
use File::Copy;
use Digest::SHA;
use Digest::MD5;
use JSON::XS;
use List::MoreUtils 'firstidx';
our $VERSION = '1.2.1'; # VERSION
has app => ( is => 'ro'
substr( $option{package}, 0, 1 ), $option{package},
"errata.json"
)
)
{
return {};
}
my $ref = decode_json(
IO::All->new(
File::Spec->catfile(
$errata_dir,
$option{arch},
substr( $option{package}, 0, 1 ), $option{package},
"errata.json"
)
)->slurp
);
my $package = $option{package};
my $arch = $option{arch};
my $vers
Carp;
use Params::Validate qw(:all);
use File::Spec;
use File::Path 'make_path';
use IO::All;
use JSON::XS;
our $VERSION = '1.2.1'; # VERSION
extends "Rex::Repositorio::Repository::Yum";
sub mirror
> 'XAS::Base',
utils => ':validation dotid trim',
constants => 'HASHREF',
codec => 'JSON',
accessors => 'hm',
;
# ---------------------------------------------------------------------
formatter->format($data);
=head1 DESCRIPTION
This package will take a hash and format it into a json_event for
L<Logstash|https://www.elastic.co/products/logstash>.
=head1 METHODS
=head2 format($
mestamp field into a
UTC date while formatting the datetime field into a local date. It returns
a json_event string.
=over 4
=item B<$data>
The hash to format.
=back
=head1 SEE ALSO
=over 4
=it
:
package Rex::Repositorio::Server::Docker::Helper::Auth::Plain;
use Moose;
use File::Spec;
use JSON::XS;
require IO::All;
our $VERSION = '1.2.1'; # VERSION
has user_path => ( is => 'ro' );
sub l
);
my $user_file = File::Spec->catfile( $user_dir, "user.json" );
if ( !-f $user_file ) {
return 0;
}
my $user_ref = decode_json( IO::All->new($user_file)->slurp );
if ( $user_ref->{p
package WWW::Shorten::5gp;
use strict;
use warnings;
use Carp qw();
use JSON::MaybeXS qw(decode_json);
use URI ();
use base qw( WWW::Shorten::generic Exporter );
our @EXPORT = qw( makeashorterlink
res = $ua->get($uri);
return undef unless $res && $res->is_success;
my $content = decode_json($res->decoded_content);
return undef unless $content && $content->{url};
return $content-
$res = $ua->get($uri);
return undef unless $res && $res->is_success;
my $content = decode_json($res->decoded_content);
return undef unless $content && $content->{$url}->{target_url};
r
package Backblaze::B2::v1::AnyEvent;
use strict;
use JSON::XS;
use MIME::Base64;
use URI::QueryParam;
use Carp qw(croak);
use Promises
backend => ['AnyEvent'], 'deferred';
use AnyEvent;
use AnyEv
binmode $fh;
local $/;
my $json = <$fh>;
my $cred = decode_json( $json );
$self->{credentials} = $cred;
$cred
};
sub decode_json_response {
my($self, $body,$hdr)
code_json( $body ); };
if( my $err = $@ ) {
$self->log_message(4, sprintf "Error decoding JSON response body: %s", $err);
@result = (0, sprintf("Error decoding JSON res
:Role::HasJSON;
use Moo::Role;
use JSON::MaybeXS;
our $VERSION = '0.001';
# Configure and cache the JSON object
has json => (
is => 'ro',
default => sub {
return JSON->new->utf
::API::V2::Role::HasJSON - Adds a json attribute with a JSON::MaybeXS
object
=head1 DESCRIPTION
Role for objects with JSON.
=head1 ATTRIBUTES
=over 4
=item json
Returns a JSON::MaybeXS object.
::AttributeShortcuts;
use Types::Standard qw/Str HashRef/;
use Types::URI qw/Uri/;
use JSON::MaybeXS 'decode_json';
use Path::Tiny;
with 'Badge::Depot';
has dist => (
is => 'ro',
isa => Str,
sion,
};
}
return {} if !path('META.json')->exists;
my $json = path('META.json')->slurp_utf8;
my $data = decode_json($json);
return {} if !exists $data->{'name'} || !exi
sion> and C<dist> are set to the values in the Dist::Zilla object.
=item 2
If there is a C<META.json> in the distribution root then that is used to set C<version> and C<dist>.
=back
If neither of
onse;
use Moo::Role;
use Carp;
use Types::Standard ":types";
with 'Ambassador::API::V2::Role::HasJSON';
our $VERSION = '0.001';
has http_response => (
is => 'ro',
isa => HashRef,
required => 1,
);
sub _build_response {
my $self = shift;
my $content = eval { $self->json->decode($self->http_response->{content}); };
croak "Failed to decode @{[ $self->http_response
package Ambassador::API::V2;
use Moo;
use v5.10;
with 'Ambassador::API::V2::Role::HasJSON';
use HTTP::Tiny;
use URI;
use Ambassador::API::V2::Error;
use Ambassador::API::V2::Result;
our $VERSION =
=> "Ambassador-API-V2/$VERSION",
default_headers => {'Content-Type' => 'application/json'}
);
}
);
sub _make_url {
my $self = shift;
my $method = shift;
my $u
sensitive to double slashes.
my $path = $url->path . join '/', $self->username, $self->key, 'json', $method;
$path =~ s{/{2,}}{/}g;
$url->path($path);
return $url;
}
sub _handle_re
trict;
use warnings FATAL => 'all';
use Data::Dumper;
use Storable;
use POE qw( Wheel::Run );
use JSON;
use parent 'App::MultiModule::Task';
=head1 NAME
App::MultiModule::Tasks::Runner - Run extern
nner_return_type};
die 'run_program: runner_return_type must be one of "json", "gather"'
if $return_type ne 'json' and $return_type ne 'gather';
if($return_type eq 'gather') {
} elsif($return_type eq 'json') {
$message->{runner_stdout} .= "$stdout_line\n";
my $emit = eval {
return decode_json $message->{runner_stdout};