rts in serialized JSON, to emulate storing them in an
external server, which is better than just keeping the hashref around
would be.
=cut
use JSON::Tiny qw/ encode_json decode_json /;
=head1 PRO
tore {
my $self = shift;
my ($id, $content) = @_;
$self->id__report->{ $id } = encode_json( $content );
}
=head2 retrieve($id) : $content | undef
Retrieve the current report $content und
or undef if
none was found.
=cut
sub retrieve {
my $self = shift;
my ($id) = @_;
my $report_json = $self->id__report->{ $id } // return undef;
return decode_json( $report_json );
}
Time::Progress::Stored::Storage::Redis - Store the reports in Redis
=cut
use JSON::Tiny qw/ encode_json decode_json /;
=head1 PROPERTIES
=cut
has redis => (
is => "ro",
isa
ub store {
my $self = shift;
my ($id, $content) = @_;
$self->redis->set( $id , encode_json($content) );
}
=head2 retrieve($id) : $content | undef
Retrieve the current report $content und
key, or undef if
none was found.
=cut
sub retrieve {
my $self = shift;
my ($id) = @_;
my $report_json = $self->redis->get($id) // return undef;
return decode_json( $report_json );
}
package WWW::Jirafe;
use strict;
use 5.008_005;
our $VERSION = '0.01';
use LWP::UserAgent;
use JSON;
use Carp 'croak';
use URI::Escape qw/uri_escape/;
use HTTP::Request;
sub new {
my $class = s
n} or croak "access_token is required.";
$args{ua} ||= LWP::UserAgent->new();
$args{json} ||= JSON->new->allow_nonref->utf8;
$args{API_BASE} ||= 'https://event.jirafe.com/v2/';
bles
lf->{access_token});
$req->header('Accept', 'application/json'); # JSON is better
if ($params) {
$req->content($self->{json}->encode($params));
}
my $res = $self->{ua}->request
my $ua = LWP::UserAgent->new();
my $url = 'https://api.hipchat.com/v1/rooms/message?format=json&auth_token='.$self->config->{hipchat_token};
foreach my $to (@tos){
$ua->post($url, {
umn names as an array reference.
=head2 expand
$results = $results->expand;
Decode C<json> and C<jsonb> fields automatically for all rows.
=head2 hash
my $row = $results->hash;
Return ne
:Database::Manager;
use v5.20;
use strict;
use warnings;
our $VERSION = '0.03';
use JSON::RPC2::Client;
use JSON::XS;
use LWP::UserAgent;
use HTTP::Request;
use failures qw/odoo::rpc::http odoo::r
d_ua');
has json_rpc_client => (is => 'ro', lazy => 1, builder => 'build_json_rpc_client');
sub build_ua {
return LWP::UserAgent->new();
}
sub build_json_rpc_client {
return JSON::RPC2::Clie
ate_admin_pwd => $admin_password,
create_confirm_pwd => $admin_password,
)]);
# {"jsonrpc":"2.0","method":"call","params":{"fields":[{"name":"super_admin_pwd","value":"admin"},{"name":
p;
use JSON ();
sub now{
my $self = shift;
return int Time::HiRes::time() * 1000;
}
sub json_decode {
my $self = shift;
my $json = shift;
my $d;
eval{
$d = JSON->new->
>decode($json);
};
return $d;
}
sub json_encode {
my $self = shift;
my $d = shift;
my $json;
eval{
$json = JSON->new->utf8->encode($d);
};
return $json;
}
su
;
}
my $reply;
my $data = {};
eval{
$data = $client->json_decode($res->content);
};
if($@){
print $@,"\n" if $client->{debug};
= shift;
print $response->content(),"\n" if $self->{debug};
my $d = $self->json_decode($response->content());
#return if $d->{BaseResponse}{Ret}!=0;
$self->_pars
t(
$url,
("Content-Type"=>"application/json; charset=UTF-8"),
Content=>$self->json_encode($post),
$callback
);
});
}
1;
sub _parse_send_status_data {
my $self = shift;
my $json = shift;
if(defined $json){
my $d = $self->json_decode($json);
return {is_success => 0,status=>"数据格式错
e 5.008001;
use strict;
use warnings;
our $VERSION = "0.01";
use JSON::PP;
use DBI qw/:sql_types/;
use File::Spec;
my $_JSON = JSON::PP->new;
my %_NAMEMAP = map { $_ => *{$DBI::{$_}}{CODE}->() } @{
= File::Spec->catfile($outdir, "$table->{name}.json");
open my $fh, '>', $file or die "$file: $!"; # uncoverable branch
print {$fh} $_JSON->encode($table->{schema});
close $fh;
This module will produce text output of the schema suitable for Google BigQuery.
It will be a '.json' file of BigQuery schema format.
=head1 ARGUMENTS
=over 4
=item C<outdir>
Base directory of o
nt;
use strict;
use Config::IniFiles;
use File::HomeDir;
use File::Spec;
use HTTP::Request;
use JSON;
use LWP::UserAgent;
use Sys::Hostname;
our $VERSION = 0.07;
use constant {
SUCCESS =
include
an "inhibit" hash key.
=cut
sub start {
my $self = shift;
return $self->_write_json($self->_get_url('start'), {
command => $self->{'command'}}, 1);
}
=item finish()
Report
on success.
=cut
sub finish {
my $self = shift;
my %opt = @_;
return $self->_write_json($self->_get_url('finish'), {
command => $self->{'command'},
status => defined $o
idator::VERSION = '0.24';
use HTML::FormHandler::Moose::Role;
use Method::Signatures::Simple;
use JSON ();
has_field _validation_scripts => (type => 'JavaScript', set_js_code => '_js_code_for_valida
n_types => (is => 'rw', isa => 'ArrayRef', default => sub { [ qw(Submit Hidden noCAPTCHA Display JSON JavaScript) ] });
has skip_all_remote_validation => (is => 'rw', isa => 'Bool', default => 0);
>skip_all_remote_validation;
my $spec_data = $self->_data_for_validation_spec;
my $spec = JSON->new->utf8
->allow_nonref
->pretty(1)
t;
use Moo;
use MooX::late;
use MooX::ChainedAttributes;
use HTTP::Thin;
use JSON::Any;
use Try::Tiny;
use Scalar::Util qw/weaken/;
use Carp qw(confess);
use cons
s_json {
my $self = shift;
my $request = $self->request;
$request->header(
'Accept' => 'application/json',
'Content-Type' => 'application/json',
);
if ( my $data = shift ) {
$request->content( JSON::Any->encode($data) );
}
weaken($self);
$self->decoder(
sub {
my
N::Converter;
use 5.006;
use strict;
use warnings;
use Encode;
use Spreadsheet::ParseExcel;
use JSON::XS;
use IO::All -utf8;
use Carp;
=head1 NAME
HON::I18N::Converter - perl I18N Converter
=head
ncodage
my $encoder = JSON::XS->new->ascii->pretty->allow_nonref;
#Parcours d'une table de hachage
foreach my $lang ( keys %{ $self->labels } ) {
my $json = $encoder->encode( { str
self->labels->{$lang} } );
#Intitule de chaque section
$content .= "\$.i18n.$lang = $json;\n";
}
#Derniere ligne du document jQuery
$content .= '})(jQuery);';
$content >
'bar' # config files prefix
extensions => [ # file extensions to search
qw(json yml perl)
]
}
);
# Mojolicious::Lite
plugin 'ConfigAny';
=head1 DESCRIPTION
L<
json = $self->http_post(Weixin::Util::gen_url($api,@query_string),@headers,("Content-Type"=>"application/json; charset=UTF-8"),Content=>$self->json_encode($post));
my $d = $self->json_decode($json
my $json = $self->http_post(gen_url($api,@query_string),("Content-Type"=>"application/json; charset=UTF-8"),Content=>"{}");
return unless defined $json;
my $d = $self->json_decode($json);
warnings;
use lib lib => glob 'modules/*/lib';
use LWP::Simple qw($ua);
use HTML::Microdata;
use JSON;
my $uri = shift;
my $res = $ua->get($uri);
unless ($res->is_success) {
warn $res->status_line
;
exit 1;
}
my $microdata = HTML::Microdata->extract($res->decoded_content, base => $uri);
print JSON->new->pretty->encode($microdata->items);
$json = $self->http_post(gen_url($api,@query_string),("Content-Type"=>"application/json; charset=UTF-8"),Content=>$self->json_encode($post));
return unless defined $json;
my $d = $self->json_
decode($json);
return unless defined $d;
return if $d->{BaseResponse}{Ret}!=0;
return if $d->{Count}==0;
my %member_info;
my @member_key = qw(HeadImgUrl NickName PYInitial PYQuanP