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];
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
$node->addChild($c_node);
}
}
}
return $node;
}
sub TO_JSON {
my $self = shift;
my $this = { };
my @ancestors = $self->get_class_ancestors();
or 'blessed' ManagedObjectReferences while letting
# other types fall through to the JSON::XS processor.
if ( $type eq 'ManagedObjectReference' ) {
if (blessed
::Run::Cmd';
use URI;
use YAML::XS ();
use LWP::UserAgent;
use HTTP::Request;
use App::Spec;
use JSON::XS;
use API::CLI::Request;
use Moo;
has dir => ( is => 'ro' );
has openapi => ( is => 'ro' );
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()
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__
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()
bers = $class->SUPER::get_class_members();
return (@super_members, @class_members);
}
sub TO_JSON {
my $self = shift;
my $this = { };
my @ancestors = $self->get_class_ancestors();
$node->addChild($c_node);
}
}
}
return $node;
}
sub TO_JSON {
my $self = shift;
my $this = { };
my @ancestors = $self->get_class_ancestors();
or 'blessed' ManagedObjectReferences while letting
# other types fall through to the JSON::XS processor.
if ( $type eq 'ManagedObjectReference' ) {
if (blessed
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}
package HPC::Runner::Command::submit_jobs::Plugin::Logger::Sqlite;
use Moose::Role;
use JSON::XS;
use Data::Dumper;
use DateTime;
with 'HPC::Runner::Command::Plugin::Logger::Sqlite';
=head1 HPC::Ru
bj->{jobnames} = $self->job_stats->jobnames;
my $json_text = encode_json $obj;
$res->update(
{
submission_meta => $json_text,
total_processes => $self->job_sta
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-
ue = encode_utf8($self->{'val'});
$node->appendText($value);
return $node;
}
sub TO_JSON {
my $self = shift;
my $class = ref($self);
$class =~ s/VMOMI:://;
return {_clas
s(module => 'JSON::Tiny'); # or dist => 'JSON-Tiny'
print "Distributions dependent on JSON::Tiny: @$dependents\n";
# From the commandline
$ cpan-dependents --with-recommends JSON::Tiny
$ cp
an-dependents -c JSON-Tiny
=head1 DESCRIPTION
L<App::CPAN::Dependents> provides the function L</"find_all_dependents">
(exportable on demand) for the purpose of determining all distributions which
a
=head1 FUNCTIONS
=head2 find_all_dependents
my $dependents = find_all_dependents(module => 'JSON::Tiny', recommends => 1);
Find all dependent distributions. Returns an array reference of distri
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 {
a;
use strict;
use warnings;
our $VERSION = '0.05';
use List::Util qw(sum);
use HTTP::Tiny;
use JSON ();
use Devel::Cover::DB;
our $API_ENDPOINT =
($ENV{KRITIKA_HOST} || 'https://kritika.io') . '
;
}
sub _post {
my $class = shift;
my ( $token, $coverage ) = @_;
$coverage = JSON::encode_json($coverage);
my $ua = $class->_build_ua;
my $response;
for my $i ( 1 .. 3 ) {
on
1;
__END__
=encoding utf-8
=head1 NAME
Catmandu::Store::REST - Store/retrieve items from a JSON REST-API endpoint
=head1 SYNOPSIS
# From the command line
$ catmandu export REST --id 1234
tore|http://librecat.org/Catmandu/#stores>.
The module allows you to use a RESTful API that uses JSON as data format and uses the URL format
C<[base_url]/[id][query_string]> as a I<Store> for I<Catma
and deleting (C<DELETE>) single items is
supported. Data must be provided as JSON by the API, and the API must accept JSON for C<PUT>/C<POST>
requests. The URL must be of the format C<[base_url]/[id]
package Catmandu::Store::REST::API;
use Catmandu::Sane;
use Moo;
use JSON;
use LWP::UserAgent;
has base_url => (is => 'ro', required => 1);
has query_string => (is => 'ro');
has client => (is
my $response = $self->client->get($url);
if ($response->is_success) {
return decode_json($response->decoded_content);
} elsif ($response->code == 404) {
return {};
} else
$url = $self->mk_url();
my $json_data = encode_json($data);
my $response = $self->client->post($url, Content_Type => 'application/json', Content => $json_data);
if ($response->is_su
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;
bers = $class->SUPER::get_class_members();
return (@super_members, @class_members);
}
sub TO_JSON {
my $self = shift;
my $this = { };
my @ancestors = $self->get_class_ancestors();