chosen as the serialization
format since YAML is well suited as a human editable format; however, JSON
support is planned). This module provides an API for usage by Perl applications.
Main database f
h;
use warnings;
use strict;
use utf8;
use Digest::MD5 qw(md5 md5_hex);
use WWW::Mechanize;
use JSON;
=pod
=head1 NAME
VKontakte::API::OAuth - Module for login into vkontakte.ru using OAuth 2.0 a
$mech->get($query);
my $response = $mech->content();
utf8::encode($response);
my $h=decode_json($response);
return undef unless(defined $h->{'access_token'});
$self->{'access_token'}=$h-
= $mech->get($query);
my $response = $mech->content();
utf8::encode($response);
return decode_json($response);
}
sub _params {
my $self = shift;
my $params = shift;
return unless ( ref $par
ditable set of fields. Issuance result holds in the JSON
=head2 EXPORT
new();
get(id); # return full data page (all fields) in JSON
get(id,key); # return a single field with a ke
I;
use warnings;
use strict;
use utf8;
use Digest::MD5 qw(md5 md5_hex);
use WWW::Mechanize;
use JSON;
=pod
=head1 NAME
VKontakte::API - Module for login into vkontakte.ru and sending requests
=h
;
$params->{'method'} = $method;
$params->{'timestamp'} = time();
$params->{'format'} = 'json';
$params->{'rnd'} = int(rand()*10000);
my $sig = defined $self->{'mid'} ? $self->{'mid'} :
_get_contents($query);
my $response = $mech->content();
utf8::encode($response);
return decode_json($response);
}
=head2 _params
prepares parameters for request
=cut
sub _params {
my $self =
ig.json));
produce ./etc/config.json on unix
=cut
=head3 file_io, dir_io
append filesystem objects to IO::Easy subclass object
my $config = IO::Easy::Dir->current->file_io (qw(etc config.json));
nfig.json on unix, blessed into IO::Easy::File
=cut
=head3 up, parent
directory container for io object
my $config = IO::Easy::Dir->current->append (qw(etc config.json)); # './etc/config.json'
m
# '.'
my $config = $current->append (qw(etc config.json)); # './etc/config.json'
my $config_rel = $config->rel_path ($current); # 'etc/config.json'
=cut
=head3 path_components
path, split by file
# TODO: store database config
$etc->append ("$project_id.json")->as_file->store_if_empty ('{}');
$etc->append ($instance, "$project_id.json")->as_file->store_if_empty ('{}');
$etc->append ('proj
};
use Class::Easy;
use base qw(Project::Easy);
has id => '{$project_id}';
has conf_format => 'json';
my $class = __PACKAGE__;
has entity_prefix => join '::', $class, 'Entity', '';
$class->init;
y;
use base qw(Project::Easy);
has 'id', default => 'caramba';
has 'conf_format', default => 'json';
my $class = __PACKAGE__;
has 'entity_prefix', default => join '::', $class, 'Entity', '';
o parse config file
my $serializer_json = $conf_package->serializer ('json');
if ($command =~ /^(?:--)?dump$/) {
print "\"$key\" => ";
print $serializer_json->dump_struct ($struct);
print "\
les
my $fixup_struct = {};
if ($command eq 'template') {
my $template = $serializer_json->parse_string (
$templates->{'template-' . $remains[0]}
);
eval "\$fixup_struct->$k
unning after kill, please kill manually\n";
exit;
}
}
$self->launch;
}
}
sub TO_JSON {
my $self = shift;
my $result = {map {$_ => $self->{$_}} keys %$self};
$result->{pid_file}
xpansion);
patch ($conf, $alt);
return $conf;
}
my $ext_syn = {
'pl' => 'perl',
'js' => 'json',
};
sub serializer {
shift;
my $type = shift;
$type = $ext_syn->{$type}
if exists $ext_s
ckage Net::SMS::TxtLocal;
use Carp;
use LWP::UserAgent;
use Moose;
use namespace::autoclean;
use JSON;
use 5.006;
our $VERSION = '0.03';
=head1 NAME
Net::SMS::TxtLocal - Send SMS messages using t
ath;
my $post_query = {
uname => $self->uname,
pword => $self->pword,
json => 1,
%$query,
};
my $response = $self->ua->post( $url, $post_query );
croa
return the response unless it looks like JSON
return $content unless $content =~ m{ \A \s* \{ \s* "\w }x;
# decode the JSON
my $data = decode_json($content);
# check for the error ke
{_progress};
};
get '/_progress/:name' => sub {
header 'Content-Type' => 'application/json';
to_json(_progress(params->{name}));
};
register_plugin;
1;
=pod
=head1 NAME
Dancer::Plugin::P
iv>
<script type="text/javascript">
function pollProgress(name, interval) {
$.getJSON('/_progress/' + name, function(pg) {
if (pg.progress === null) {
$('#
use.
=item B<< META2_NAME >>
The string that should be used for this license in the CPAN F<META.json>
or F<META.yml> file, according to the CPAN Meta spec v2. Leave out
if there is no known string
use strict;
use warnings;
use Carp qw(croak);
use Encode ();
use HTTP::Request::Common ();
use JSON;
use LWP::UserAgent;
use URI;
our $VERSION = '0.04';
$VERSION = eval $VERSION;
sub new {
my
return unless $res->is_success;
# Change the content type of the response from 'application/json' so
# HTTP::Message will decode the character encoding.
$res->content_type('text/plain');
my $content = $res->decoded_content;
return unless $content;
my $data = eval { from_json($content) };
return unless $data;
return $self->{id} = $data->{resourceSets}[0]{resource
data in a format which is expected by ExtJS as perl object. You will want to serialize it with L<JSON> and send it to the client.
$form->grid_data($data);
C<$data> can be a L<DBIx::Class::ResultS
es some kind of magic on the client side. Read L<http://extjs.com/deploy/dev/docs/?class=Ext.data.JsonReader> for more information.
Sometimes you need to send a different number of results back to th
>.
=head2 render_items
This method returns all form elements in the JavaScript Object Notation (JSON). You can put this string
right into the C<items> attribute of your ExtJS form panel.
Fields wit
package Geo::Coder::Mappy;
use strict;
use warnings;
use Carp qw(croak);
use Encode ();
use JSON;
use LWP::UserAgent;
use URI;
our $VERSION = '0.02';
$VERSION = eval $VERSION;
sub new {
my ($c
=> $self->{token},
fullAddress => $location,
'opt.format' => 'json',
'opt.interactive' => 1,
'opt.language' => 'ENG',
'opt.xmlOutput' =
my $content = $res->decoded_content;
return unless $content;
my $data = eval { from_json($content) };
return unless $data;
# Result is a list only if there is more than one item
package WebService::Futu;
use warnings;
use strict;
use LWP::UserAgent;
use JSON::XS;
use HTTP::Status qw(:constants :is status_message);
use HTTP::Cookies;
use Data::Dumper;
=head1 NAME
WebServi
$content) = @_;
my $json_content = encode_json($content) if $content;
my $max = 10;
for (my $i = 0; $i < $max; $i++){
my $body = $self->_perform($method, $query, $json_content);
# run co
mmand
if ($body->code eq HTTP_OK) {
if ($body->content){
return decode_json($body->content)
}else{
return {};
};
} elsif ($body->code eq HTTP_UNAUTHORIZED) {
# mak
configfile => (
isa => 'Str',
is => 'rw',
default => $FindBin::Bin . '/config.json',
metaclass => 'MooseX::Getopt::Meta::Attribute',
cmd_aliases => 'c',
documenta
Spec::Functions qw<catdir catfile rel2abs>;
use File::Temp qw<tempdir>;
use POE;
use POE::Filter::JSON;
use POE::Filter::Reference;
use POE::Filter::Stream;
use POE::Wheel::SocketFactory;
use POE::Whe
POE::Wheel::ReadWrite->new(
Handle => $handle,
Filter => POE::Filter::JSON->new(),
InputEvent => 'client_read',
FlushedEvent => 'client_write',
Er
= $self->{clients}{$wheel_id};
if (ref $input ne 'HASH') {
$client->put({ error => 'JSON data must be a hash' });
}
elsif (!defined $input->{lang}) {
$client->put({ error
e parent qw( Plack::Component );
use Image::Magick;
use Plack::App::File;
use File::Spec ();
use JSON::XS ();
use Digest::MD5 ();
use Plack::Request;
use HTTP::Date ();
use Plack::Util ();
use String
with_query ) {
my $req = Plack::Request->new($env);
my $encoded = JSON::XS::encode_json( $commands );
my $query_params = $req->query_parameters;
my $pa
};
# params expanded
try {
$commands = JSON::XS::decode_json( String::Bash::bash($encoded, $params) );
} catch {
warn "Pa