ort translations from rails i18n project
use strict;
use warnings;
use utf8;
use YAML::Syck;
use JSON::PP;
use File::Find;
use FindBin;
use Cwd;
sub convert_one_locale {
my ($code, $input_file,
);
for my $k (keys %lexicon) {
$lexicon{$k} =~ s/%\{count\}/%1/g;
}
my $j = JSON::PP->new;
open(my $fh, ">", $output_file) or die "$output_file: $!";
print $fh $j->encode
{
/([^\/]+)\.yml/ or return;
my $code = $1;
my $output_file = "$out_i18n_dir/$code.json";
eval {
convert_one_locale($code, $File::Find::name, $output_file);
1;
'write-info-json!' => undef,
'write-playlist-metafiles!' => undef,
'clean-infojson!' => undef,
'write-comments|get-comments!' => undef,
'load-info-json=s' => {comple
ip-download|no-download' => undef,
'print|O=s' => undef,
'dump-json|j' => undef,
'dump-single-json|J' => undef,
'force-write-archive|force-download-archive' => undef,
anything; # -cccc
$outstyle = 'json' if $benchmarkanything and $outstyle !~ /^(json|yaml|yamlish)$/;
$outstyle = 'json' if $benchmarkanything_report;
# fill
return YAML::Dump($RESULTS);
}
sub print_outstyle_json
{
my ($self, $RESULTS) = @_;
require JSON;
return JSON->new->allow_nonref->pretty->encode( $RESULTS );
}
sub pr
>{options}{outstyle};
$outstyle = "summary" unless $outstyle =~ qr/^(summary|yaml|yamlish|json)$/;
my $sub = "print_outstyle_$outstyle";
my $output = $self->$sub($RESULTS);
feature name">.
=head2 feature set name
A string following regular Perl namespace name, e.g. C<JSON::Encoder> or
C<TextTable>.
=head2 feature set specification
A collection of L</"feature name">s
:std :utf8);
use Carp qw/croak carp/;
use URI::Escape;
use File::Basename;
use HTTP::Request;
use JSON::XS;
use Encode;
use IO::Socket::SSL;
use base qw/Mailru::Cloud::Auth/;
our $VERSION = '0.10';
$code = $res->code;
if ($code eq '200') {
my $json = JSON::XS::decode_json($res->content);
my $new_fname = $json->{body};
return $new_fname;
}
croak "Cant upl
$res->code;
if ($res->is_success) {
my $json_parsed = decode_json($res->content);
my @list_files;
for my $item (@{$json_parsed->{body}->{list}}) {
my $h = {
teTime->dmy . ' ' .
DateTime->hms). This is to make it easy to pass the data structure into YAML,
JSON, MySQL, etc. Nevertheless, internally DateTime objects are still used.
=back
Additional notes:
mage::LibRSVG;
use File::Temp qw/tempfile/;
use Encode;
use Text::Unidecode;
use URI::Escape;
use JSON::XS;
use utf8;
use open OUT => ':utf8';
use constant {
RELATION_TYPE_FB3_BOOK =>
'http://w
ned") unless defined $OPT{'fb2'};
$OPT{'genremap'} //= dist_file("FB3-Convert", "fb3_to_fb2_genre.json");
#CHECK --fb2,--fb3
my $FileName = $OPT{'fb3'};
$FileName =~ s/.*?([^\/]+)$/$1/;
$FileName =~
$fh>;
};
my $GenreMap = eval {JSON::XS->new->utf8->decode($GenreMapString)};
if ($@) {
die "Seems like genres map file '$GenreMapPath' contains invalid JSON. Error occured '$@'";
}
die "
{
"DEBUG": '[INDEX:' + currIndex + ']' + currNode.outerHTML + '[DUMP:' + JSON.stringify(Calc) + ']',
"BALLS": Calc['BALLS'],
"CHANGED": Changed
e OPC::Node;
use FB3;
use utf8;
use Encode;
use open qw(:std :utf8);
use Image::Info;
use JSON::Path;
use JSON::PP;
use File::Copy;
use File::Basename;
use MIME::Base64;
use TeX::Hyphen;
use Getopt::
nary = undef;
my $Hyp = undef;
GetOptions ('in|from|src|fb3=s' => \$FB3,
'out|to|dst|json=s' => \$Out,
'lang=s' => \$Lang,
'art|art-id=s' => \$ArtI
unless $FB3;
print join('', <DATA>) and die "ERROR: destination directory not specified, use --json parameter\n" unless $Out;
die "\nERROR: source directory `$FB3' not found\n" unless -d $FB3
rict;
use warnings;
use utf8;
use open qw(:std :utf8);
use LWP::UserAgent;
use HTTP::Request;
use JSON::XS;
use URI::Escape;
use Carp qw/carp croak/;
our $VERSION = '0.10';
sub new {
my ($cla
login form: " . $res->code;
}
my $json = decode_json($res->decoded_content);
if ($json->{status} eq 'fail') {
croak "Fail login: $json->{code}";
}
$self->__getToken() or
{
croak "Can't get status about login";
}
my $json_res = decode_json($res->content);
$json_res->{status} eq 'ok' and return 1;
$self->login() and return 1;
n still run without a module (e.g. an
optional prereq):
% perl -Mlib::filter=disallow,'YAML::XS;JSON::XS' yourscript.pl
# idem, but the list of disallowed modules are retrieved from a file
% perl
de> is another module which you can you for exactly this purpose:
% perl -MDevel::Hide=YAML::XS,JSON::XS yourscript.pl
To no-op instead of disallowing, see L<lib::noop>.
=item * Do custom filterin
$mm->addFileExts( '\.js$', 'application/javascript' );
$mm->addFileExts( '\.json$', 'application/json' );
$mm->addFileExts( '\.gif$', 'image/gif' );
$mm->addFileExts( '\.
nds qw(JMAP::Tester);
has +json_codec => (
is => 'bare',
handles => {
json_encode => 'encode',
json_decode => 'decode',
},
default => sub {
require JSON;
# Not ->utf8-> or we
# Maybe to be fixed in Protocol::WebSocket? Or IO::Async is doing this
# for us?
return JSON->new->convert_blessed;
},
);
has 'ws_api_uri' => (
is => 'rw',
required => 1,
);
est->{'@type'} = 'Request';
my $json = $self->json_encode($request);
my $client = $self->_cached_client || $self->connect_ws;
$client->send_text_frame($json);
my $res = $self->loop->run;
ak';
use Digest::SHA 'sha256_base64';
use List::Util 'any';
use Mojo::IOLoop;
use Mojo::JSON qw(from_json to_json);
use Mojo::Redis;
use Mojo::Util 'encode';
use Sort::Versions 'versioncmp';
use Sys::
lf, $command, $args, $ids ) =
( shift, shift, shift || [], shift || [] );
my $item = to_json( [ $command, @$args ] );
my %worker_ids =
map { ( $_ => 1 ) } @{ $self->redis->db->smem
redis->db->incr('minion.last_job_id');
my %notes = %{ $options->{notes} || {} };
$_ = to_json($_) for values %notes;
my $parents = $options->{parents} || [];
my $queue = $options-
se Net::Google::DataAPI::Auth::OAuth2;
use Net::OAuth2::AccessToken;
use Text::CSV;
use Furl;
use JSON;
use Sub::Retry;
sub new {
state $rule = Data::Validator->new(
client_id => { i
my $headers = [];
if ($content) {
push @$headers, 'Content-Type' => 'application/json';
}
if ($opt->{headers}) {
push @$headers, @{ $opt->{headers} };
}
my $r
url => $url,
headers => $headers,
$content ? (content => encode_json($content)) : (),
);
}, sub {
my $res = shift;
if (!$res) {
21',library=>'rug01');
if($illgetdoc->is_success){
if($illgetdoc->record){
say "data: ".to_json($illgetdoc->record,{ pretty => 1 });
}
else{
say "nothing found";
}
}else{
say STDER
lling you, dude.
## Fry: Santa Claus is gunning you down!"
use Mojo::IOLoop;
use Mojo::JSON 'j';
use Mojo::JSON::Pointer;
use Mojo::Server;
use Mojo::UserAgent;
use Mojo::Util qw(decode encode monkey
sub json_has {
my ($self, $p, $desc) = @_;
my $ctx = context;
$desc = _desc($desc, qq{has value for JSON Pointer "$p"});
my $out
= ok(!!Mojo::JSON::Pointer->new($self->tx->res->json)->co
sub json_hasnt {
my ($self, $p, $desc) = @_;
my $ctx = context;
$desc = _desc($desc, qq{has no value for JSON Pointer "$p"});
my $out
= ok(!Mojo::JSON::Pointer->new($self->tx->res->json)->
$body = Encode::encode( $charset, $body );
} elsif ( $self->ContentType =~ /text|javascript|json/ ) {
$body = Encode::encode( 'UTF-8', $body );
}
if ( $self->_content_writer ) {
(Makefile Makefile.old MANIFEST MYMETA.json MYMETA.yml);
unlink 'Makefile' and $self->_make('clean') if -e 'Makefile';
push @files, qw(Changes.bak META.json META.yml) if $all;
push @files, $se
clean
Used to clean out build files:
Makefile, Makefile.old, MANIFEST, MYMETA.json, MYMETA.yml, Changes.bak, META.json
and META.yml.
=head2 ship
$ git ship
Used to ship a Perl distribution by r
dumper {
state $default = do {
require JSON::MaybeXS;
state $json = JSON::MaybeXS->new->utf8->convert_blessed->pretty->canonical;
sub { $json->encode($_[0]); }
};
return $default;
}