:API instance
$self->_facebook(
WWW::Facebook::API->new(
'desktop' => 0,
'format' => 'JSON',
'parse' => 1,
%{ $c->config->{'facebook'} || { } },
)
);
return $self;
}
sub au
;
use Encode qw(decode encode encode_utf8);
# NB: Using JSON::XS as not all JSON modules allowed
# by JSON::Any do unicode correctly
use JSON::XS;
__PACKAGE__->mk_accessors(qw(
max_payload_size
command
_json
));
my %defaults = (
host_production => 'gateway.push.apple.com'
,
%{$init_vals}
});
$self->_queue([]);
$self->_json(JSON::XS->new());
$self->_json->utf8(1);
return $self;
}
sub _apply_to_alert_body {
my ($payload, $f
$data = YAML::LoadFile( $file );
} elsif ( $file =~ /\.json$/i ) {
require JSON;
$data = JSON::from_json( File::Slurp::read_file( $file ) );
} elsif ( $file =
;
use strict;
use warnings;
our $VERSION = '0.02';
use base 'Net::APNS::Persistent::Base';
use JSON::XS;
# ensure we're in byte-oriented mode
use bytes;
my %defaults = (
host_production => 'f
package Template::Plugin::SimpleJson;
use 5.006;
use strict;
our $VERSION = '0.01';
use Template::Plugin;
use base qw( Template::Plugin );
use JSON;
sub load {
my $class = shift;
my $context = s
return $self;
}
sub fromJson{
my $self = shift;
my $jsonText = shift;
return from_json($jsonText);
}
sub toJson{
my $self = shift;
my $o = shift;
return to_json($o);
}
1;
__END__
=head1
e::Plugin::SimpleJson - Simple JSON methods for Template Toolkit
=head1 SYNOPSIS
[% USE SimpleJson %]
[% scalar = SimpleJson.fromJson(json_text) %]
[% text = SimpleJson.toJson(scalar) %]
=he
est::MD5 qw(md5_hex);
use File::Basename;
use File::Slurp qw(read_file write_file);
use JSON qw(to_json from_json);
sub max_timestamp(@) { max map { (stat $_)[9] || 0 } @_ } # Obviously 9 is mtime
s
"couldn't cache $script->{path}";
write_file($config->{cache_file}, { atomic => 1 }, to_json($config->{cache}, {pretty => 1})) or warn "Couldn't save cache control file";
}
}
}, $class;
$config->{cache_file} ||= "$config->{cache_dir}/cache.json";
$config->{cache} = from_json( read_file($config->{cache_file}) ) if -f $config->{cache_file};
my $cache_
$count++;
}
}
# set response type
$c->response->content_type('application/json');
# return serialized list
$c->response->body($net_list->freeze);
}
=head2 event_POST
nify => 1 >>
Whether or not to minify the Javascript.
=item C<< cache_file => "$cache_dir/cache.json" >>
Where to put the cache control file.
=back
=item B<C<hash($path_to_js_file)>>
This method
#!/usr/bin/perl
package KiokuDB::Backend::Files;
use Moose;
use Carp qw(croak);
use JSON;
use File::Spec;
use File::Path qw(remove_tree make_path);
use Directory::Transactional;
use Data::Stream
ebService::YQL;
use strict;
use warnings;
use URI;
use URI::QueryParam;
use LWP::UserAgent;
use JSON::Any;
BEGIN {
use vars qw($VERSION);
$VERSION = '0.04';
}
=head1 NAME
WebService::
oo Query Language service. Instead of
manually sending a GET request to Yahoo and getting XML or JSON you can
now use a simple function call and get a deep Perl data structure.
=head1 USAGE
my $
...
# Instantiate helper objects
$self->{'_ua'} = LWP::UserAgent->new;
$self->{'_json'} = JSON::Any->new;
return $self;
}
=head2 query
Run an YQL query. Accepts one argument, the q
from JSON string when interacting with Memcached.
=cut
package NetSDS::Session;
use 5.8.0;
use strict;
use warnings;
use version; our $VERSION = '1.301';
use Cache::Memcached::Fast;
use JSON;
us
{ address => $mc_host . ':' . $mc_port } ],
serialize_methods => [ \&JSON::encode_json, \&JSON::decode_json ],
}
);
if ( $self->{memcached} ) {
return $self;
} else {
return $cla
LSO
=over
=item * L<Cache::Memcached::Fast> - XS implementation of Memcached API
=item * L<JSON> - JSON encoding/decoding API
=back
=head1 AUTHORS
Michael Bochkaryov <misha@rattler.kiev.ua>
=he
our $VERSION = "0.06";
extends qw(KiokuDB::Backend::Files);
has '+serializer' => ( default => "json" );
__PACKAGE__->meta->make_immutable;
__PACKAGE__
__END__
=pod
=head1 NAME
KiokuDB::Backen
ckend with the serializer default
set to C<json> for backwards compatibility.
L<http://www.jspon.org/|JSPON> is a standard for encoding object graphs in
JSON.
The representation is based on explicit
ID based references, and so is simple
enough to be stored in JSON.
=cut
;
sub add : Local {
my ($self, $c, $arg) = @_;
my $json = MIME::Base64::decode($arg);
my $el = Osgood::EventList->thaw($json);
my ($count, $error) = $c->add_from_list($el);
$c
============================
=head1 NAME
NetSDS::App::JSRPC - JSON-RPC server framework
=head1 SYNOPSIS
#!/usr/bin/env perl
# JSON-RPC server
use 5.8.0;
use warnings;
use strict;
JServer-
vailable via JSON-RPC
sub sum {
my ($self, $param) = @_;
return $$param[0] + $$param[1];
}
1;
=head1 DESCRIPTION
C<NetSDS::App::JSRPC> module implements framework for common JSON-RPC based
s
erver application. JSON-RPC is a HTTP based protocol providing remote
procudure call (RPC) functionality using JSON for requests and responses
incapsulation.
This implementation is based on L<NetSDS:
calculation of the center or zoom all
the markers must be in the form "decimal,decimal". The C<< json >> method will delete this
as it has no meaning once the zoom level and center have been determin
bsent the Google API will be allowed to set
the format as it sees fit. Note that although the C<< json >> method will pass this on, it seems to have no meaning
in the dynamic API.
=item maptype
This
id's described in L<http://code.google.com/apis/maps/documentation/staticmaps/#MapTypes>. The C<< json >> method will translate these into numerical codes roadmap => 0, satellite => 1, terrain => 2 an
S EDR data is written to plain text files as JSON structures one row per record.
=cut
package NetSDS::EDR;
use 5.8.0;
use strict;
use warnings;
use JSON;
use NetSDS::Util::DateTime;
use base 'NetS
%params ) = @_;
my $self = $class->SUPER::new(%params);
# Create JSON encoder for EDR data processing
$self->{encoder} = JSON->new();
# Initialize file to write
if ( $params{filename} ) {
$
=item B<write($rec1 [,$rec2 [...,$recN]])> - write EDR to file
This methods converts records to JSON and write to file.
Each record writing to one separate string.
Example:
$edr->write({from => '
ed data structure of object that may be used when some
code requires non blessed structures (like JSON serialization).
Example:
my $var = $obj->unbless();
=cut
#----------------------------------
.
=item * L<NetSDS::App::FCGI> - FastCGI applicatrion framework
=item * L<NetSDS::App::JSRPC> - JSON-RPC server framework
=item * L<NetSDS::Conf> - configuration files management class.
=item * L<
n;
use HTML::GUI::log::eventList;
use UNIVERSAL qw(isa);
our @ISA = qw(HTML::GUI::container);
use JSON;
use Log::Log4perl qw(:easy);
=head1 SCREEN
Manage a screen : it loads its definition with a
GHW:screenDescription'} ?
$params->{'GHW:screenDescription'} : '{}';
return JSON::decode_json($descDataString);
}
=head3 getDescriptionFieldsHtml
Return :
a string containi
onFieldsHtml
{
my ($self)=@_;
#we create a JSON string that contain all the usefull data we need for this screen
my $descDataString = JSON::encode_json({screenName => $self->getProp('path'),
package WWW::Moviepilot;
use warnings;
use strict;
use Carp;
use JSON::Any;
use LWP::UserAgent;
use URI;
use URI::Escape;
use WWW::Moviepilot::Movie;
=head1 NAME
WWW::Moviepilot - Interface to th
CKAGE__ . "->movie()";
}
$url .= join '-id-', map { uri_escape($_) } @args;
$url .= '.json';
my $uri = URI->new( $url );
$uri->query_form( api_key => $self->api_key );
my $res
ne;
}
my $json = JSON::Any->from_json( $res->decoded_content );
my $movie = WWW::Moviepilot::Movie->new({ m => $self });
$movie->populate({ data => { movie => $json } });
return