package HTML::D3;
use strict;
use warnings;
use JSON::MaybeXS;
use Scalar::Util;
# TODO: add animated tooltips to charts with legends
=head1 NAME
HTML::D3 - A simple Perl module for generating ch
t be an array of arrays' unless ref($data) eq 'ARRAY';
# Generate JSON representation of data
my $json_data = encode_json([
map { { label => $_->[0], value => $_->[1] } } @$data
]);
th}" height="$self->{height}" style="border: 1px solid black;"></svg>
<script>
const data = $json_data;
const svg = d3.select("#chart");
const margin = { top: 20, right: 30, bottom: 40, left:
($self) = @_;
if ( $self->{messages} ) {
return @{ $self->{messages} };
}
return;
}
sub TO_JSON {
my ($self) = @_;
my $ret = { %{$self} };
for my $k ( keys %{$ret} ) {
if ( ref( $ret->{$
($self) = @_;
if ( $self->{sections} ) {
return @{ $self->{sections} };
}
return;
}
sub TO_JSON {
my ($self) = @_;
my $ret = { %{$self} };
for my $k ( keys %{$ret} ) {
if ( ref( $ret->{$
"format" => hidden => {
one_of => [ [ "json|j" => "output in json format" ], [ "yaml|y" => "output in yaml format" ], ],
default => 'json'
}
],
[
"relation" => hidden => {
ess ( $opt->syn );
$go{$syn} = \@rel_terms;
}
}
$errhandler->finish;
if ( $opt->format eq 'json' ) {
jspew( \*STDOUT, \%go );
} elsif ( $opt->format eq 'yaml' ) {
yspew( \*STDOUT, \%go );
}
package Grammar::Improver;
use strict;
use warnings;
use Carp;
use LWP::UserAgent;
use JSON::MaybeXS;
=head1 NAME
Grammar::Improver - A Perl module for improving grammar using LanguageTool API.
=h
atus_line());
}
my $response_content = $response->decoded_content;
my $response_data = decode_json($response_content);
# ::diag(Data::Dumper->new([$response_data])->Dump());
# Apply correction
"format" => hidden => {
one_of => [ [ "json|j" => "output in json format" ], [ "yaml|y" => "output in yaml format" ], ],
default => 'json'
}
],
[ 'alt_id', 'include alter
unless ( $opt->syn );
$go{$syn} = $t->acc;
}
}
$errhandler->finish;
if ( $opt->format eq 'json' ) {
jspew( \*STDOUT, \%go );
} elsif ( $opt->format eq 'yaml' ) {
yspew( \*STDOUT, \%go );
}
ABSTRACT: Client for wtfismyip.com
use Ref::Util qw( is_blessed_ref );
use JSON::MaybeXS qw( decode_json );
use Class::Tiny {
ua => sub {
require HTTP::Tiny;
sub json ($self) {
my $url = $self->base_url->clone;
$url->path("/json");
my $res = $self->ua->get($url);
if($res->{success}) {
my %hash = decode_json($re
Service::WTFIsMyIP;
my $wtfismyip = WebService::WTFIsMyIP->new;
say "your IP is", $wtfismyip->json->{IPAddress};
=head1 DESCRIPTION
This class provides an interface to the L<wtfismyip|https://wt
on of L<DBD::File>
which is (partly) developed by the same team that maintains
DBD::CSV. See META.json or Makefile.PL for the minimum versions.
=item SQL::Statement
X<SQL::Statement>
A simple SQL en
Net::Whois::IP is installed";
say " -j --json Output information in JSON";
say " -J --json-pretty Output information in JSON";
say " -lL --local=L Specify local l
e Socket;
use Net::CIDR;
use Data::Dumper;
use Math::Trig;
use LWP::Simple;
use Archive::Zip;
use JSON::PP;
use Text::CSV_XS qw( csv );
use List::Util qw( first sum );
use Getopt::Long qw(:config bu
my %conf = (
update => 1,
distance => 0,
whois => 0,
short => 0,
json => 0,
json_pretty => 0,
local_location => undef,
dsn => $ENV{GEOIP_DBI_DSN} || "dbi:Pg:db
e DateTime::Format::Strptime;
use Digest::MD5 qw(md5_hex);
use Encode qw(decode encode);
use JSON;
use LWP::UserAgent;
use Travel::Routing::DE::HAFAS::Connection;
use Travel::Status::DE::HAFAS;
u
my $json = $self->{json} = JSON->new->utf8;
# The JSON request is the cache key, so if we have a cache we must ensure
# that JSON serialization is deterministic.
if ( $self->{cache} ) {
$json->c
anonical;
}
$req = $json->encode($req);
$self->{post} = $req;
my $url = $conf{url} // $hafas_instance{$service}{mgate};
if ( my $salt = $hafas_instance{$service}{salt} ) {
if ( $hafas_instan
se Algorithm::Loops qw/MapCarU/;
use Bio::Gonzales::Matrix::Util;
use Data::Dumper;
use Cpanel::JSON::XS;
use Clone;
# Imports hier
use Moo;
use namespace::clean;
our $VERSION = 0.01_01;
our $N
}
sub encode_as_json {
my $self = shift;
my $js = Cpanel::JSON::XS->new->utf8->allow_nonref->indent(1); #->canonical(1);
return $js->encode( $self->as_hash );
}
sub json_spew {
my ( $s
f ) = @_;
open my $fh, '>', $f or die "Can't open filehandle: $!";
print $fh $self->encode_as_json;
close $fh;
}
sub subset {
my ( $self, $cb ) = @_;
my $assay = $self->assay;
m
:JSON::XS;
use Data::Dumper;
use Storable qw/nstore_fd fd_retrieve/;
our $VERSION = '0.090'; # VERSION
our %EXPORT_TAGS = (
'all' => [
qw(
ndjson_iterate ndjson_hash ndjson_slurp ndjson_
spew
ndjson_freeze ndjson_thaw
ythaw yfreeze yslurp yspew
jthaw jfreeze jslurp jspew
stoslurp stospew
)
],
std => [
qw(
ythaw yfreeze yslurp yspew
jthaw
*jthaw = \&Cpanel::JSON::XS::decode_json;
}
our $JSON = Cpanel::JSON::XS->new->indent(1)->utf8->allow_nonref;
sub jfreeze {
my $r;
my @d = @_;
try {
$r = $JSON->encode(@d);
} catch
ould be configurable
use strict;
use warnings;
use Carp;
use HTTP::Tiny;
use Log::Log4perl;
use JSON::MaybeXS;
use Scalar::Util;
=head1 NAME
CPAN::UnsupportedFinder - Identify unsupported or poorl
t.
=item C<json>
Generates a JSON report.
=back
=back
=cut
sub output_results {
my ($self, $results, $format) = @_;
$format ||= 'text'; # Default to plain text
if($format eq 'json') {
retu
ccess}) {
$self->{logger}->debug("Data fetched successfully from $url");
return eval { decode_json($response->{content}) };
}
$self->{logger}->debug("Status = $response->{status}");
if(($respon
as you normally would,
and this plugin will ensure the right prereqs are specified in the C<META.json>
and other things that are easy to get not quite right.
Specifically, this plugin:
=over 4
=it
nfile_meta
As of version 0.23, this plugin adds a special C<x_alienfile> metadata to your
C<META.json> or C<META.yml>. This contains the C<share> and C<system> prereqs
based on your alienfile. This
.',
'JSON::Any' => 'JSON::Any is deprecated. Use JSON::MaybeXS instead.',
'JSON::XS' => 'JSON::XS\'s author refuses to use public bugtracking and actively breaks interoperability. Cpanel::JSON::XS i
rk with several bugfixes and a more collaborative maintainer. See also JSON::MaybeXS. Note that JSON (the distribution) uses JSON::XS by default when installed.',
'Net::IRC' => 'Net::IRC is an ancien
d2 JSON::Any
L<JSON::Any> is deprecated. Use L<JSON::MaybeXS> instead.
=head2 JSON::XS
L<JSON::XS>'s author refuses to use public bugtracking and actively breaks
interoperability. L<Cpanel::JSON::X
fig;
use Mojo::Base -base, -signatures;
use Mojo::JSON qw {decode_json from_json};
use Mojo::File;
# NAME
# ====
#
# Daje::Config - Loads the JSON based configs and put them in a hash
#
# SYNOPSIS
h",
# )->load_list();
#
# DESCRIPTION
# ===========
#
# Daje::Config is loading workflows from JSON files in a set folder
#
# LICENSE
# =======
#
# Copyright (C) janeskil1525.
#
# This library is f
w($file);
my $tag = substr($path->basename(), 0, index($path->basename(), '.json'));
$config->{$tag} = from_json($path->slurp())->{$self->type()};
return $config;
}
# List of workflows i
package WWW::Kickstarter::JsonParser::JsonXs;
use strict;
use warnings;
no autovivification;
use JSON::XS qw( );
use WWW::Kickstarter::Error qw( my_croak );
sub new {
my ($clas
$self->{json_parser} = JSON::XS->new->utf8;
return $self;
}
sub decode { return $_[0]{json_parser}->decode($_[1]) }
1;
__END__
=head1 NAME
WWW::Kickstarter::JsonParser::JsonXs - JSON::XS co
json_parser_class => 'WWW::Kickstarter::JsonParser::JsonXs', # default
...
);
=head1 DESCRIPTION
This is the default JSON parser used by L<WWW::Kickstarter>.
It uses L<JSON::XS> t
n/x-www-form-urlencoded>) to send in the request.
An C<Accept> header with value C<< application/json; charset=utf-8 >> must be provided.
The following are returned:
The HTTP status code received fr
topt::Long::Descriptive and Getopt::Long::Modern for simpler usage.',
'JSON' => 'JSON.pm is old and full of slow logic. Use JSON::MaybeXS instead, it is a drop-in replacement in most cases.',
'List:
g::Descriptive> and L<Getopt::Long::Modern> for simpler usage.
=head2 JSON
L<JSON>.pm is old and full of slow logic. Use L<JSON::MaybeXS> instead, it is a
drop-in replacement in most cases.
=head2
iticrc> file like this:
[Community::PreferredAlternatives]
allowed_modules = Getopt::Std JSON
The same option is offered for L<Perl::Critic::Policy::Community::DiscouragedModules>.
=head1 A
---
our $HTTP_CLIENT_CLASS = 'WWW::Kickstarter::HttpClient::Lwp';
our $JSON_PARSER_CLASS = 'WWW::Kickstarter::JsonParser::JsonXs';
# ---
sub _load_class {
my ($class) = @_;
# This isn't e
lass = delete($opts{http_client_class}) || $HTTP_CLIENT_CLASS;
my $json_parser_class = delete($opts{json_parser_class}) || $JSON_PARSER_CLASS;
my $agent = delete($opts{agent});
my
_load_class($http_client_class)->new( agent => _expand_agent($agent) );
$self->{json_parser } = _load_class($json_parser_class)->new();
$self->{polite } = !$impolite;
$self->{wait_until