#!/usr/bin/env perl
use 5.14.2;
use warnings;
use JSON::XS;
my $json = JSON::XS->new->canonical->pretty->utf8;
say $json->encode($json->decode(join('',<>)));
package Zonemaster::Logger::Entry v1.0.0;
use 5.14.2;
use Time::HiRes qw[time];
use JSON;
use Moose;
use Zonemaster;
use overload '""' => \&string;
our %numeric = (
DEBUG3 => -2,
DEBUG2
2,
WARNING => 3,
ERROR => 4,
CRITICAL => 5,
);
our $start_time = time();
my $json = JSON::XS->new->allow_blessed->convert_blessed->canonical;
has 'module' => ( is => 'ro', isa =>
uninitialized';
$argstr = join( ', ',
map { $_ . '=' . ( ref( $self->args->{$_} ) ? $json->encode( $self->args->{$_} ) : $self->args->{$_} ) }
sort keys %{ $self->args } )
i
s );
}
my $from = $self->packet->answerfrom // '<unknown>';
return $from;
}
sub TO_JSON {
my ( $self ) = @_;
return { 'Zonemaster::Packet' => $self->packet };
}
no Moose;
__PA
thod, that replaces udnefined values with the string C<E<lt>unknownE<gt>>.
=item TO_JSON
Support method for L<JSON> to be able to serialize these objects.
=back
=head1 METHODS PASSED THROUGH
Thes
els = ( $label, @{ $self->labels } );
return $self->new( { labels => \@labels } );
}
sub TO_JSON {
my ( $self ) = @_;
return $self->string;
}
## no critic (Modules::RequireExplicitIncl
NS tree.
=item prepend($label)
Returns a new L<Zonemaster::DNSName> object, representing the called one with the given label prepended.
=item TO_JSON
Helper method for JSON encoding.
=back
=cut
e Zonemaster::Recursor;
use Net::LDNS;
use Net::IP::XS qw(:PROC);
use Time::HiRes qw[time];
use JSON::XS;
use MIME::Base64;
use Module::Find qw[useall];
use Carp;
use List::Util qw[max min sum];
us
rn $self->string cmp $other->string;
}
sub save {
my ( $class, $filename ) = @_;
my $json = JSON::XS->new->allow_blessed->convert_blessed;
open my $fh, '>', $filename or die "Cache save
foreach my $addr ( keys %{ $object_cache{$name} } ) {
say $fh "$name $addr " . $json->encode( $object_cache{$name}{$addr}->cache->data );
}
}
close $fh or die $!;
Moose;
use JSON::PP;
use Zonemaster::Util;
use Net::IP::XS;
use Zonemaster;
my $seed_data;
our %recurse_cache;
{
local $/;
my $json = <DATA>;
$seed_data = decode_json $json;
}
sub rec
package Zonemaster::Config v1.0.1;
use 5.14.2;
use Moose;
use JSON;
use File::ShareDir qw[dist_dir dist_file];
use File::Slurp;
use Hash::Merge;
use File::Spec;
use Zonemaster;
has 'cfiles' => (
g_directory_list() ) {
my $cfile = File::Spec->catfile( $dir, 'config.json' );
my $new = eval { decode_json read_file $cfile };
if ( $new ) {
$config = $merger->mer
s }, $cfile;
}
my $pfile = File::Spec->catfile( $dir, 'policy.json' );
$new = eval { decode_json read_file $pfile };
if ( $new ) {
my $tc = $new->{__testca
rsion => $Module::Find::VERSION } );
info( DEPENDENCY_VERSION => { name => 'JSON', version => $JSON::VERSION } );
info( DEPENDENCY_VERSION => { name => 'File::ShareDir',
r::Logger::Entry;
use Zonemaster;
use List::MoreUtils qw[none];
use Scalar::Util qw[blessed];
use JSON::XS;
has 'entries' => (
is => 'ro',
isa => 'ArrayRef[Zonemaster::Logger::Entry]
elf->entries;
splice @$r, 0, scalar( @$r );
return;
}
sub json {
my ( $self, $min_level ) = @_;
my $json = JSON::XS->new->allow_blessed->convert_blessed->canonical;
my %numeri
{args} = $m->args if $m->args;
push @out, \%r;
}
return $json->encode( \@out );
} ## end sub json
no Moose;
__PACKAGE__->meta->make_immutable;
1;
=head1 NAME
Zonemaster::Log
=head1 OVERVIEW
At the moment, the configuration system is exceedingly simple: it's just a JSON-serialized hash stored as data in the L<Zonemaster::Config> module.
Eventually, this will be changed to
cal overrides of defaults.
The policy data is already distributed as and loaded from an external JSON file. There isn't yet any ability to override policy data, or specify
alternatives.
=head1 CONFI