y ,
#Abhsihek jain
our $VERSION = '0.02';
use base 'DomainOperations';
use LWP::UserAgent;
use JSON::XS;
use Data::Dumper;
use HTTP::Request;
use constant ResellerClubHTTPURL_Sandbox => 'https:/
= shift;
my $options = shift;
$self->{req}->uri(
$self->{url}
. 'customers/signup.json?auth-userid='
. $self->{username}
. '&auth-password='
. $self->{password}
. '&use
lf->{ua}->request( $self->{req} );
# check the outcome
if ( $res->is_success ) {
my $coder = JSON::XS->new->ascii->pretty->allow_nonref;
my $perl_scalar = $coder->decode( $res->content );
i
se JSON::Syck;
use YAML::Syck;
use TM::Literal;
use vars qw($VERSION);
$VERSION = qw(('$Revision: 1.2 $'))[1];
=pod
=head1 NAME
TM::Serializable::JTM - Topic Maps, trait for reading/writing JSON T
pplication patterns
# reading JSON/YAML:
my $tm=TM->new(...);
Class::Trait->apply($tm,"TM::Serializable::JTM");
$tm->deserialize($jsondata);
# writing JSON/YAML:
# ...a map $tm is instan
=head1 DESCRIPTION
This trait provides functionality for reading and writing Topic Maps in
JTM (JSON Topic Map) format, as defined here: L<http://www.cerny-online.com/jtm/1.0/>.
Limitations:
=ove
ns::Plugin::HMI::Catalyst::View::TT - Catalyst TT View
=cut
use base 'Catalyst::View::TT';
use JSON;
__PACKAGE__->config({
PRE_PROCESS => 'bootstrap.tt',
WRAPPER => 'wrapper.tt',
TEMPLATE_
SCALAR_OPS->{printf} = sub { sprintf $_[1], $_[0] };
$Template::Stash::LIST_OPS->{to_json} = sub { return to_json(shift, { allow_barekey => 1, allow_singlequote => 1} ) };
=head1 AUTHOR
Mike Eldrid
package Cantella::Store::UUID::File;
use Moose;
use JSON ();
use File::MimeInfo::Magic ();
use MooseX::Types::Data::GUID qw/GUID/;
use MooseX::Types::Path::Class qw/Dir File/;
use namespace::autocl
{
my $self = shift;
my $file = $self->_meta_file;
if( my $json = $file->slurp ){
if( my $perl = eval { JSON::from_json( $json ) }){
return $perl;
}
die("Failed to parse conten
(my $json = JSON::to_json( $self->metadata || {} ) ){
if( my $fh = $file->openw ){
print $fh $json;
return 1;
}
die("Failed to write meta file '${file}' Contents: '${json}': $
= qw(('$Revision: 1.2 $'))[1];
=pod
=head1 NAME
TM::Materialized::JTM - Topic Maps, trait for JSON Topic Map instances.
=head1 SYNOPSIS
use TM::Materialized::JTM;
my $tm=TM::Materialized::JT
DESCRIPTION
This package provides map parsing and creating functionality for JTM (JSON Topic Map) instances.
The JSON Topic Map format is defined here: L<http://www.cerny-online.com/jtm/1.0/>.
=head
=item * B<format> (choices: C<"json">, C<"yaml">)
This option controls whether the JTM data is treated as being in JSON format
or in YAML (which is a superset of JSON). This applies to both reading
Finance::Bitcoin;
use Carp qw( croak );
extends 'Catalyst::Model';
our $VERSION = '0.02';
has jsonrpc_uri => (is => 'rw');
has api => (is => 'rw');
has wallet => (is => 'rw');
sub new {
my $sel
$address, $amount) = @_;
# This is required to force $amount to be json-coded as real type,
# not string, in following JSON-RPC request
$amount += 0;
return $self->wallet->pay($address, $
d1 NAME
Catalyst::Model::Bitcoin - Catalyst model class that interfaces
with Bitcoin Server via JSON RPC
=head1 SYNOPSIS
Use the helper to add a Bitcoin model to your application:
./script/mya
TML::Diff 0.561 [Required]
Image::Size 2.93 [Required]
IO::Scalar 2.110
Jcode 0.88 [Required]
JSON 2.12 [Required]
Locale::Maketext 1.13 [Required] [1]
Log::Dispatch 2.26 [Required]
Log::Log4pe
ark::Serializer::Library::Data::Serializer qw(JSON);
# Register tests on run time
Benchmark::Serializer::Library::Data::Serializer->register('JSON');
=head1 DESCRIPTION
This modules ad
ags
For each added serializer a new Benchmark tag is created called
C<:DS-<nameE<gt>>, i.e C<:DS-JSON> if used as in the synopsis
=cut
sub import {
my $pkg = shift;
my @imports = map {
package AnyEvent::JSONRPC::InternalHandle;
use Any::Moose;
use AnyEvent;
has cv => (
is => 'ro',
isa => 'AnyEvent::CondVar',
default => sub {
AnyEvent->condvar;
},
ite {
my ($self, $type, $json) = @_;
$self->cv->send( $json );
}
__PACKAGE__->meta->make_immutable;
__END__
=for stopwords condvar
=head1 NAME
AnyEvent::JSONRPC::InternalHandle - Handle
object used internally in
AnyEvent::JSONRPC::TCP::Server
=head1 SEE ALSO
L<AnyEvent::JSONRPC>.
=head1 AUTHOR
Peter Makholm <peter@makholm.net>
=head1 COPYRIGHT AND LICENSE
Copyright (c) 2010 by
uild requests for the notifo.com service
use strict;
use warnings;
use Carp 'confess';
use JSON 'decode_json';
use MIME::Base64 'encode_base64';
use File::HomeDir;
use File::Spec::Functions qw( catfi
$self;
}
sub parse_response {
my ($self, %args) = @_;
my $res = {};
eval { $res = decode_json(delete $args{http_body}) };
if ($@) {
$res->{status} = 'error';
$res->{respon
package WebService::ReviewBoard;
use strict;
use warnings;
use JSON::Syck;
use Data::Dumper;
use Log::Log4perl qw(:easy);
use HTTP::Request::Common;
use LWP::UserAgent;
use version; our $VERSION = q
rname";
my $password = shift or LOGCROAK "you must pass login a password";
my $json = $self->api_post(
'/api/json/accounts/login/',
[
username => $username,
password => $password
]
);
quest($request);
DEBUG "Got response:\n" . $response->as_string();
my $json;
if ( $response->is_success ) {
$json = JSON::Syck::Load( $response->decoded_content() );
}
else {
LOGDIE "Error f
package AnyEvent::JSONRPC::HTTP::Client;
use Any::Moose;
use Any::Moose '::Util::TypeConstraints';
extends 'AnyEvent::JSONRPC::Client';
use Carp;
use Scalar::Util 'weaken';
use AnyEvent;
use AnyEve
nt::HTTP;
use JSON::RPC::Common::Procedure::Call;
use JSON::RPC::Common::Procedure::Return;
use MIME::Base64;
use JSON::XS;
has url => (
is => 'ro',
isa => 'Str',
required =>
;
},
);
no Any::Moose;
sub call {
my ($self, $method, @params) = @_;
my $request = JSON::RPC::Common::Procedure::Call->inflate (
version => $self->version,
id => $
vent::JSONRPC::HTTP::Server;
use Moose;
extends 'AnyEvent::JSONRPC::Server';
use Carp;
use Scalar::Util 'weaken';
use AnyEvent::JSONRPC::CondVar;
use AnyEvent::HTTPD;
use JSON::XS;
use JSON::RPC:
request => sub {
my ($httpd, $req) = @_;
my $request = eval { $self->json->decode( $req->content ) };
unless (defined $request ) {
$req->respo
$response) {
$req->respond( [ 200, 'Ok', { "Content-Type" => "application/json" }, $self->json->encode( $response ) ] );
} else {
$req->respond( [ 204, 'No
,
'JSON::PP' => {
deflate => sub { JSON::PP::encode_json($_[0]) },
inflate => sub { JSON::PP::decode_json($_[0]) },
default => 1,
json =>
,
'JSON::XS' => {
deflate => sub { JSON::XS::encode_json($_[0]) },
inflate => sub { JSON::XS::decode_json($_[0]) },
default => 1,
json =>
1
},
'JSON::XS,pretty' => {
deflate => sub { $_[1]->encode( $_[0] ) },
inflate => sub { $_[1]->decode( $_[0] ) },
args => sub { JSON::XS->new->pretty(1)->allow_b
;
use Exception::Class ('Flea::Pass' => { alias => 'pass' });
use Exporter::Declare '-magic';
use JSON;
use HTTP::Exception;
use Try::Tiny;
use Plack::Request;
use URI;
use List::Util qw(first);
defa
/$path")->canonical;
}
default_export json {
return [
200,
['Content-Type' => 'application/json; charset=UTF-8'],
[ JSON::encode_json(shift) ]
];
}
default_export htm
{
get '^/$' {
file 'index.html';
}
get '^/api$' {
json { foo => 'bar' };
}
post '^/resource/(\d+)$' {
my $request = request
age AnyEvent::JSONRPC::TCP::Server;
use Moose;
extends 'AnyEvent::JSONRPC::Server';
use Carp;
use Scalar::Util 'weaken';
use AnyEvent::Handle;
use AnyEvent::Socket;
use AnyEvent::JSONRPC::Internal
Handle;
use AnyEvent::JSONRPC::CondVar;
use JSON::RPC::Common::Procedure::Call;
has address => (
is => 'ro',
isa => 'Maybe[Str]',
default => undef,
);
has port => (
is
},
json => $self->json,
%{ $self->handler_options },
fh => $fh,
);
$handle->on_read(sub {
shift->unshift_read( json => sub {
my %args = @_;
my $json = $self->api_post( '/api/json/reviewrequests/new/', [%args] );
if ( !$json->{review_request} ) {
LOGDIE "create couldn't determine ID from this JSON that it got back from
server: " . Dumper $json;
}
$self->{rr} = $json->{review_request};
return $self;
}
sub fetch {
my $self = shift;
my $id = shift;
my $json = $self->api_get( '/api/json/reviewrequests/' . $
id );
$self->{rr} = $json->{review_request};
return $self;
}
sub fetch_all_from_user {
my $self = shift;
my $from_user = shift;
my $json = $self->api_get( '/api/json/reviewrequests/from/use
=> { 'a' .. 'z' },
string => 'x' x 200,
};
cmpthese( -5, $structure, qw(:core :json :yaml) );
=head1 DESCRIPTION
This module encapsulates some basic benchmarks to help you choose
name attribute:
{
name => 'JSON::XS',
deflate => sub { JSON::XS::encode_json($_[0]) }
inflate => inflate => sub { JSON::XS::decode_json($_[0]) }
}
By default Benchmark::Se
et of serialization modules
=item :core - Serialization modules included in core
=item :json - JSON modules
=item :yaml - YAML modules
=item :xml - XML formats
=back
=cut
use Bench
yEvent::JSONRPC;
use strict;
use warnings;
use base 'Exporter';
our $VERSION = '0.15';
our @EXPORT = qw/jsonrpc_client jsonrpc_server/;
use AnyEvent::JSONRPC::TCP::Client;
use AnyEvent::JSONRPC::TC
P::Server;
sub jsonrpc_client($$) {
my ($host, $port) = @_;
AnyEvent::JSONRPC::TCP::Client->new(
host => $host,
port => $port,
);
}
sub jsonrpc_server($$) {
my ($add
ent::JSONRPC::TCP::Server->new(
address => $address,
port => $port,
);
}
1;
__END__
=encoding utf-8
=for stopwords TCP TCP-based JSONRPC RPC
=head1 NAME
AnyEvent::JSONRPC
le
IO::Prompt
IPC::Open2
IPC::Open3
IPC::Run
IPC::Run3
IPC::ShareLite
IPC::System::Simple
JSON
JavaScript::Beautifier
LWP::Simple
LWP::UserAgent
Lingua::EN::Numbers
List::MoreUtils
List: