use DirHandle;
use Mojo::Base qw{ Mojolicious::Plugin };
use Mojolicious::Types;
use Mojo::JSON qw(encode_json);
# Stolen from Plack::App::Direcotry
my $dir_page = <<'PAGE';
<html><head>
<title>Ind
index = $args->{dir_index};
my $auto_index = $args->{auto_index} // 1;
my $json = $args->{json};
$dir_page = $args->{dir_page} if ( $args->{dir_page} );
$app->hook(
h(1));
return;
}
render_indexes( $c, $path, $json ) unless not $auto_index;
}
},
);
return $app;
}
sub locate_index {
AC::Yenta::Debug 'store_server';
use AC::Yenta::Store;
use AC::Yenta::Config;
use AC::Dumper;
use JSON;
use Digest::SHA 'sha1_base64';
require 'AC/protobuf/yenta_getset.pl';
require 'AC/protobuf/yenta
y $cont = shift;
return 1 unless $meta && $meta =~ /^\{/;
eval {
$meta = decode_json($meta);
};
return 1 if $@;
if( $meta->{sha1} ){
my $chk = sha1_base64( $$con
Keyczar::Util qw(json_true json_false);
use Carp;
sub new {
my $class = shift;
my ($version, $status, $exportable) = @_;
my $self = bless {
exportable => json_false(),
my $json_string = shift;
my $obj = from_json($json_string);
return bless $obj, $class;
}
sub exportable {
my $self = shift;
$self->{exportable} = $_[0] ? json_true() : json_false
() if @_;
return $self->{exportable} eq json_true() ? 1 : undef;
}
sub status {
my $self = shift;
if (@_) {
if (uc $_[0] eq 'ACTIVE') {
$self->{status} = uc $_[0];
package Catmandu::Adlib::API;
use strict;
use warnings;
use Catmandu::Sane;
use Moo;
use JSON;
use Catmandu::Adlib::API::Login;
use Catmandu::Adlib::API::QueryBuilder;
has username => (is => 'ro',
my $json = decode_json($response->decoded_content);
# If there are multiple results for the same object_id, I'm gonna turn violent.
return $self->get_by_priref($self->get_priref($json->{'ad
;
my $response = $self->ua->get($url);
if ($response->is_success) {
return decode_json($response->decoded_content);
} elsif ($response->code == 404) {
return [];
} else
return $expose;
}
sub read {
my $class = shift;
my $json_string = shift;
my $obj = Crypt::Keyczar::Util::decode_json($json_string);
my $self = bless $obj, $class;
$self->{publi
strict;
use warnings;
use Try::Tiny;
use Path::Class;
use JSON;
eval { require JSON::XS; };
our $json = JSON->new->pretty;
sub json { $json }
use DBIx::NoSQL::Model;
has database => qw/ is ro /;
h
value starts with '[' or '{' then it
# will be assumed to be JSON and will be JSON-decoded.
sub _convert_args_to_struct {
require JSON::MaybeXS;
my $args = shift;
for my $k (keys %$args)
unless $args->{$k} =~ /\A(?:\[|\{)/;
eval { $args->{$k} = JSON::MaybeXS::decode_json($args->{$k}) };
die "Invalid JSON in '$k' argument: $@\n" if $@;
}
}
sub _api {
require XM
ltCode}, $fault->{faultString}];
}
[200, "OK", $call->result, {'cmdline.default_format'=>'json-pretty'}];
}
our %API_Methods = (
# Posts
'wp.getPost' => {
args => [
e warnings;
use Crypt::Keyczar::KeyVersion;
use Crypt::Keyczar::Util qw(decode_json encode_json json_true json_false json_null);
sub get_name { $_[0]->{name} }
sub get_purpose { $_[0]->{purpose} }
s
}, $class;
return $self;
}
sub read {
my $class = shift;
my $json_string = shift;
my $obj = decode_json($json_string);
my $self = $class->new($obj->{name}, $obj->{purpose}, $obj->
= $self->{encrypted} ? json_true() : json_false();
$expose->{versions} = [];
for my $v ($self->get_versions) {
push @{$expose->{versions}}, $v ? $v->expose : json_null();
}
re
hift;
my $json_key = undef;
return $json_key;
}
sub get_metadata {
croak "Please override, 'Crypt::Keyczar::Reader' is abstract class";
my $self = shift;
my $json_metadata = un
def;
return $json_metadata;
}
1;
__END__
;
use AC::Yenta::Conf;
use AC::DC::Protocol;
use AC::Import;
use AC::Misc;
use Sys::Hostname;
use JSON;
use Digest::SHA 'sha1';
use Socket;
use strict;
require 'AC/protobuf/yenta_check.pl';
require '
me->{server_file});
local $/ = "\n";
while(<$f>){
chop;
my $data = decode_json( $_ );
next unless grep { $_ eq $map } @{ $data->{map} };
if( $data->{is_local} )
return $self;
}
sub read {
my $class = shift;
my $json_string = shift;
my $obj = Crypt::Keyczar::Util::decode_json($json_string);
my $self = bless $obj, $class;
$self->init()
se AC::Yenta::Config;
use AC::Yenta::MySelf;
use AC::Dumper;
use AC::Misc;
use Sys::Hostname;
use JSON;
use Socket;
require 'AC/protobuf/yenta_status.pl';
use strict;
my $KEEPDOWN = 1800; # keep data
yenta' ){
$data->{map} = $pd->{map};
}
print FILE encode_json( $data ), "\n";
}
close FILE;
unless( rename("$file.tmp", $file) ){
}
return $key->generate($size);
}
sub read_key {
my $class = shift;
my ($type, $json_string_key) = @_;
if (!exists $POLICY{uc $type}) {
croak "unsupported key type: $typ
{
croak "$type: $@";
}
return $key->read($json_string_key);
}
sub to_string {
return Crypt::Keyczar::Util::encode_json($_[0]->expose);
}
1;
package Crypt::Keyczar::_NullSignE
mmand::execute_job::Plugin::Logger::Sqlite;
use Moose::Role;
use Data::Dumper;
use DateTime;
use JSON;
with 'HPC::Runner::Command::Plugin::Logger::Sqlite';
=head1 HPC::Runner::Command::execute_job:
me = "$ymd $hms";
my $job_meta = {};
if ( $self->metastr ) {
$job_meta = decode_json( $self->metastr );
}
if ( !exists $job_meta->{jobname} ) {
$job_meta->{jobname}
return $expose;
}
sub read {
my $class = shift;
my $json_string = shift;
my $obj = Crypt::Keyczar::Util::decode_json($json_string);
my $self = bless $obj, $class;
$self->{publi
return $expose;
}
sub read {
my $class = shift;
my $json_string = shift;
my $obj = Crypt::Keyczar::Util::decode_json($json_string);
my $self = bless $obj, $class;
$self->init()
>{aesKeyString}) }
sub read {
my $class = shift;
my $json_string = shift;
my $obj = Crypt::Keyczar::Util::decode_json($json_string);
my $self = bless $obj, $class;
$self->{hmacK
ink($path) == 1;
}
sub _put {
my $path = shift;
my $json = shift;
open my $fh, '>', $path or croak "can't open file: $path: $!";
print $fh $json, "\n";
close $fh;
}
1;
__END__
package HPC::Runner::Command::stats;
use MooseX::App::Command;
use Log::Log4perl qw(:easy);
use JSON;
use Text::ASCIITable;
with 'HPC::Runner::Command::Plugin::Logger::Sqlite';
command_short_descri
ft;
if ( !exists $self->task_data->{ $job->{job_name} } ) {
my $job_meta = decode_json( $job->{jobs_meta} );
my $total_tasks = $job_meta->{job_tasks};
$self->task_data-
package Catmandu::Store::REST::Bag;
use Moo;
use JSON;
use Catmandu::Sane;
use Catmandu::Store::REST::API;
with 'Catmandu::Bag';
has api => (is => 'lazy');
sub _build_api {
my $self = shift;