>. The default serialization method is L<JSON>,
though one can specify any serialization format you want. L<YAML> and L<Storable> are
viable alternatives.
JSON was chosen as the default serialization
}
my $session_data = $session_object->$data_column;
# No way to check that it's valid JSON other than trying to deserialize it
my $session = try {
$self->_deserialize($session_
Dancer function, not from JSON.pm
return to_json({%$self}, { pretty => 0, convert_blessed => 1 });
}
# Default Deserialize method
sub _deserialize {
my ($self, $json) = @_;
my $settings
sed together with WWW::LetsEncrypt::JWK as parents
will create a JSON Web Key that implements all the functions needed for signing
JSON Web Signature objects.
=head2 Attributes
'alg' a scalar attrib
$WWW::LetsEncrypt::JWK::VERSION = '0.002';
use strict;
use warnings;
use Carp qw(confess);
use JSON;
use Moose::Role;
has 'key_type' => (
is => 'ro',
isa => 'Str',
required => 1,
);
ed together with WWW::LetsEncrypt::JWA as parents
will create a JSON Web Key that implements all of the functions needed for
signing JSON Web Signature objects. Specifically, this role deals with stor
blic Functions
=over 4
=item generate_new
This function, when implemented, should create a new JSON Web Key of a specific algorithm type.
Input
$number - key_length
$string - key id
Output
J
package Net::Nessus::REST;
use warnings;
use strict;
use Carp;
use LWP::UserAgent;
use JSON;
use List::Util qw(first);
use version; our $VERSION = version->declare('v0.7.0');
sub new {
my ($cl
query_form(%params);
my $response = $self->{agent}->get($url);
my $result = eval { from_json($response->content()) };
if ($response->is_success()) {
return $result;
} else {
;
my $response = $self->{agent}->delete($self->{url} . $path);
my $result = eval { from_json($response->content()) };
if ($response->is_success()) {
return $result;
} else {
se strict;
use warnings;
use constant {RC_TOO_MANY_REQUESTS => 429};
use Carp qw(confess);
use JSON;
use LWP::UserAgent;
use Moose;
use Moose::Util::TypeConstraints;
use WWW::LetsEncrypt::JWS;
use
lts to the
Let's Encrypt API URL, cannot be changed once the object has been created.
=item JWK
JSON Web Key object that implements both JWK and JWA (will be passed to
a JWS object). This is require
if ($processed_response->{error} || $rate_limited) {
my $err_ref;
try {
$err_ref = decode_json($Response->content());
} catch {
$err_ref->{message} = $Response->content();
$err_ref->{f
(confess);
use Digest::SHA;
use HTTP::Request;
use HTTP::Status qw(RC_CREATED RC_FORBIDDEN);
use JSON;
use MIME::Base64 qw(encode_base64url);
use Moose;
use Moose::Util::TypeConstraints;
extends qw(
esponse) = @_;
my $output_ref;
if ($Response->code == RC_CREATED) {
my $response_ref = decode_json($Response->content);
if ($response_ref->{status} eq 'pending') {
my ($challenge_ref) = grep
return {error => 1};
}
} elsif ($Response->code == RC_FORBIDDEN) {
my $response_ref = decode_json($Response->content);
if ($response_ref->{type} eq 'urn:acme:error:unauthorized') {
if ($resp
ally, modulo lazy fetching of references.
That means that when a parsed schema is rendered out to JSON, it should look
the same as the original document.
Probably the sane way to do this would be to
indexpageids => 1,
generator => $generator,
format => "json"
};
if(defined $namespace_key){
$a->{ $namesp
my $a = {
action => "query",
format => "json",
pageids => $pageid,
prop => "revisions"
y, and cannot be overwritten:
action = "query"
indexpageids = 1
generator = <generate>
format = "json"
Additional parameters can be set in the constructor argument 'args'.
Arguments for a generator
time details needed for L</"load">).
User is supposed to serialize returned value (for ex. into JSON format),
save it into file/database, and use later with L</"load"> if she wanna
keep information
qw(encode_base64url decode_base64url);
use Crypt::OpenSSL::Bignum;
use Crypt::OpenSSL::RSA;
use JSON;
use Moose;
with qw(WWW::LetsEncrypt::JWK WWW::LetsEncrypt::JWA);
sub generate_new {
my ($key_
thumbprint {
my ($self) = @_;
# RFC requires the keys to be sorted lexically.
my $JSON = JSON->new();
$JSON->canonical(1);
my %pubkey = $self->_get_public_key_components();
$pubkey{kty} = 'RS
f !$hash_method;
my $jsonified_sorted_pk = $JSON->encode(\%pubkey);
my $digested_jsonified_pk = $hash_method->($jsonified_sorted_pk);
return encode_base64url($digested_jsonified_pk);
}
sub _get
cache
key for a Moose metaclass. That's a nice approach when you know the incoming
hash is always JSON, but doesn't work as well when you can't predict the value
type (especially if the value is a cod
age WWW::ShipStation;
use strict;
use 5.008_005;
our $VERSION = '0.06';
use LWP::UserAgent;
use JSON;
use Carp 'croak';
use URI::Escape qw/uri_escape/;
use HTTP::Request;
sub new {
my $class =
args{pass} or croak "pass is required.";
$args{ua} ||= LWP::UserAgent->new();
$args{json} ||= JSON->new->allow_nonref->utf8;
$args{API_BASE} ||= 'https://ssapi.shipstation.com/';
bl
application/json'); # JSON is better
my $res = $self->{ua}->request($req);
# use Data::Dumper; print STDERR Dumper(\$res);
if ($res->header('Content-Type') =~ m{application/json}) {
vcdiff
system(Alien::OpenVcdiff::vcdiff_binary() . " encode -dictionary file1 -target file2 -json");
=head2 Library interface
my $openvcdiff = Alien::OpenVcdiff->new;
my $cflags = $ope
rtificate::VERSION = '0.002';
use HTTP::Status qw(RC_OK RC_CREATED RC_ACCEPTED RC_FORBIDDEN);
use JSON;
use Moose;
extends 'WWW::LetsEncrypt::Message';
=pod
=head1 NAME
WWW::LetsEncrypt::Message::
W::LetsEncrypt::Message::Directory;
$WWW::LetsEncrypt::Message::Directory::VERSION = '0.002';
use JSON;
use Moose;
extends 'WWW::LetsEncrypt::Message';
=pod
=head1 NAME
WWW::LetsEncrypt::Message::
if ($Response->code() == 200) {
my $json_data = decode_json($Response->content());
return {
successful => 1,
finished => 1,
directory => $json_data,
};
}
return {
successful =>
tion;
$WWW::LetsEncrypt::Message::Registration::VERSION = '0.002';
use strict;
use warnings;
use JSON;
use HTTP::Request;
use HTTP::Status qw(RC_CREATED RC_ACCEPTED RC_FORBIDDEN RC_CONFLICT);
use Moo
REATED) {
$self->_step('update') if $self->_step() eq 'new-reg';
my $server_response = decode_json($Response->content);
my $resp_ref = {%$server_response};
$resp_ref->{successful} = 1;
retu
l => 1,
finished => 1,
};
} elsif ($status_code == RC_FORBIDDEN) {
my $err_ref = decode_json($Response->content);
if ($err_ref->{type} =~ m/unauthorized$/
&& $err_ref->{detail} =~ m/^No
use Log::Defer;
use JSON::XS; ## or whatever
use Try::Tiny;
sub my_logger_function {
my $msg = shift;
my $encoded_msg = try {
JSON::XS->new->pretty(1)->encod
e($msg)
}
catch {
"Failed to JSON encode msg : $_"
};
print $encoded_msg; ## usually you'd append this to a file
}
my $logger = Log::Defer->new({
isualisation tool L<log-defer-viz> only support JSON at this time.
The currently recommended format to store logs in is newline-separated, minified JSON. The newline+minification is useful because it
~ /(?:<|!=|==)/}sub encode_json {my($self,$data)=@_;require JSON::PP;my$json=JSON::PP::encode_json($data);$json =~ s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;$json}sub version_to_query {my($
atch->{hits}{hits}};$hits[0]->{fields}}sub search_metacpan {my($self,$module,$version)=@_;require JSON::PP;$self->chat("Searching $module ($version) on metacpan ...\n");my$metacpan_uri='http://api.met
ified",query=>{constant_score=>{filter=>{and=>[{term=>{'module.authorized'=>JSON::PP::true()}},{term=>{'module.indexed'=>JSON::PP::true()}},{term=>{'module.name'=>$module }},$self->version_to_query($m
installation
$Installer::Software::VERSION = '0.904';
use Moo;
use IO::All;
use IO::All::LWP;
use JSON_File;
use Path::Class;
use File::chdir;
use Archive::Extract;
use namespace::clean;
has target =
y => 1,
default => sub {
my ( $self ) = @_;
tie(my %meta,'JSON_File',file($self->target->installer_dir,$_[0]->alias.'.json')->stringify,, pretty => 1 );
return \%meta;
},
);
has testa
ions
=head1 VERSION
version 0.104
=head1 SYNOPSIS
package MyApp::Web;
use Yeb qw( Session JSON );
r "/" => sub {
session test => pa('test');
text "root";
};
r "/blub" => sub {
n '+SomeOther::YebApp';
};
1;
package MyApp::Web::Test;
use MyApp::Web;
r "/json" => sub {
json {
test => session('test'),
stash_var => st('stash_var'),
}
};
r "/
ds L<plackup>
Bigger L<Text::Xslate> example:
package MyApp::WebXslate;
use Yeb Session => JSON => 'Xslate';
# because of the root() usage we need to use plugin function call
plugin Static