reference
cause =>
{
object => $some_object,
payload => $json_data,
},
});
print( "Error stack trace: ", $ex->stack_trace, "\n" );
# or
$self->{api} = undef unless( CORE::exists( $self->{api} ) );
# The name of the JSON property containing the array reference of data
# This is used for data in format other than
return( $self->error( "No search query set." ) ) if( !$filter->query );
my $json = $filter->as_json ||
return( $self->pass_error( $filter->error ) );
$req->method( 'PO
else
{
$req->method( 'GET' );
}
$req->headers->header( Accept => 'application/json' );
my $data = $api->fetch( $type => {
request => $req,
# We simply want the
sub usage { return
"Usage : $0 [--I 'a-json-string' | --i 'afile.json'] [--o afile] [--(no-)escape-unicode|-e] [--(no-)pretty|-p]\n"
."\nIt will read a JSON string from command line (-I), or from a
ware 4K limit on linux terminal, see CAVEATS for workaround).\n"
."It will print its contents as JSON to STDOUT or to a file (--o).\n"
."It can escape/un-escape unicode characters (--escape-unicode)
N> }
}
my $result = Data::Roundtrip::json2json($INPUT_STRING, \%params);
if( ! defined $result ){ print STDERR "$0 : error, call to ".'Data::Roundtrip::json2jsonl()'." has failed.\n"; exit(1) }
if(
takes in the fields.json file, which is an aggregation of all the fields definition found, and can be edited manually.
# It then makes some adjustments, and produces the api.json file used by the mod
cumentE>
# <https://github.com/metacpan/metacpan-api/blob/master/docs/API-docs.md>
# ./dev/fields.json
my $base_dir = file( __FILE__ )->parent;
my $field2type =
{
'file::author' =>
{
typ
},
};
$field2type->{metadata}->{def}->{resources} = $field2type->{resources};
# NOTE: fields.json is an adjusted aggregation of the fields mapping as documented by the MetaCPAN API documentation
ontaining all properties for each class used.
# From this file is created the fields.json file and then the api.json file
#
# This program is free software; you can redistribute it and/or modify it u
$UA_OPTS $TYPE2CLASS $MODULE_RE );
use HTTP::Promise;
use HTTP::Promise::Headers;
use JSON;
use constant
{
API_URI => 'https://fastapi.metacpan.org',
METACPAN_CLIE
ch_https => 1,
default_headers => HTTP::Promise::Headers->new(
Accept => 'application/json,text/html,application/xhtml+xml;q=0.9,*/*;q=0.8',
),
ext_vary => 1,
max_body_in_memor
N::Filter' ) )
{
$filter = shift( @_ );
my $payload = $filter->as_json( encoding => 'utf8' ) ||
return( $self->pass_error( $filter->error ) );
return( $data );
}
sub as_json
{
my $self = shift( @_ );
my $opts = $self->_get_args_as_hash( @_ );
my $data = $self->as_hash;
my $j = $self->new_json;
$j = $j->pretty if( $opt
s->{pretty} );
$j = $j->canonical if( $opts->{sort} );
my $json;
local $@;
# try-catch
eval
{
if( exists( $opts->{encoding} ) &&
defined( $opts->{encoding}
$json = $j->utf8->encode( $data );
}
else
{
$json = $j->encode( $data );
}
};
if( $@ )
{
return( $self->error( "Error encoding to JSON:
= Net::API::CPAN::Mock->new(
pretty => 1,
openapi => '/path/to/cpan-openapi-specs.json',
) || die( Net::API::CPAN::Mock->error, "\n" );
$mock->bind || die( $mock->error );
<port> to use when starting the mock CPAN API server.
=item * C<pretty>
Boolean. If true, the C<JSON> data returned by the mock server will be in a human-readable format.
=item * C<schema>
The Ope
ault, the value used is C<127.0.0.1>
This returns the current C<host> value.
=head2 json
Sets or gets the L<JSON> object.
=head2 load_specs
This takes a file path to an OpenAPI specifications, an
=> 0,
);
sub usage { return
"Usage : $0 [--I 'a-perl-var-as-string' | --i 'afile.pl'] [--o afile.json] [--(no-)escape-unicode|-e] [--(no-)pretty]\n"
."\nIt will read a Perl variable as a string from
om STDIN (beware 4K limit on linux terminal, see CAVEATS for workaround).\n"
."It will print its JSON equivalent to STDOUT or to a file (--o).\n"
."It can optionally escape unicode characters (--esc
}
}
my $result = Data::Roundtrip::dump2json($INPUT_STRING, \%params);
if( ! defined $result ){ print STDERR "$0 : error, call to ".'Data::Roundtrip::dump2jsonl()'." has failed.\n"; exit(1) }
if( de
ions::sys_info;
use 5.006;
use strict;
use warnings;
use Ixchel::functions::sys_info;
use JSON qw(to_json);
use YAML::XS qw(Dump);
use Data::Dumper;
use base 'Ixchel::Actions::base';
=head1 NAME
s it in various formats.
=head1 Switches
=head2 -o <format>
Format to print it in.
Available: json, yaml, toml, dumper
Default: toml
=cut
sub new_extra { }
sub action_extra {
my $self = $_[0]
$self->{opts}->{o} = 'toml';
}
if ( $self->{opts}->{o} ne 'toml'
&& $self->{opts}->{o} ne 'json'
&& $self->{opts}->{o} ne 'dumper'
&& $self->{opts}->{o} ne 'yaml' )
{
$self->status_add(
py );
use File::Path qw( mkpath );
my $status_filename = File::Spec->catfile('_alien', '00system.json');
exit if -e $status_filename;
my $share_dir = File::Spec->catdir(qw( blib lib auto share dist
;
close $fh;
}
my $from = File::Spec->catfile(qw( _alien 05stage.json ));
my $to = File::Spec->catfile($share_dir, 'status.json');
print "write $to\n";
copy($from, $to) || die "unable to copy $f
trict;
use warnings;
use Config;
use File::Spec;
use File::Path qw( rmtree );
use JSON::PP qw( encode_json decode_json );
use if $^O eq 'MSWin32', 'Alien::MSYS';
use Env qw( @PATH );
unshift @PATH, A
[static|dll]\n";
exit 2;
}
my $status_filename = File::Spec->catfile('_alien', "04build_$type.json");
exit if -e $status_filename;
if($type eq 'dll')
{
# This IF is the logic we use to determin
fh encode_json({ skip => 1 });
close $fh;
exit;
}
}
my $src_dir = do {
my $fn = File::Spec->catfile('_alien', '03extract.json');
open my $fh, '<', $fn;
my $json = decode_json(do {loca
tion can also be used to strip C-style comments from JSON
without removing string contents:
use C::Tokenize 'strip_comments';
my $json =<<EOF;
{
/* Comment comment comment */
strip_comments ($json);
produces output
{
"/* not comment */":"/* not comment */",
"value":["//not comment"]
}
(This example is included as L<F<strip-json.pl>|https://fast
api.metacpan.org/source/BKB/C-Tokenize-0.19/examples/strip-json.pl> in the distribution.)
=head1 EXPORTS
Nothing is exported by default.
use C::Tokenize ':all';
exports all the regular expre
e JSON -convert_blessed_universally;
use URI;
our $report;
use Mail::DMARC::PurePerl;
my %mimes = (
css => 'text/css',
html => 'text/html',
js => 'application/javascript',
json =
> 'application/json',
);
sub new {
my $class = shift;
return bless {}, $class;
}
sub dmarc_httpd {
my $self = shift;
$report = shift;
my $port = $report->config->{http}{port}
urn report_json_report() if $path eq '/dmarc/json/report';
return report_json_rr() if $path eq '/dmarc/json/row';
return serve_validator() if $path eq '/dmarc/json/validate';
package Alien::pkgconf;
use strict;
use warnings;
use JSON::PP ();
use File::Spec;
use File::ShareDir ();
our $VERSION = '0.21';
=head1 NAME
Alien::pkgconf - Discover or download and install pkgco
$filename = _dist_file('status.json');
my $fh;
open $fh, '<', $filename;
my $json = JSON::PP::decode_json(do { local $/; <$fh> });
close $fh;
$json;
};
}
=head1 METHODS
=head2
json-c
- libmaxminddb
Debian:
- liblognrom-dev
- libpcre3-dev
- build-eesential
- libesmtp-dev
- libhiredis-dev
- libjson
th qw( rmtree mkpath );
use JSON::PP qw( encode_json decode_json );
#use Alien::xz;
use Env qw( @PATH );
my $status_filename = File::Spec->catfile('_alien', '03extract.json');
exit if -e $status_file
my $fn = File::Spec->catfile('_alien', '02fetch.json');
open my $fh, '<', $fn;
my $json = decode_json(do {local $/; <$fh> });
close $fn;
$json->{filename};
};
#if($tar_filename =~ /\.xz$/)
#
t[0];
};
$filename = File::Spec->catdir('_alien', 'src', $filename);
print "write $filename\n";
my $fh;
open $fh, '>', $status_filename;
print $fh encode_json({ src_dir => $filename });
close $fh;
=> 'notice',
console => 'no',
console_json => 0,
file => 'yes',
file_level => 'info',
file_json => 0,
syslog => 'no',
syslog_fac
ility => 'local5',
syslog_format => '[%i] <%d> -- ',
syslog_json => 0,
},
update => {
enable => 0,
no_reload => 0,
no_test => 0,
offline => 0,
noreHosts => '',
env_proxy => 0,
stats_file => '/var/cache/suricata_extract_submit_stats.json',
stats_dir => '/var/cache/suricata_extract_submit_stats/',
interval => '*/2 * * * *',
package Ixchel::Actions::xeno;
use 5.006;
use strict;
use warnings;
use File::Slurp;
use JSON::Path;
use YAML::XS qw(Load);
use Ixchel::functions::file_get;
use base 'Ixchel::Actions::base';
=head1
;
use strict;
use warnings;
use Ixchel::functions::sys_info;
use JSON qw(to_json);
use YAML::XS qw(Dump);
use Data::Dumper;
use JSON::Path;
use base 'Ixchel::Actions::base';
=head1 NAME
Ixchel::
mat to print it in.
Available: json, yaml, toml, dumper
Default: yaml
=head2 -s <section>
A JSON style path used for fetching a sub section of the
config via L<JSON::Path>.
Default: undef
=head1
{
$self->{opts}->{o} = 'yaml';
}
if ( $self->{opts}{o} ne 'toml'
&& $self->{opts}{o} ne 'json'
&& $self->{opts}{o} ne 'dumper'
&& $self->{opts}{o} ne 'yaml' )
{
self->status_add(
st