{_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) {
$('#
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
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}
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
of the document. Quite frankly, Giddy will not care if the files
are in fact binary. They can be JSON or plain text files for all it cares, but as
long as they are separate from attributes.yaml, they
A document file (implies '_body' attribute holds HTML data)
data.json <-- A document file (implies '_body' attribute holds JSON text)
about/ <-- A document directory
attributes.yaml
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
# 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;
te with the Disqus API
pass_api_errors (optional) When set, any API errors are returned as a JSON object instead of
throwing an exception.
=head1 METHODS/HELPERS
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
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
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
DARK_GREEN ORANGE TEAL BROWN);
use POE::Component::IRC::Plugin qw(PCI_EAT_NONE);
use POE::Filter::JSON;
use POE::Wheel::ReadWrite;
use POE::Wheel::SocketFactory;
sub new {
my ($package, %args) =
} = POE::Wheel::ReadWrite->new(
Handle => $socket,
Filter => POE::Filter::JSON->new(),
InputEvent => 'eval_read',
ErrorEvent => 'eval_error',
);
$eval-
n before
calling these methods. I have found the JSON is a light, and efficent
serialization method. And just about every other lanaguage has a JSON
implementation readily avaiable.
Some terminolo
data => 'this is my packet'});
$heap->{server}->put($frame);
or
$message = objToJson($data);
$frame = $stomp->send({destination => 'test',
data => $message,
HEAP, ARG0];
my $frame = $stomp->ack({'message-id' => $stomp->message_id});
my $data = jsonToObj($frame->body);
handle_data($data);
$heap->{server}->put($frame);
}
=back
=hea
$ua->post ($self->{path} . '/statements',
'Content-Type' => 'application/json', 'Content' => encode_json (\@stmts) );
die "protocol error: ".$resp->status_line.' ('.$resp->content.')' un
->new (PUT => $self->{path} . '/statements',
[ 'Content-Type' => 'application/json' ], encode_json (\@stmts));
my $resp = $ua->request ($requ);
die "protocol error: ".$resp->status_lin
OST => $self->{path} . '/statements/delete',
[ 'Content-Type' => 'application/json' ], encode_json (\@facts));
my $resp = $ua->request ($requ);
die "protocol error: ".$resp->status_lin
le for the AGv3 series
=head1 SYNOPSIS
# same interface as RDF::AllegroGraph::Server
=cut
use JSON;
use Data::Dumper;
use RDF::AllegroGraph::Catalog3;
=pod
=head1 INTERFACE
=head2 Methods
=ov
gs');
die "protocol error: ".$resp->status_line unless $resp->is_success;
my $cats = from_json ($resp->content);
# warn Dumper $cats;
return
map { $_ => RDF::AllegroGraph::Catalog3->n
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
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 =
$self->timeout(10);
$self->env_proxy;
$self->default_header('Accept' => "application/json");
if ($options{AUTHENTICATION}) {
( $self->{USERNAME}, $self->{PASSWORD} ) = ($options{AUTH
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
arnings;
use base qw(RDF::AllegroGraph::Session4);
use Data::Dumper;
use feature "switch";
use JSON;
use URI::Escape qw/uri_escape_utf8/;
use HTTP::Request::Common;
=pod
=head1 NAME
RDF::Allegr
::AllegroGraph::Server4;
use strict;
use warnings;
use base qw(RDF::AllegroGraph::Server);
use JSON;
use Data::Dumper;
use RDF::AllegroGraph::Catalog4;
use HTTP::Request::Common;
use HTTP::Status;
gs');
die "protocol error: ".$resp->status_line unless $resp->is_success;
my $cats = from_json ($resp->content);
return
map { $_ => RDF::AllegroGraph::Catalog4->new (NAME => $_, SERVER =