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
red by L<App::Cache>. Unlike L<App::Cache> it uses
L<JSON::Util> for storage and not L<Storable>. The stash is saved to
F<$HOME/.app-name/stash.json>. It is in the "pretty" format so it should be
easy
ct;
our $VERSION = '0.02';
use File::HomeDir;
use File::Path qw( mkpath );
use Path::Class;
use JSON::Util;
use base qw( Class::Accessor::Chained::Fast );
__PACKAGE__->mk_accessors(qw( application
unless ( $self->stash_filename ) {
my $stash_filename = file($self->directory , "stash.json" )->stringify;
$self->stash_filename($stash_filename);
}
return $self;
}
=head2
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
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
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
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
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
Optional bits for extra L<benchmark_template_engines> behaviour:
L<Term::ProgressBar::Simple>
L<JSON::Any>
=item Modules required by multiple plugins:
L<File::Spec>
L<File::Spec> needed by plugin
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 AnyEvent::JSONRPC::TCP::Client;
use Any::Moose;
use Any::Moose '::Util::TypeConstraints';
extends 'AnyEvent::JSONRPC::Client';
use Carp;
use Scalar::Util 'weaken';
use AnyEvent;
use AnyEven
t::Socket;
use AnyEvent::Handle;
use JSON::RPC::Common::Procedure::Call;
use JSON::RPC::Common::Procedure::Return;
has host => (
is => 'ro',
isa => 'Str',
required => 1,
);
h
ead(json => sub {
$self->_handle_response( $_[1] );
});
});
while (my $pooled = shift @{ $self->_request_pool }) {
$handle->push_write( json =>
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:
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 => $
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 {
ect = MyClass->new;
my $result = $object->do_work();
if ($self->is_ajax) {
return to_json($result);
}
else {
my $t = $self->load_tmpl('myrunmode.tmpl');
$t->param(RESUL
package AnyEvent::JSONRPC::Server;
use Moose;
use JSON::XS;
has json => (
is => "ro",
default => sub {
JSON::XS->new->allow_blessed(1)->convert_blessed(1);
},
);
no Moose;
D__
=head1 NAME
AnyEvent::JSONRPC::Server - Base class for JSON-RPC Servers
=head1 SYNOPSIS
use AnyEvent::JSONRPC::XXX::Server;
my $server = AnyEvent::JSONRPC::TCP::Server->new( ... )
s for servers in the L<AnyEvent::JSONRPC> suite of
modules. Current implementations includes a
L<TCP|AnyEvent::JSONRPC::TCP::Server> client and a
L<HTTP|AnyEvent::JSONRPC::HTTP::Server> client. See th
e AnyEvent::JSONRPC::Client;
use Any::Moose;
no Any::Moose;
__PACKAGE__->meta->make_immutable;
1;
__END__
=encoding utf-8
=head1 NAME
AnyEvent::JSONRPC::Client - Base class for JSON-RPC clients
=head1 SYNOPSIS
use AnyEvent::JSONRPC::XXX::Client;
my $client = AnyEvent::JSONRPC::XXX::Client->new(
...
);
# blocking interface
my $res = $client->call( echo
s for clients in the L<AnyEvent::JSONRPC> suite of
modules. Current implementations includes a
L<TCP|AnyEvent::JSONRPC::TCP::Client> client and a
L<HTTP|AnyEvent::JSONRPC::HTTP::Client> client. See th
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 {
;
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
,
'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