me::HiRes qw/gettimeofday tv_interval/;
use HTTP::Request;
use JSON 2;
use constant DEBUG => $ENV{WWW_CONNPASS_DEBUG};
my $_JSON = JSON->new->utf8;
sub new {
my ($class, %args) = @_;
my $in
$url, $param) = @_;
my $content = $_JSON->encode($param);
my $req = HTTP::Request->new($method, $url, [
'Content-Type' => 'application/json',
'Content-Length' => length
$content,
'Accept' => 'application/json,text/javascript',
'Accept-Language' => 'en-US',
'Origin' => 'https://connpass.com',
'X-CSRFToken' => $
_error("Must start build with job name!\n") if !$job;
my $result = $jenkins->_json_api(['job', $job, 'api', 'json']);
if ( ! $result->{buildable} ) {
warn "Job is not buildable!\n";
}
$jenkins->trigger_build($job);
sleep 1;
$result = $jenkins->_json_api(['job', $job, 'api', 'json']);
print "View at $result->{url}\n";
print $result->{queueItem}{why}, "\
("Job name required to show job status!\n") if !$job;
my $result = $jenkins->_json_api(['job', $job, 'api', 'json'], { extra_params => { depth => 1 } });
my $color = $self->colour_map->{$res
ORT = qw(trim);
our @EXPORT_OK = qw(char_shift find_modules load_class params decode_json);
our %EXPORT_TAGS = (all => [@EXPORT, @EXPORT_OK]);
our $CHAR_SHIFT = ord('A') - 10;
sub tr
json($) {
my $json = shift;
# JSON must be blob
$json = encode utf8 => $json if is_utf8 $json;
return eval{ Mojo::JSON::decode_json( $json ) }
if Mojo::JSON->can('decode_json
');
return @{ Mojo::JSON->new->decode( $json ) }
if Mojo::JSON->can('new');
};
1;
rical type: '$type'";
}
return $class->SUPER::new(value => $value, type => $type);
}
sub TO_JSON { 0 + shift->value }
sub to_string { '' . shift->value }
sub isa_number {
my $value = shift;
e given type. The 3 supported types are C<DOUBLE>,
C<INT32> and C<INT64>.
=head2 TO_JSON
my $num = $obj->TO_JSON;
Return the numerical value.
=head2 to_string
my $str = $num->to_string;
Retu
trict;
use Mojolicious::Plugin::Vparam::Common qw(load_class decode_json);
use Mojolicious::Plugin::Vparam::Numbers;
use Mojo::JSON;
use Digest::MD5 qw(md5_hex);
use Encode
# JSON format
my $json = decode_json $str;
if( $json and 'ARRAY' eq ref($json)) {
$full = sprintf '%s : %s , %s',
$json->[2]//'', $json->
[3]//'', $json->[4]//'';
$address = $json->[2];
$lon =
Mojolicious::Plugin::Vparam::Numbers::parse_number $json->[3];
$lat =
use Time::HiRes 'time';
sub new { shift->SUPER::new(time => shift // int(time * 1000)) }
sub TO_JSON { 0 + shift->{time} }
sub to_datetime { Mojo::Date->new->epoch(shift->to_epoch)->to_datetime }
N::Time->new(time * 1000);
Construct a new L<Mango::BSON::Time> object.
=head2 TO_JSON
my $num = $time->TO_JSON;
Numeric representation of time.
=head2 to_datetime
my $str = $time->to_dateti
: string,
# author: string,
# permlink: string,
# title: string,
# body: string,
# json_metadata: string
#}
#);
sub serialize_comment {
my( $self, $operation_name, $operation_parame
", $operation_id;
for my $field ( qw(parent_author parent_permlink author permlink title body json_metadata) ){
confess "$field missing in parameters".Dumper($operation_parameters) unless
e
account_witness_proxy
pow
custom
report_over_production
delete_comment
custom_json
comment_options
set_withdraw_vesting_route
limit_order_create2
challenge_authority
ETHODS
=cut
use Modern::Perl;
use Mojo::Base -base;
use Mojo::UserAgent;
use Mojo::JSON qw(decode_json encode_json);
use Data::Dumper;
has url => 'https://api.steemit.com/';
has ua
my( $self, $api, $method, @params ) = @_;
my $response = $self->ua->post( $self->url, json => {
jsonrpc => '2.0',
method => 'call',
params => [$api,$method,[@params]],
id
requesting steemd ". $response->to_string unless $response->is_success;
my $result = decode_json $response->body;
return $result->{result} if $result->{result};
if( my $error = $result->{
artition_by/;
use List::MoreUtils qw/uniq/;
use Moo;
use Memoize;
use Log::Any qw//;
use DBI;
use JSON;
our $VERSION = '0.06';
has 'input_alphabet' => (
is => 'ro',
required => 1,
isa
default => sub {
Log::Any->get_logger()
},
);
has '_json' => (
is => 'rw',
required => 0,
default => sub {
JSON->new->canonical(1)->indent(0)->ascii(1)
},
);
sub BUILD {
->(@_);
});
$self->_dbh->sqlite_create_function( '_canonical', 1, sub {
# Since SQLite's json_group_array does not guarantee ordering,
# we sort the items in the list ourselves here.
package Moo::Role::ToJSON;
use Types::Standard 'ArrayRef';
use Moo::Role;
# ABSTRACT: a Moo role for a TO_JSON method
our $VERSION = '0.02';
has serializable_attributes => (
is => 'lazy',
isa => ArrayRef,
);
sub _build_serializable_attributes { [] }
sub TO_JSON {
my $self = shift;
my @attributes_to_serialize
= $self->can('is_attribute_serializable')
? grep {
coding utf8
=head1 NAME
Moo::Role::ToJSON - a Moo role for a TO_JSON method
=head1 SYNOPSIS
package My::Message;
use Moo;
with 'Moo::Role::ToJSON';
has feel_like_sharing => (is =>
e';
# ABSTRACT: benchmark is_attribute_serializable
BEGIN {
package ToJSON::A;
use Moo;
with 'Moo::Role::ToJSON';
has bar => (is => 'ro', default => 'bar');
has foo => (is => 'r
/bar foo/] }
sub is_attribute_serializable { return 1 }
package ToJSON::B;
use Moo;
with 'Moo::Role::ToJSON';
has bar => (is => 'ro', default => 'bar');
has foo => (is => 'r
000_000,
{
'::ToJSON with is_attribute_serializable' => sub { ToJSON::A->new->TO_JSON() },
'::ToJSON wout is_attribute_serializable' => sub { ToJSON::B->new->TO_JSON() },
}
);
n;
use App::Environ::Config;
use Carp qw( carp croak );
use Cpanel::JSON::XS;
use IO::Socket;
my $INSTANCE;
my $JSON = Cpanel::JSON::XS->new->utf8;
App::Environ::Config->register(qw(clickhouse_prox
uery,
data => \@_,
types => \@types,
version => 1,
);
$self->{sock}->send( $JSON->encode( \%val ) ) or carp("Send error: $!");
return;
}
1;
__END__
=head1 NAME
App::Enviro
;
use warnings;
use parent 'LWP::UserAgent::Caching';
use CHI;
use JSON;
use parent 'Exporter';
our @EXPORT_OK = qw(get_from_json);
=head1 SYNOPSIS
use LWP::UserAgent::Caching::Simple;
for quick one timers
use LWP::UserAgent::Caching::Simple qw(get_from_json);
my $hashref = get_from_json (
'http://example.com/cached?',
'Cache-Control' => 'max-stale
s $ua;
return $ua
}
}
sub get_from_json {
my $resp = _default_useragent()->get(@_, Accept => 'application/json');
return decode_json($resp->decoded_content()) if $resp->is_success
reObject = (
email => $email,
mayAdmin => $JSON::false,
mayWrite => $JSON::false,
mayRead => $JSON::false,
);
foreach my $item (@{$Acl->{"{$NS_D
t{'mayAdmin'} = $JSON::true if $item->{"{$NS_CY}admin"};
$ShareObject{'mayWrite'} = $JSON::true if $item->{"{$NS_D}write-content"};
$ShareObject{'mayRead'} = $JSON::true if $item->
write-content"} } @{$Perms || []}) ? $JSON::false : $JSON::true,
mayRead => (grep { exists $_->{"{$NS_D}read"} } @{$Perms || []}) ? $JSON::true : $JSON::false,
mayWrite => (grep {
HTTPS;
use Digest::SHA qw(hmac_sha256_hex);
use HTTP::Tiny;
use URI::Escape;
use XML::Simple;
use JSON;
use vars qw(@ISA $me $VERSION);
use Log::Scrubber qw(disable $SCRUBBER scrubber :Carp scrubber_a
{'last_name'}//'');
}
$content{'version'} //= $self->api_version;
$content{'type'} = 'json';
return %content;
}
sub submit {
my $self = shift;
my %content = $self->content()
'Content-Type' => 'application/x-www-form-urlencoded',
'Accept' => 'application/json',
},
content => $post_data,
} );
}
$self->server_response
elf->_normalize_action($record);
} ## end sub normalize_record
sub parse_request { return $_[1]->json }
# paranoid: ensure we return a "200" with some response
around process => sub {
my ($orig,
qw($VERSION);
our $VERSION = '0.17';
use Carp ('croak');
use Encode ();
use JSON::XS ();
use LWP::UserAgent ();
use URI ();
use URI::QueryParam ();
sub new {
my
if ($resp->is_success) {
my $content = $resp->decoded_content(charset => "none");
my $res = JSON::XS->new->utf8->decode($content);
if ($raw) {
return $res;
}
if ($re
my $url = URI->new(($self->{use_https} ? 'https' : 'http') . '://maps.google.com/maps/api/geocode/json');
my %url_params;
$url_params{address} = $loc;
$url_params{sensor} = $self->{sens
tribution provides a
collection of roles that help you populate the distribution's metadata
(META.json, Changes, etc) from DOAP.
=head2 The Straight DOAP
So what is DOAP? This explanation is lifted
head1 VERSION
version 0.001004
=head1 SYNOPSIS
package MyApp::People;
use Web::Simple;
use JSON::MaybeXS;
use Web::Util::ExtPaging;
use Web::Util::DBIC::Paging;
sub dispatch_request {
my
rs();
sub (/people) {
[
200,
[ 'Content-type', 'application/json' ],
[
encode_json(
ext_paginate(
search(
page_and_sor
ervice => 'cp');
},
);
has 'json' =>
(
is => 'ro',
isa => 'JSON::XS',
lazy => 1,
default => sub
{
require JSON::XS;
return JSON::XS->new->utf8;
}
);
# Auth
ts=9999&alt=json";
$url .= "&v=3.0"; # Gives more fields
$self->get($url, $self->authsub->auth_params)
or return;
my $content = $self->ua->content;
my $data = $self->json->decode($co
{
$_ = eval { $self->get("$url?alt=json", $self->authsub->auth_params) };
$self->errstr(undef);
if ($_)
{
$_ = $self->ua->content;
$_ = $self->json->decode($_);
$_ = $_->{entry}{cont