*Throw_::TO_JSON = sub { +{%{$_[0]}} };
*Throw_::_str = sub { my ($s) = @_; my ($e,$p) = delete(@$s{qw(error _pretty)}); $e||="throw"; $e .= ': '.($p||$Throw::pretty?jsop():json())->encode($
_decode_utf8_recurse($args) if $enc;
$req = eval { $self->json->encode($args) } || throw "Trouble encoding $name service json", {msg => $@}, 1;
my $sign = defined($pass) ? do { my $t
0\r\n${cookie}${sign}Host: $host\r\nContent-length: ".length($req)."\r\nContent-type: application/json\r\n\r\n$req";
warn "DEBUG_Respite: Connected to http".($no_ssl?'':'s')."://$host:$port/\n
use Mail::Milter::Authentication::Config;
use Carp;
use Clone;
use English;
use File::Slurp;
use JSON::XS;
use Module::Load;
use Module::Loaded;
use Mail::AuthenticationResults 1.20200108;
use Mail::
::into(scalar caller);
File::Slurp->import::into(scalar caller, qw{ read_file write_file } );
JSON::XS->import::into(scalar caller);
Module::Load->import::into(scalar caller);
Module::Loaded->
*Throw_::TO_JSON = sub { +{%{$_[0]}} };
*Throw_::_str = sub { my ($s) = @_; my ($e,$p) = delete(@$s{qw(error _pretty)}); $e||="throw"; $e .= ': '.($p||$Throw::pretty?jsop():json())->encode($
_decode_utf8_recurse($args) if $enc;
$req = eval { $self->json->encode($args) } || throw "Trouble encoding $name service json", {msg => $@}, 1;
my $sign = defined($pass) ? do { my $t
0\r\n${cookie}${sign}Host: $host\r\nContent-length: ".length($req)."\r\nContent-type: application/json\r\n\r\n$req";
warn "DEBUG_Respite: Connected to http".($no_ssl?'':'s')."://$host:$port/\n
imestamp without time zone NOT NULL DEFAULT NOW(),
workflow_fkey bigint not null,
context JSON,
CONSTRAINT context_workflow_fkey FOREIGN KEY (workflow_fkey)
REFERENCES workflow (wo
ently handle args from json, form, or commandline
_encode_utf8_recurse($args) if $trp eq 'json';
} else {
_decode_utf8_recurse($args) if $trp && $trp ne 'json';
}
my $resp
nd
manipulates a text format that Mac OS X uses.
If you need to work with the old ASCII or newer JSON formet, you can
use the B<plutil> tool that comes with MacOS X:
% plutil -convert xml1 -o Examp
data passed is
assumed to be utf8 encoded meaning that it will need to be decoded
before calling json->encode.
Additionally, the true value can be a hashref of methods that need
this treatment. Thi
hen the non-json transport is finalized, it will
need to call decode_utf8 to make sure data is ready for the
transport.)
=back
=head1 PROTOCOL
The Net::Respite::Client service is a JSON over HTTPS
be a POST request with a content type of x-application/json.
The request should be hashref (map or associative array) of properly encoded JSON.
Several meta parameters may passed as part of the req
efix ) = @_;
return if $milter_pid;
if ( ! -e $prefix . '/authentication_milter.json' ) {
die "Could not find config";
}
system "cp $prefix/mail-dmarc.in
my $metrics = get_metrics( 'tmp/authentication_milter_test_metrics.sock' );
my $j = JSON::XS->new();
if ( -e $expected ) {
open my $InF, '<', $expected;
smtp_process {
my ( $args ) = @_;
if ( ! -e $args->{'prefix'} . '/authentication_milter.json' ) {
die "Could not find config " . $args->{'prefix'};
}
if ( ! -e 'data/source/'
data passed is
assumed to be utf8 encoded meaning that it will need to be decoded
before calling json->encode.
Additionally, the true value can be a hashref of methods that need
this treatment. Thi
y when the non-json transport is finalized, it will
need to call decode_utf8 to make sure data is ready for the
transport.)
=back
=head1 PROTOCOL
The Respite::Client service is a JSON over HTTPS se
be a POST request with a content type of x-application/json.
The request should be hashref (map or associative array) of properly encoded JSON.
Several meta parameters may passed as part of the req
Net::Server revision', {v => $Net::Server::VERSION} if $Net::Server::VERSION < 2.007;
$self->json; # vivify before fork
my $server = $class->SUPER::new(%$self, %{ $self->server_args });
@
>subprocess_env(); 1 }) {
$self->cgihandler();
} else {
warn my $err = $self->json->encode({error => "$@", type => 'mod_perl_header'});
$self->send_response($err);
}
};
my $req;
if ($ENV{'CONTENT_TYPE'} && $ENV{'CONTENT_TYPE'} =~ /\bjson\b/) {
throw 'JSON data may not be submitted via GET' if !$ENV{'REQUEST_METHOD'} || $ENV{'REQUEST_MET
imestamp without time zone NOT NULL DEFAULT NOW(),
workflow_fkey bigint not null,
context JSON,
CONSTRAINT context_workflow_fkey FOREIGN KEY (workflow_fkey)
REFERENCES workflow (wo
nt qw( LedgerSMB::Installer::OS::linux );
use Carp qw( croak );
use English;
use HTTP::Tiny;
use JSON::PP;
use Capture::Tiny qw( capture_stdout );
use Log::Any qw($log);
sub new($class, %args) {
package Respite::AutoDoc;
use strict;
use warnings;
use CGI::Ex::App qw(:App);
use base qw(CGI::Ex::App);
use Throw qw(throw);
use Time::HiRes ();
use JSON ();
use Scalar::Util ();
1;
Net::Server revision', {v => $Net::Server::VERSION} if $Net::Server::VERSION < 2.007;
$self->json; # vivify before fork
my $server = $class->SUPER::new(%$self, %{ $self->server_args });
@
>subprocess_env(); 1 }) {
$self->cgihandler();
} else {
warn my $err = $self->json->encode({error => "$@", type => 'mod_perl_header'});
$self->send_response($err);
}
};
my $req;
if ($ENV{'CONTENT_TYPE'} && $ENV{'CONTENT_TYPE'} =~ /\bjson\b/) {
throw 'JSON data may not be submitted via GET' if !$ENV{'REQUEST_METHOD'} || $ENV{'REQUEST_MET
ub get_json {
my ( $self, $file ) = @_;
my $basefile = __FILE__;
$basefile =~ s/Handler\.pm$/Handler\/$file/;
$basefile .= '.json';
if ( ! -e $basefile ) {
die 'json file '
0;
my $count_allocated = 0;
my $count_stale = 0;
my $dequeue_index = {};
my $j = JSON->new->pretty->canonical->utf8;
# Build a list of Process IDs
my $process_ids = {};
m
$self->add_auth_headers_of_type($type);
}
if ($config->{extended_log}) {
my $j = JSON->new->canonical->utf8;
$self->dbgout( 'ARex',$j->encode($self->{extended_log}), LOG_INFO
ently handle args from json, form, or commandline
_encode_utf8_recurse($args) if $trp eq 'json';
} else {
_decode_utf8_recurse($args) if $trp && $trp ne 'json';
}
my $resp
t->json->decode(shift) }
=cut
use strict;
use warnings;
sub new {
my ($class, $args) = @_;
return bless {%{$args || {}}}, $class;
}
our $js;
sub json { $js ||= eval { require JSON; JSON->n
Could not load JSON: $@" }
our $jp;
sub jsop { $jp ||= eval { require JSON; JSON->new->utf8->allow_unknown->allow_nonref->convert_blessed->canonical->pretty } || die "Could not load JSON: $@" }
our $
nt qw( LedgerSMB::Installer::OS::linux );
use Carp qw( croak );
use English;
use HTTP::Tiny;
use JSON::PP;
use Capture::Tiny qw(capture_stdout capture);
use Log::Any qw($log);
# dnf repoquery --ins
_url($self, $distro, $id) {
return "https://download.ledgersmb.org/f/dependencies/$distro/$id.json";
}
sub have_deps($self) {
return (defined $self->{_deps}
and defined $self->{_d
;
my $r = $http->get( $url );
my $pkgs;
if ($r->{success}) {
$self->{_deps} = JSON::PP->new->utf8->decode( $r->{content} );
$pkgs = $self->{_deps}->{packages};
}
el
.com/repos/ledgersmb/LedgerSMB/releases/latest' );
if ($r->{success}) {
my $content = JSON::PP->new->utf8->decode( $r->{content} );
if (defined $content
and defined $c
emp qw( tempfile );
use Getopt::Long qw(GetOptionsFromArray);
use HTTP::Tiny;
use IO::Handle;
use JSON::PP;
use List::Util qw(uniq);
use Module::CoreList;
use version;
use Log::Any qw($log);
use Log:
o be the module version
my $http = HTTP::Tiny->new( agent => 'LedgerSMB-Installer/0.1' );
my $json = JSON::PP->new->canonical;
sub _post_boot_configure($class, $dss, $config) {
Log::Any::Adapter
rovides => [ @last_deps ] } }
]
}
};
my $body = $json->encode( $query );
my $r = $http->request( 'POST', 'https://fastapi.metacpan.org/v1/relea