s::Accessor/;
use Data::Recursive::Encode;
use DateTime::Format::ISO8601;
use Hash::AsObject;
use JSON;
use LWP::UserAgent;
use URI;
# Accessors
__PACKAGE__->mk_accessors( qw/ iter / );
# Constructo
ess($response->is_success){
die 'Fetch error: '.$response->status_line;
}
# Decode JSON
my $js_hash = JSON->new->utf8->decode($response->content);
# Encoding
if(defined($self->{encoding})){
s::Accessor/;
use Data::Recursive::Encode;
use DateTime::Format::ISO8601;
use Hash::AsObject;
use JSON;
use LWP::UserAgent;
use URI;
# Accessors
__PACKAGE__->mk_accessors( qw/ iter / );
# Constructo
ess($response->is_success){
die 'Fetch error: '.$response->status_line;
}
# Decode JSON
my $js_hash = JSON->new->utf8->decode($response->content);
# Encoding
if(defined($self->{encoding})){
ar @$running_tasks > 0) {
$self->render(json => { message => (scalar @$running_tasks) . " Tasks Running" });
}
else {
$self->render(json => { message => "All Quiet"} );
}
}
1;
I's Mercado Pago driver
use Moo;
use Carp;
use URI;
use Data::Dumper;
use LWP::UserAgent ();
use JSON;
extends 'Business::CPI::Gateway::Base';
our $VERSION = '0.102'; # VERSION
has '+currency' =>
);
$ua->default_header( 'Accept' => 'application/json' );
$ua->default_header( 'Content-Type' => 'application/json' );
return $ua;
},
);
has access_token => (
'$auth_url': " . $r->status_line
if $r->is_error;
my $json = from_json( $r->content );
my $access_token = $json->{access_token};
die "Coundn't retried access_token" unless
ead1 SYNOPSIS
use DBI;
use JSON::Any;
use LWP::Simple;
# Example JSON object
my $json = get 'http://maps.googleapis.com/maps/api/geocode/json?address=1600+Pennsylvania+Ave+NW,+2
0500®ion=us&language=en&sensor=false';
my $obj = JSON::Any->jsonToObj($json);
my $dbh = DBI->connect('dbi:TreeData:', '', '', {
tree_table_name => 'geocode',
tree_data
ng. (Any caveats with those modules likely applies here.)
This module can be handy to translate JSON, XML, YAML, and many other tree formats to be used in class sets like L<DBIx::Class>. Unlike
L<D
ead1 SYNOPSIS
use DBI;
use JSON::Any;
use LWP::Simple;
# Example JSON object
my $json = get 'http://maps.googleapis.com/maps/api/geocode/json?address=1600+Pennsylvania+Ave+NW,+2
0500®ion=us&language=en&sensor=false';
my $obj = JSON::Any->jsonToObj($json);
my $dbh = DBI->connect('dbi:TreeData:', '', '', {
tree_table_name => 'geocode',
tree_data
ng. (Any caveats with those modules likely applies here.)
This module can be handy to translate JSON, XML, YAML, and many other tree formats to be used in class sets like L<DBIx::Class>. Unlike
L<D
ha1);
use MIME::Base64;
use LWP::UserAgent;
use Encode;
use XML::Twig;
use URI::Encode;
use JSON;
use Carp;
use Data::Dumper;
subtype 'CloudStack::YN'
=> as 'Str'
=> where { $_ =~
st' => (
is => 'rw',
isa => 'CloudStack::YN',
default => 'no',
);
has 'xml_json' => (
is => 'rw',
isa => 'Str',
default => 'xml',
);
has 'url' => (
i
f->secret_key."\n";
print "SEND_REQUEST:".$self->send_request."\n";
print "XML_JSON:".$self->xml_json."\n";
}
### SUB ROUTINE ###
### COMMAND ###
sub proc{
my ($self, $cmd, $o
SYNOPSIS
package MyContainer;
use parent 'Micro::Container';
__PACKAGE__->register(
JSON => [],
);
package MyContainer::Child;
use parent 'MyContainer';
__PACKAGE__->register(
yContainer::Child;
my $container = MyContainer::Child->instance;
say $container->get('JSON')->encode_json({ foo => 'bar' });
my $data = $container->get('MessagePack')->decode($message_pack_stri
ter(
'LWP::UserAgent' => [ agent => 'FooBar' ],
JSON => sub {
my $c = shift;
$c->load_class('JSON')->new->utf8;
},
);
=head2 unregister(@names)
=h
e AnyEvent;
use AnyEvent::HTTP;
use AnyEvent::SKKServ;
use Cache::Memory::Simple;
use Encode;
use JSON;
use URI;
use constant {
SERVER_ERROR => '0',
SERVER_FOUND => '1',
SERVER_NO
che::Memory::Simple->new();
my $expire = 60 * 60 * 24;
my $enc = find_encoding('euc-jp');
my $json = JSON->new->utf8(1)->relaxed(1);
my $_uri = URI->new('http://www.google.com/transliterate');
sub _
timeout => 1, sub {
if ($_[1]->{Status} == 200) {
my $res = $json->decode($_[0]);
my @words;
for my $word (@{$res->[0][1]})
nfig;
$config = CPAN::Testers::Config->read;
$config->{global}{profile} = 'my_profile.json';
$config->write;
=head1 DESCRIPTION
CPAN::Testers::Config provides a very simple interfac
package TiddlyWeb::EditPage;
use warnings;
use strict;
use Carp qw/croak/;
use File::Temp;
use JSON::XS;
use Encode;
=head1 NAME
TiddlyWeb::EditPage - Edit a wiki page using your favourite EDITOR.
is mandatory";
my $rester = $self->{rester};
$rester->accept('application/json');
my $pages = decode_json($rester->get_taggedpages($tag));
unless (@$pages) {
die "No pages fou
e Curses qw/KEY_ENTER/;
use TiddlyWeb::Wikrad qw/$App/; # XXX cyclic
use TiddlyWeb::EditPage;
use JSON;
use Data::Dumper;
use YAML ();
sub new {
my $class = shift;
my $self = $class->SUPER::
ta ...');
$r->accept('application/json');
my $page_name = $App->get_page;
my $json_text = $r->get_page($page_name);
my $page_data = from_json($json_text);
$App->{cui}->nostatus;
y);
if ( $mode eq 'full' ) {
my $val = $self->json->encode($ref);
$result .= join $DELIMITER, "VALUE", $key, 0, length($
cached->get('slowqueris:latest'); # only latest value.
say $memcached->get('slowqueris:full'); #JSON formated data include raw values
=head1 SEE ALSO
<drived>, <App::derived::Plugin> for writing
t;
my ($json_url) = @_;
my $EXIT_CODE = 1;
my $browser = WWW::Mechanize->new(
stack_depth => 0,
timeout => 3,
autocheck => 0,
);
$browser->get( $json_url );
Perl itself.
=head1 VERSION
Version 2.05
=head1 SEE ALSO
perl(1), perltie(1), perlfunc(1), L<Data::Dumper>, L<FreezeThaw>, L<Storable>, L<DBM::Deep>, L<MLDBM::Serializer::JSON>.
=cut
ey ( @keys ) {
my $ref = $self->service_stats($key);
print $self->json->encode([$key,$ref]), "\n";
}
}
);
}
1;
__END__
=encoding utf8
=head
ervices _proclet/]
);
use JSON qw//;
my $_JSON = JSON->new()
->utf8(1)
->shrink(1)
->space_before(0)
->space_after(0)
->indent(0);
sub json {
$_JSON;
}
sub exists_service {
open my $fh, '<', $service->{file} or return;
my $val = do { local $/; <$fh> };
$self->json->decode($val);
}
sub service_keys {
my $self = shift;
keys %{$self->_services};
}
my %w
class to make App::derived Plugin.
=head1 METHODS
=over 4
=item new
=item json(): Object
Utility method. returns JSON.pm object
=item service_stats($key): HashRef
Retrieve service status
=item
anipulation methods
=over
=item load
Parses input data in configured string format (e.g. YAML, JSON or XML) and
returns perl structure (hashref or arrayref).
Input: $string_data.
Output: $parsed_d
s) > 0;
};
}
=item dump
Convert perl structure into string of configured format (e.g. YAML, JSON or
XML).
Input: $data.
Output: $string.
Uses configured dumper to serialize perl structure into
&YAML::Tiny::Dump,
\&YAML::Tiny::Load,
],
json => [
'JSON/Syck.pm',
\&JSON::Syck::Dump,
\&JSON::Syck::Load,
],
);
=item init
Initialize dumper and
05;
use File::Temp qw/tempfile/;
use File::Copy;
use Proclet;
use JSON ();
use Log::Minimal;
our $VERSION = '0.10';
my $_JSON = JSON->new()
->utf8(1)
->shrink(1)
->space_before(0)
->
($key, $cmd) = @_;
my ($tmpfh,$tmpfile) = tempfile(UNLINK=>0, EXLOCK=>0);
print $tmpfh $_JSON->encode({
status=>"INIT",
persec => '0E0',
latest => '0E0',
});
c
my ($writefile, $body) = @_;
my ($tmpfh,$tmpfile) = tempfile(UNLINK=>0);
print $tmpfh $_JSON->encode($body);
close($tmpfh);
move( $tmpfile, $writefile);
}
1;
__END__
=encoding utf