';
our @EXPORT_OK = qw/copy make_executable manify tap_harness install dump_binary dump_text dump_json/;
use Carp qw/croak/;
use ExtUtils::Helpers 0.028 qw/make_executable man1_pagename man3_pagename
$target, $content, $options{encoding} // 'utf-8'),
]
);
});
$planner->add_delegate('dump_json', sub {
my ($planner, $target, $content, %options) = @_;
$planner->create_node(
target
=> $target,
dependencies => $options{dependencies},
actions => [
new_action('dump_json', $target, $content),
]
);
});
$planner->add_delegate('script_dir', sub {
my ($planner,
esolver::MetaCPAN;
use strict;
use warnings;
use App::cpm::DistNotation;
use App::cpm::HTTP;
use JSON::PP ();
sub new {
my ($class, %option) = @_;
my $uri = $option{uri} || "https://fastapi.
f $res->{status} == 599;
return { error => $error };
}
my $hash = eval { JSON::PP::decode_json($res->{content}) } or return;
my $dist = App::cpm::DistNotation->new_from_uri($hash-
ry {
my $ua = LWP::UserAgent->new;
$ua->default_header('Accept' => 'application/json');
# Path to the VERSION file
my $version_file_path = 'VERSION';
#
use File::ShareDir::Tiny 'module_dir';
use Parse::CPAN::Meta;
my $json_backend = Parse::CPAN::Meta->json_backend;
my $json = $json_backend->new->canonical->pretty->utf8;
sub add_methods {
my ($sel
dules) {
my $module_dir = module_dir($module);
my $config = catfile($module_dir, 'compile.json');
my $include = catdir($module_dir, 'include');
croak "No such import $module" if not -d
die "Could not open $config: $!";
my $content = do { local $/; <$fh> };
my $payload = $json->decode($content);
for my $key (qw/include_dirs library_dirs libraries extra_compiler_flags
e::Spec::Functions qw/abs2rel catfile/;
use Parse::CPAN::Meta;
my $json_backend = Parse::CPAN::Meta->json_backend;
my $json = $json_backend->new->canonical->pretty->utf8;
my @allowed_flags = qw/incl
ib auto share module/, $module_dir, 'compile.json');
my $inner = $planner->new_scope;
$inner->load_extension('Dist::Build::Core');
$inner->dump_json($filename, \%flags);
return $planner->cre
package SPVM::Builder::Info;
use strict;
use warnings;
use Carp 'confess';
use JSON::PP;
use File::Basename 'basename';
use SPVM::Builder;
use SPVM::Builder::CC;
use SPVM::Builder::Util;
use SPVM::B
quired_resources;
}
sub get_required_resource_json_lines {
my ($self) = @_;
my $required_resources = $self->get_required_resources;
my @json_lines;
for my $required_resource (@$required
} = $resource_argv;
}
my $json_line = JSON::PP->new->utf8->canonical(1)->encode($line);
push @json_lines, $json_line;
}
return \@json_lines;
}
sub compile {
my ($self)
to write a custom formatter, in our
case a JSONL formatter.
=head1 DESCRIPTION
This tutorial explains a minimal formatter that outputs each event as a json
string on its own line. A true formatter w
package Test2::Formatter::MyFormatter;
use strict;
use warnings;
use JSON::MaybeXS qw/encode_json/;
use base qw/Test2::Formatter/;
sub new { bless {}, shift }
sub encod
ite {
my ($self, $e, $num, $f) = @_;
$f ||= $e->facet_data;
print encode_json($f), "\n";
}
1;
=head1 LINE BY LINE
=over 4
=item use base qw/Test2::Formatter/;
All
package SPVM::Builder::Config::Info;
use strict;
use warnings;
use Carp 'confess';
use JSON::PP;
use File::Basename 'basename';
use SPVM::Builder;
use SPVM::Builder::CC;
use SPVM::Builder::Util;
#
package App::Greple::xlate::Cache;
use v5.14;
use warnings;
use Data::Dumper;
use JSON;
use List::Util qw(pairmap mesh);
use Hash::Util qw(lock_keys);
sub TIEHASH {
my $self = shift;
my $ob
ne $b) {
$obj->current->{$a} = $b;
$obj->updated++;
}
}
} @_;
$obj;
}
sub json {
JSON->new->utf8->canonical->pretty;
}
sub open {
my $obj = shift;
my $file = $obj->name
my $json_obj //= &json;
if (CORE::open my $fh, $file) {
my $data = do { local $/; <$fh> };
my $json = $data eq '' ? {} : $json_obj->decode($data);
$obj->{saved} = do {
if (ref $json eq
t-4.1', temp => '0.0', max => 3000, sub => \&gpty,
prompt => <<END
Translate the following JSON array into %s.
For each input array element, output only the corresponding translated element at
pond to input element n.
Output only the translated elements or unchanged tags/blank strings as a JSON array.
Do not leave any unnecessary spaces or tabs at the end of any array element in your output
ult as a JSON array and nothing else.
Your entire output must be valid JSON.
Do not include any explanations, code blocks, or text outside of the JSON array.
If you cannot produce a valid JSON array,
als => { username => 'bob', password => 's3cr3t' },
headers => { 'Accept' => 'application/json' },
url => 'http://example.net/api/v1/stuff',
method => 'GET',
} );
It's
t resort, you can manually install it. Download the tarball and
unpack it.
Consult the file META.json for a list of pre-requisites. Install these
first.
To build Type-Tiny:
% perl Makefile.PL
%
verload
fallbacks may actually be useless as a practical boolean. But some common
objects such as JSON::PP's booleans overload "0+" instead of overloading
"bool" (thankfully with fallbacks enabled!) s
on of this type is to be a version of B<Bool> which also
accepts common boolean objects such as L<JSON::PP::Boolean>. It is currently
unstable and the exact definition of the type may change to better
on\/ld\+json\"\>\s*\{([^\}]+)#s) {
my $jsonstuff = $1;
my $streams = '';
$self->{'title'} = $1 if ($jsonstuff =~ m#\"name\"\:\s*\"([^\"]+)#s);
#x $self->{'description'} = $1 if ($jsonstuff =~
if ($jsonstuff =~ m#\"thumbnailUrl\"\:\s*\"([^\"]+)#s);
($self->{'imageurl'} = $self->{'iconurl'}) =~ s#^.+?(https?\:\/.+)$#$1#i
if ($self->{'iconurl'});
$self->{'year'} = $1 if ($jsonstuff
the type of the incoming value.
Example blatantly stolen from the Moose documentation:
sub to_json
{
my $value = shift;
return match_on_type $value => (
HashRef() =>
to_json( $hash->{$_} ) }
sort keys %$hash
) . ' }';
},
ArrayRef() => sub {
my $array = shift;
'[ '.( join ", " => map { to_json($_
q { '"' . $_ . '"' },
Undef() => q {'null'},
=> sub { die "$_ is not acceptable json type" },
);
}
Note that unlike Moose, code can be specified as a string instead of a
co
am;
$self->{'cnt'}++;
}
}
} else { #EXTRACT PODCAST PAGE DATA FROM EMBEDDED, ENCODED JSON:
$html = HTML::Entities::decode_entities($html);
$html = uri_unescape($html);
$html =~ s#\\
#/o);
($atr, $val) = split(/\s*\=\>\s*/o, $_, 2);
eval "\$self->{'$atr'} = $val"; #CATCH JSON-LIKE ARGS, IE. "arg => {key => value, ...}"
eval "\$self->{'$atr'} = \"\Q$val\E\"" if ($@);
use File::Path qw(mkpath rmtree);
use File::Spec;
use File::Temp ();
use File::pushd 'pushd';
use JSON::PP ();
use Parse::LocalDistribution;
use Time::HiRes ();
use constant NEED_INJECT_TOOLCHAIN_REQ
$meta = $self->_load_metafile($distfile, 'META.json', 'META.yml');
if (!$meta) {
$self->{logger}->log("Distribution does not have META.json nor META.yml");
return;
}
my $p
dir;
my $meta = $self->_load_metafile($uri, 'META.json', 'META.yml');
my $mymeta = $self->_load_metafile($uri, 'blib/meta/MYMETA.json');
my $phase = $self->{notest} ? [qw(build runtime
FAILED, INVALID STATION URL, PUNT!
my $json = '';
$json = $1 if ($html =~ s#\btype\=\"application\/json\"\>\{(.+)##s);
if ($json) {
print STDERR "..JSON data found, fetching data we can here fi
;
my $podcastdata = ($json =~ s#^(.+?)\"episodes\"\:##s) ? $1 : '';
while ($json =~ s#^.+?\"title\"\:\"([^\"]+)\"##so) {
my $epititle = $1;
my $epistream = ($json =~ m#\"file\_url\"\:\"(
($epititle && $epistream);
next if ($self->{'secure'} && $epistream !~ /^https/o);
if ($json =~ m#\"url\"\:\"([^\"]+)\"#so) {
$have1stepisode ||= $1;
$epistream =~ s/\.(mp3|m3u8|pl
) {
$maskobj->mask($s);
}
$s;
}
sub cache_file {
my $file = sprintf("%s.xlate-%s-%s.json",
$current_file, $xlate_engine, $lang_to);
if ($cache_method eq 'auto') {
-f $file