;
bless $self, $class;
return $self;
}
sub TO_JSON {
my ($self) = @_;
# Return a copy of the object as a hash reference for JSON encoding
return {%$self};
}
sub abuse {
retu
lain string. It defaults to an empty string if not provided.
=head2 TO_JSON
This method is used to convert the object to a JSON representation.
=head2 abuse
my $abuse_email = $geo_details->abu
use 5.006;
use strict;
use warnings;
use Cache::LRU;
use LWP::UserAgent;
use HTTP::Headers;
use JSON;
use Geo::Details;
use Net::CIDR;
use Net::CIDR::Set;
our $VERSION = '3.2.0';
use constant DEFAU
elf->{ua}->default_headers(
HTTP::Headers->new(
Accept => 'application/json',
Authorization => 'Bearer ' . $token
)
);
$self->{ua}->agent("IPinfo
_type =~ m{application/json}i ) {
eval { $info = from_json( $response->decoded_content ); };
if ($@) {
return ( undef, 'Error parsing JSON response.' );
my $json = $opt{json};
my $strpdate = $opt{strpdate_obj};
my $strptime = $opt{strptime_obj};
my $ref = {
id => $opt{id},
day => $strpdate->parse_datetime( $json->{rei
$json->{zugName},
is_cancelled => $json->{cancelled},
raw_route => $json->{halte},
raw_polyline => $json->{polylineGroup}{polylineDescriptions},
strptime_obj => $strptime,
};
if ( $json-
>{halte} and @{ $json->{halte} } ) {
my %admin_id_ml;
my %trip_no_ml;
for my $stop ( @{ $json->{halte} } ) {
if ( defined $stop->{adminID} ) {
$admin_id_ml{ $stop->{adminID} } += 1;
}
= @_;
my $json = $opt{json};
my $ref = {
json => $opt{json},
train_type => $opt{train_type},
platform => $json->{departurePlatform},
platform_sched => $json->{departure
{
my ($self) = @_;
my $platform_length
= $self->{json}{platform}{end} - $self->{json}{platform}{start};
for my $sector ( @{ $self->{json}{platform}{sectors} } ) {
push(
@{ $self->{sector
atus::DE::DBRIS::Formation::Sector->new(
json => $sector,
platform => {
start => $self->{json}{platform}{start},
end => $self->{json}{platform}{end},
}
)
);
}
my @g
can output the deduplicated feed in either Atom or JSON format.
It is designed to be run from the command line, and it can be configured using
a JSON configuration file. The configuration file should
s
and functionality to be added in the future.
=head1 CONFIGURATION
The configuration file is a JSON file that specifies the feeds to be
aggregated, the output format, and the maximum number of entr
he output.
By default, the configuration file should be located at
C<~/.feed-deduplicator/config.json>, but this can be overridden by setting
the C<FEED_DEDUP_CONFIG> environment variable.
The confi
Carp qw(confess);
use DateTime;
use DateTime::Format::Strptime;
use Encode qw(decode encode);
use JSON;
use LWP::UserAgent;
use Travel::Status::DE::DBRIS::Formation;
use Travel::Status::DE::DBRIS::Jo
/Berlin',
);
my $json = $self->{json} = JSON->new->utf8;
if ( $conf{async} ) {
$self->{req} = $req;
return $self;
}
if ( $conf{json} ) {
$self->{raw_json} = $conf{json};
}
else {
if
}
if ( $self->{developer_mode} ) {
say decode( 'utf-8', $content );
}
$self->{raw_json} = $json->decode($content);
}
if ( $conf{station} ) {
$self->parse_stationboard;
}
elsif ( $co
$json = $opt{json};
my $strptime = $opt{strptime_obj};
my $ref = {
type => $json->{verkehrmittel}{kurzText},
line => $json->{verkehrmittel}{mittelText},
train => $json
$json->{verkehrmittel}{kurzText},
train_mid => $json->{verkehrmittel}{mittelText},
train_long => $json->{verkehrmittel}{langText},
id => $json->{journeyId},
stop_eva => $json->
hnhofsId},
destination => $json->{terminus},
platform => $json->{gleis},
rt_platform => $json->{ezGleis},
via => $json->{ueber},
via_last => ( $json->{ueber} // [] )->[-1],
};
use File::ShareDir 'dist_dir';
use File::Slurper qw/read_text write_text/;
use File::Temp ();
use JSON::PP ();
use YAML::XS ();
use Try::Tiny;
=head1 NAME
App::Netdisco::Transport::Python
=head1 DE
klet {
my ($self, $job, $workerconf) = @_;
my $action = $workerconf->{action};
my $coder = JSON::PP->new->utf8(1)
->allow_nonref(1)
->allow
_meters cube_meters cube_percent)
);
sub new {
my ( $obj, %opt ) = @_;
my %section = %{ $opt{json} };
my %platform = %{ $opt{platform} };
my $platform_length = $platform{end} - $platform{start
rm_length,
};
$ref->{length_percent} = $ref->{end_percent} - $ref->{start_percent};
return bless( $ref, $obj );
}
sub TO_JSON {
my ($self) = @_;
my %copy = %{$self};
return {%copy};
}
1;
requests and responses against an OpenAPI v3.1 or v3.2 document
# KEYWORDS: validation evaluation JSON Schema OpenAPI v3.1 v3.2 Swagger HTTP request response
our $VERSION = '0.107';
use 5.020;
use u
at 'indexed';
use Feature::Compat::Try;
use Encode 2.89 ();
use JSON::Schema::Modern;
use JSON::Schema::Modern::Utilities qw(jsonp unjsonp canonical_uri E abort is_equal is_elements_unique true false)
;
use OpenAPI::Modern::Utilities qw(add_vocab_and_default_schemas);
use JSON::Schema::Modern::Document::OpenAPI;
use MooX::TypeTiny 0.002002;
use Types::Standard qw(InstanceOf Bool);
use Mojo::Util qw
-8', $msg) if is_utf8($msg);
$io->say($msg);
} else {
$self->obj->post('tweets', {'-to_json' => {"text" => $msg}});
}
}
no Moose;
__PACKAGE__->meta->make_immutable;
# A module must ret
ng utf-8
=head1 NAME
JSON::Schema::Validate::Error - JSON Schema Exception
=head1 SYNOPSIS
use JSON::Schema::Validate::Error;
# Legacy 2-arg form:
my $err = JSON::Schema::Validate::Er
or->new( '/user/name', 'minLength violated' );
# Named-arg form (recommended):
my $err = JSON::Schema::Validate::Error->new(
path => '/user/name',
message =
horter than minLength 1"
# Comparisons (compare by message+path):
say 'same' if( $err eq JSON::Schema::Validate::Error->new( '/user/name', 'string shorter than minLength 1' ) );
# Hash v
=encoding utf-8
=head1 NAME
MouseX::OO_Modulino - Turn your Mouse class into JSON-aware Object-Oriented Modulino.
=head1 SYNOPSIS
#!/usr/bin/env perl
package MyModule;
use MouseX::OO_M
d to the method.
Option format: C<--name> or C<--name=value> (no space between name and value).
JSON values in options and arguments are automatically decoded:
=for code sh
$ ./MyScript.pm --con
ar context (default is list context)
=item C<--output=FORMAT>
Output format: C<jsonl> (default), C<json>(alias of jsonl), C<dump>
=item C<--undef_as=STRING>
How to represent undef in TSV output (d
=> 'infant_cabin',
);
sub new {
my ( $obj, %opt ) = @_;
my $ref = {};
my %json = %{ $opt{json} };
my $platform = $opt{platform};
$ref->{class_type} = 0;
$ref->{has_bistro}
$ref->{number} = $json{wagonIdentificationNumber};
$ref->{model} = $json{vehicleID};
$ref->{uic_id} = $json{vehicleID};
$ref->{section} = $json{platformPosition}{sector
= $json{type}{constructionType};
$ref->{model} =~ s{^.....(...)....(?:-.)?$}{$1} or $ref->{model} = undef;
my $self = bless( $ref, $obj );
$self->parse_type;
for my $amenity ( @{ $json{amen
my %json = %{ $opt{json} };
my $ref = {
carriages => $opt{carriages},
destination => $json{transport}{destination}{name},
train_type => $json{transport}{category},
name => $json{na
me},
line => $json{transport}{numberwline},
train_no => $json{transport}{number},
};
if ( $ref->{name} =~ m{ ^ IC[DE] 0* (\d+) $ }x and exists $ice_name{$1} ) {
$ref->{designation}
no};
$ref->{sectors} = [
uniq grep { defined }
map { $_->{platformPosition}{sector} } @{ $json{vehicles} // [] }
];
if ( @{ $ref->{sectors} } ) {
$ref->{has_sectors} = 1;
}
$ref->{start
trict;
use warnings;
use Dancer ':script';
use Moo;
use NetAddr::MAC qw/mac_as_ieee/;
use JSON qw(decode_json);
=head1 PUBLIC METHODS
=over 4
=item B<arpnip($host, $ssh)>
Retrieve ARP entries fro
md_v4 = "show ip arp vrf all | json | no-more\n";
my @out_v4 = $ssh->capture({ stdin_data => $cmd_v4 });
if (!$ssh->error) {
my $data = eval { decode_json(join '', @out_v4) };
"show ipv6 neighbor vrf all | json | no-more\n";
my @out_v6 = $ssh->capture({ stdin_data => $cmd_v6 });
if (!$ssh->error) {
my $data = eval { decode_json(join '', @out_v6) };
trings (major.minor.patch)
=item * C<jwt> - JWT-like tokens (base64url format)
=item * C<json> - Simple JSON objects
=item * C<base64> - Base64-encoded strings
=item * C<md5> - MD5 hashes (32 hex
$payload.$signature";
}
},
description => 'JWT-like tokens (base64url format)',
},
json => {
code => q{
Gen {
my @keys = qw(id name value status count);
my $key = $keys
my $value = 1 + int(rand(1000));
qq({"$key":$value});
}
},
description => 'Simple JSON objects',
},
base64 => {
code => q{
Gen {
my @chars = ('A'..'Z', 'a'..'z', '0'..
event_data => dclone (vars->{'hook_data'} || {}) };
# remove scalar references which to_json cannot handle
visit( $extra->{'event_data'}, sub {
my ($key, $valueref) = @_;
$$valuere
' if ref $$valueref eq 'SCALAR';
});
jq_insert({
action => ('hook::'. lc($conf->{'type'})),
extra => encode_base64( encode('UTF-8', to_json( $extra )), '' ),
});
return 1;
}
true;
d2 Script-based tooling
Available in 0.1.8, basic C<schedule-activity.pl> script supports Dumper/JSON schedules and activity lists, compiling with/out safety checks. Future support may provide for c
#!/usr/bin/env perl
use strict;
use warnings;
use autodie qw(:all);
use JSON::MaybeXS;
use File::Glob ':glob';
use File::Slurp;
use File::stat;
use POSIX qw(strftime);
use Readonly;
Readonly my %co
r_db => 'cover_db/cover.json',
output => 'cover_html/index.html'
);
# Read and decode coverage data
my $json_text = read_file($config{cover_db});
my $data = decode_json($json_text);
my $coverage_pc
ob("coverage_history/*.json");
# Cache historical data instead of reading for each file
my %historical_cache;
for my $hist_file (@history_files) {
my $json = eval { decode_json(read_file($hist_file)