= $dbcgi->mtime($filename);
$str = $dbcgi->timestamp();
$json_str = PACKAGE->to_json($data);
$json_str = PACKAGE->from_json($data);
\@daytime = PACKAGE->gettimeofday();
$secs = PACKAG
)
=over 4
=item load_config
$dbcgi = $dbcgi->load_config($filename);
loads %$dbcgi keys from JSON filename, clobbering any existing values.
=back
=cut
##---------------------------------------
to_json
$json_str = PACKAGE->to_json($data);
$json_str = PACKAGE::to_json($data);
$json_str = PACKAGE->to_json($data,\%opts);
$json_str = PACKAGE::to_json($data,\%opts);
Wraps L<JSON::to_json()|
model baseclass',
);
option 'model_args' => (
is => 'ro',
format => 'json',
short => 'ma',
doc => 'ExtJS model arguments',
);
option 'director
owing methods:
=cut
=head2 decode
decode(Str $data) : HashRef
The decode method decodes the JSON data provided and returns the data as a hashref.
=over 4
=item decode example #1
# given: sy
encode
encode(HashRef $data) : Str
The encode method encodes and returns the data provided as JSON.
=over 4
=item encode example #1
# given: synopsis
$store->encode({ status => 'ok' });
=
figuration variables
are loaded using L<Config::ZOMG>. An example configuration file rdf_endpoint.json
is included with this package. Valid top-level configuration keys include:
=over 4
=item store
rlSetVar psgi_app /path/to/endpoint.psgi
PerlSetEnv RDF_ENDPOINT_CONFIG /path/to/rdf_endpoint.json
</Location>
To get syntax highlighting and other pretty features, in the
VirtualHost section o
RSION = '0.11';
use RDF::Query 2.905;
use RDF::Trine 0.134 qw(statement iri blank literal);
use JSON;
use Encode;
use File::Spec;
use Data::Dumper;
use Digest::MD5 qw(md5_base64);
use XML::LibXML 1.
owing methods:
=cut
=head2 decode
decode(Str $data) : HashRef
The decode method decodes the JSON data provided and returns the data as a hashref.
=over 4
=item decode example #1
# given: sy
encode
encode(HashRef $data) : Str
The encode method encodes and returns the data provided as JSON.
=over 4
=item encode example #1
# given: synopsis
$store->encode({ status => 'ok' });
=
iviti::Sane;
use Carp qw(confess);
use Moo;
use Data::Util qw(:check :validate);
use JSON qw(decode_json encode_json);
use URI::Escape qw(uri_escape);
use Activiti::Rest::Response;
our $VERSION = "0.
tanceId}),
params => {},
headers => {
'Content-Type' => "application/json",
Content => encode_json({ action => "suspend" })
},
method => "PUT"
);
Activiti::Rest::Respon
tanceId}),
params => {},
headers => {
'Content-Type' => "application/json",
Content => encode_json({ action => "activate" })
},
method => "PUT"
);
Activiti::Rest::Respo
owing methods:
=cut
=head2 decode
decode(Str $data) : HashRef
The decode method decodes the JSON data provided and returns the data as a hashref.
=over 4
=item decode example #1
# given: sy
encode
encode(HashRef $data) : Str
The encode method encodes and returns the data provided as JSON.
=over 4
=item encode example #1
# given: synopsis
$store->encode({ status => 'ok' });
=
package Activiti::Rest::Response;
use Activiti::Sane;
use Activiti::Rest::Error;
use Moo;
use JSON qw();
use Encode qw();
has content => (
is => 'ro',
predicate => 'has_content'
);
has parsed_con
content_hash = JSON::decode_json($res->content);
my $exception = $content_hash->{exception} || $content_hash->{errorMessage};
#can return multiple values (e.g. 'application/json','charset=utf-
on failed. The request body contains an unsupported media type. Also occurs when the request-body JSON contains an unknown attribute or value that doesn't have the right format/type to be accepted.
gs($ENV{ZING_REDIS}));
}
# BUILDERS
fun new_encoder($self) {
require Zing::Encoder::Json; Zing::Encoder::Json->new;
}
# METHODS
method drop(Str $key) {
return $self->client->del($key);
}
meth
owing methods:
=cut
=head2 decode
decode(Str $data) : HashRef
The decode method decodes the JSON data provided and returns the data as a hashref.
=over 4
=item decode example #1
# given: sy
encode
encode(HashRef $data) : Str
The encode method encodes and returns the data provided as JSON.
=over 4
=item encode example #1
# given: synopsis
$redis->encode({ status => 'ok' });
=
is => 'ro',
isa => sub { array_ref($_[0]); },
default => sub { [["Accept","application/json; charset=UTF-8"]]; }
);
has keep_alive => (
is => 'ro',
isa => sub { is_integer($_[0]) &&
# classname => $extjs_model_name,
# attributes => $extjs_model_code,
#};
my $json =
#$self->_xslate->render_string($self->model_template, $template_vars);
"Ext.def
. dump_javascript($extjs_model_code)
. ');';
#. $self->_json->encode($extjs_model_code)
$fh->write($json . "\n");
}
sub extjs_basemodel_to_file {
my ( $self, $dirname ) =
,
},
};
my $json =
"Ext.define('" . $self->model_baseclass . "', "
. dump_javascript($extjs_basemodel_code) . ');';
$fh->write($json . "\n");
$fh->close
er::Registry::Auth::None->new;
};
use JSON::MaybeXS qw//;
has _json => (is => 'ro', default => sub {
JSON::MaybeXS->new;
});
sub process_json_response {
my ($self, $response) = @_;
if ($response->status == 200) {
my $struct = eval {
$self->_json->decode($response->content);
};
if ($@) {
Docker::Registry::Exception->throw({ message => $@ });
ss = 'Docker::Registry::Result::Repositories';
my $result = $result_class->new($self->process_json_response($response));
return $result;
}
sub repository_tags {
my $self = shift;
Docker::Registry::Auth::AzureServicePrincipal;
use Moo;
with 'Docker::Registry::Auth';
use JSON::MaybeXS;
use Azure::AD::ClientCredentials;
has ad_auth => (
is => 'ro',
default =>
nse code: $response->{ status }" if (not $response->{ success });
my $refresh_token = decode_json($response->{ content })->{ refresh_token };
$response = $self->ua->post_form(
$params{
=> $scope,
refresh_token => $refresh_token,
}
);
my $access_token = decode_json($response->{ content })->{ access_token };
$request->header('Authorization', 'Bearer ' . $ac
code_jwt/;
use JSON::MaybeXS;
use Path::Class;
use URI;
use HTTP::Tiny;
has service_account_file => (is => 'ro', isa => Str, default => sub {
"$ENV{HOME}/.gcloud/sd.json"
});
has s
hift;
my $f = Path::Class::File->new($self->service_account_file);
my $json = JSON::MaybeXS->new;
return $json->decode(join '', $f->slurp);
});
has client_email => (is => 'ro', isa =>
$result) = @_;
my $json = eval { decode_json($result->{ content }) };
if (not $json) {
Docker::Registry::Auth::Exception->throw({
message => "Couldn't json-parse $result->{ conte
istry::Auth';
use Docker::Registry::Types qw(DockerRegistryURI);
use HTTP::Tiny;
use JSON::MaybeXS qw(decode_json);
has username => (
is => 'ro',
isa => Str,
required => 1,
);
TTP::Tiny->new();
my $res = $ua->get($uri);
if ($res->{success}) {
return decode_json($res->{content})->{token};
}
die "Unable to get token from gitlab!";
}
sub authorize {
r_token);
$request->header('Accept',
'application/vnd.docker.distribution.manifest.v2+json');
return $request;
}
__PACKAGE__->meta->make_immutable;
__END__
=head1 DESCRIPTION
Auth
|[]});
my ($w);
foreach (grep {defined $_} @{$hit->{ctx_}||[]}) { ##-- expand deep-encoded json context tokens if available (ddc >= v2.0.38)
foreach (grep {UNIVERSAL::isa($_,'ARRAY')} @$_)
>$w->[$_])} (0..$#$w) };
}
}
return $hit;
}
## $thingy = $obj->TO_JSON()
## + annoying wrapper for JSON
sub TO_JSON {
return { %{$_[0]} };
}
1; ##-- be happy
__END__
##================
foreach (@{$hl->{hits_}||[]});
return $hl;
}
## $thingy = $obj->TO_JSON()
## + annoying wrapper for JSON, JSON::XS
sub TO_JSON {
return { %{$_[0]} };
}
1; ##-- be happy
__END__
##===========
Dumper formatting of L<DDC::HitList|DDC::HitList> objects.
=item L<DDC::Format::JSON|DDC::Format::JSON>
Class for JSON formatting of L<DDC::HitList|DDC::HitList> objects.
=item L<DDC::Format::Kwic|
-conversion (for toJson())
sub toHash {
my ($obj,%opts) = @_;
return $obj->SUPER::toHash(%opts) if (!$opts{json});
return { class=>$obj->jsonClass, $obj->jsonData };
}
sub jsonData {
my $qo =
()),
($qo->{DebugRank} ? (DebugRank=>$qo->{DebugRank}) : qw()),
(Filters=>[map {($_->toHash(json=>1))} @{$qo->{Filters}||[]}]),
($qo->{Subcorpora} && @{$qo->{Subcorpora}} ? (Subcorpora=>$qo->
sub jsonType { return (FilterType=>$DDC::PP::HitSortEnumStrings[$_[0]{Type}]); }
sub jsonMinMax { return (Min=>$_[0]{Arg1}, Max=>$_[0]{Arg2}); }
sub jsonData { return ($_[0]->jsonType, $_[0]->jsonMinM
(for toJson())
sub toHash {
my ($obj,%opts) = @_;
return $obj->SUPER::toHash(%opts) if (!$opts{json});
return { class=>$obj->jsonClass, $obj->jsonData };
}
##-- pseudo-accessors (for json)
__PA
rt;
use strict;
our @ISA = qw(DDC::PP::CQFSort);
sub defaultSort { return 'GreaterByRank'; }
sub jsonMinMax { return qw(); }
##======================================================================