re functions, execute loops.
Probably need way to handle datasets.
=item Remove JavaScript-ness
JSON and what not are probably not needed.
=item Document Way To Feed The Script To "R"
=back
=head
n files and your L<DBIx::Class> Catalyst
model. A search form is also supplied, which can include JSON-powered
ExtJS comboboxes (see L<http://www.extjs.com/>).
To run the included demo application, g
...
=item infobox_order
=back
=head1 TEMPLATES
Documentation TODO
=head1 JSON
Documentation TODO
=cut
our %LOADED; # cache of eval'ed formdefs
sub new {
my ($class, $t
) = @_;
confess if (!$view);
return @{$self->{formdef}->{display}->{$view}};
}
sub stash_json_autocomplete {
my ($self, $query, $id_field, $show_field, $restrict) = @_;
my $searchcol
#!perl
package CGI::JSONRPC::Base;
use strict;
use warnings;
use JSON::Syck;
use JSON::Syck qw(Dump Load);
(our $JAVASCRIPT = __FILE__) =~ s{\.pm$}{.js};
1;
sub new {
my($class, %args) = @_;
, $class;
}
sub default_dispatcher {
'CGI::JSONRPC::Dispatcher'
}
sub run_json_request {
my($self, $json) = @_;
my $data = (JSON::Syck::Load($json))[0];
die "Did not get a hash from RP
a) eq 'HASH');
unless($data->{method}) {
warn "JSONRPC payload did not have a method!";
return $self->return_error($data, "JSONRPC payload did not have a method!");
}
return $self
package Apache2::JSONRPC::Session;
use strict;
use Apache2::JSONRPC;
use CGI::JSONRPC::Dispatcher::Session;
use base qw(Apache2::JSONRPC);
1;
sub new {
my ($class,%args) = @_;
%args = __PACKAG
d1 NAME
Apache2::JSONRPC::Session - Dispatcher class for session aware JSONRPC Objects
=head1 SYNOPSIS
package MyDispatch;
use Apache2::JSONRPC::Session;
use base qw(Apache2::JSONRPC::Session);
#
ession portions of CGI::JSONRPC are unmaintained and may change or
disappear without notice (probably change...)
=head1 DESCRIPTION
Apache2::JSONRPC::Dispatcher receives JSONRPC class method calls a
#!perl
package CGI::JSONRPC::Dispatcher;
use strict;
use warnings;
our $AUTOLOAD;
use Attribute::Handlers;
use attributes;
our %Protected;
return 1;
sub UNIVERSAL::DontDispatch :ATTR(CODE) {
my
($package, $symbol) = @_;
$CGI::JSONRPC::Dispatcher::Protected{$package}{*{$symbol}{NAME}}++;
return 1;
}
sub DISPATCH_OBJECT {
my($class, $to) = @_;
}
sub AUTOLOAD {
my($class, $id, $to) =
$to\::$method_name may not be dispatched\n" if $Protected{$to}{$method_name};
my $object = $to->jsonrpc_new($id, $class);
if(my $method = $object->can($method_name)) {
return $method->($object
JSON::XS;
my $data = {
'three' => [ 1, 2, 3 ],
'four' => { 'a' => 'b' },
'five' => [ 'a', 'b', 'c' ],
};
my $json = to_json($data);
cmpthese(
-1,
{ 'to_json' => sub { to_json
($data) },
'from_json' => sub { from_json($json) },
}
);
rk qw(cmpthese);
use JSON::XS::VersionOneAndTwo;
my $data = {
'three' => [ 1, 2, 3 ],
'four' => { 'a' => 'b' },
'five' => [ 'a', 'b', 'c' ],
};
my $json = encode_json($data);
cmpthese(
-1,
{ 'encode_json' => sub { encode_json($data) },
'decode_json' => sub { decode_json($json) },
}
);
;
use JSON::XS;
my $data = {
'three' => [ 1, 2, 3 ],
'four' => { 'a' => 'b' },
'five' => [ 'a', 'b', 'c' ],
};
my $json = encode_json($data);
cmpthese(
-1,
{ 'encode_json' => s
ub { encode_json($data) },
'decode_json' => sub { decode_json($json) },
}
);
age WebService::Yelp;
use strict;
use warnings;
our $VERSION = '0.03';
use LWP::UserAgent;
use JSON;
use Scalar::Util qw/looks_like_number/;
use WebService::Yelp::Result;
use WebService::Yelp::Nei
f->base_url() || $base_url);
$self->{_uri} = $uri;
# set up the json parser
my $json = JSON->new();
$self->{_json} = $json;
return $self;
}
my %cmap = (
# review search
hat is returned by the API. The default is
WebService::Yelp::* objects. Other options are 'php', 'json', and
'pickle'. If one of these three options is specified, the raw data
will be returned by the
(%) {
my $self = shift;
my %args = @_;
$args{'location'} ||= '';
eval 'use JSON::Syck; 1' or print STDERR "ERR JSON::Syck is missing\n";
use Encode;
# use URI;
my $uri = URI->new("http://maps
.google.com/maps/geo");
$uri->query_form(q => $args{'location'}, output => 'json', key => $self->{'apikey'});
my $res = $ua->get($uri);
# Content-Type: text/javascript; charset=UTF-8; charset=
e::decode($charset, $res->content);
local $JSON::Syck::ImplicitUnicode = 1;
1 if defined $JSON::Syck::ImplicitUnicode; # prevent warning
my $data = JSON::Syck::Load($content);
my @placemark = @{
package Net::SocialGraph;
use strict;
use JSON::Any;
use LWP::Simple qw();
use URI;
our $VERSION = '1.1';
my $url = 'http://socialgraph.apis.google.com/lookup';
=head1 NAME
Net::SocialGraph - int
turning reachable nodes.
=item pretty (boolean)
Pretty-print returned JSON.
=item callback (string matching /^[\w\.]+$/)
JSONP callback function.
You shouldn't ever have to use this but I put it
@_;
my $json = $self->get_json(@urls) || return undef;
return JSON::Any->jsonToObj($json);
}
=head2 get_json <uri[s]>
The same as above but returns raw JSON.
=cut
sub get_json {
my $s
ar::Mobile;
use strict;
use warnings;
use URI::Escape;
use LWP::UserAgent;
use HTTP::Request;
use JSON::Syck;
our $VERSION = '0.01';
my $add_template =
'<a href="%sstar.add?sid=%s&rks=%s&uri=%s&
a.com';
my $sbase = sprintf('http://s.%s/', $hatena_domain);
my $suri = $sbase . 'entries.json?';
if ($args{sid}) {
$suri .= sprintf('sid=%s&', $args{sid});
}
my $count = 0
ri);
my $res = $ua->request($req);
$res->is_success or return;
my $data = JSON::Syck::Load($res->content);
$sentries = $data->{entries};
}
for my $se (@$sentrie
use warnings;
use Carp;
use URI;
use Web::Scraper;
use WWW::Mechanize;
use WWW::HatenaLogin;
use JSON::Syck 'Load';
our $VERSION = '0.02';
sub new {
my ($class, $args) = @_;
my $base =
get_rkm {
my $self = shift;
my $rkm;
$self->{login}->mech->get("$self->{diary}?mode=json");
eval {
$rkm = Load($self->{login}->mech->content)->{rkm};
};
$rkm;
}
sub
e entry is required')
if !$args->{uri};
$self->{login}->mech->get("$args->{uri}?mode=json");
Load($self->{login}->mech->content);
}
sub retrieve_day {
my ($self, $args) = @_;
gin::DumpJSON - FeedPP Plugin for generating JSON
=head1 SYNOPSIS
use XML::FeedPP;
my $feed = XML::FeedPP->new( 'index.rss' );
$feed->limit_item( 10 );
$feed->call( DumpJSON => 'inde
ates a JSON data representation.
=head1 FILE OR STRING
If a JSON filename is C<undef> or C<''>, this module returns a JSON
string instead of generating a JSON file.
$feed->call( DumpJSON => 'f
eed.json' ); # generates a JSON file
my $json = $feed->call( 'DumpJSON' ); # returns a JSON string
=head1 OPTIONS
This plugin allows some optoinal arguments following:
my %opt = (
arp;
our $VERSION = 0.02;
use HTTP::Request::Common qw(GET POST);
use LWP::UserAgent;
use JSON;
sub new {
my $class = shift;
my $self = bless {}, $class;
$self->url('http://okilab.jp
', $res->status_line));
# parse result
my $json = $res->content() || return $self->error('Response content is empty.');
my $result = jsonToObj($json) || return $self->error("Can't parse response
item Can't parse response content.
It occurs when the response content is not able to parse as JSON data.
Please confirm the content of the HTTP::Request object by res().
=back
=head1 CONFIG
ad3 Performance
C<GM_setValue>, C<GM_getValue> and C<GM_log> talk to the proxy using
synchronous JSONRPC - so they're a little slow. It remains to be seen
whether this is a problem for typical Grease
shift;
my $h = $self->{_html} ||= HTML::Tiny->new;
return 'var GM__global = '
. $h->json_encode(
{
host => $self->{uri}->host,
passthru => $self->get_
}
req.open(method, url, async);
req.send(data);
}
// From http://www.JSON.org/json2.js
function GM__jsonEncode(value) {
var m = { // table of character substitutions
'\b':
= map { $h->json_encode( $_ ) } ( $self->namespace, $self->name );
return join "\n", map {
"function GM_$_() { return GM__proxyFunction("
. join( ', ', $h->json_encode( $_
package HTTP::Proxy::GreaseMonkey::Redirector;
use warnings;
use strict;
use Carp;
use JSON;
use HTTP::Response;
use HTML::Tiny;
use YAML qw( DumpFile LoadFile );
use LockFile::Simple qw( lock unlock
h_internal {
my ( $self, $headers, $message, $query ) = @_;
my $result = eval {
# JSON == YAML, right?
my %handler = (
setValue => sub {
my ( $args,
{_html} ||= HTML::Tiny->new;
my $qs = $h->url_decode( $query );
my $args = from_json( $qs );
my $method = delete $args->{m}
|| die "Missing 'm' arg";
my $c
\" \\ \/ \f \r \n \b \t
class CTEMPLATE_DLL_DECL JsonEscape : public TemplateModifier { MODIFY_SIGNATURE_; };
extern CTEMPLATE_DLL_DECL JsonEscape json_escape;
// A dispatch routine that calls pre_es
st template_modifiers::UrlQueryEscape& url_query_escape;
static const template_modifiers::JsonEscape& json_escape;
// --- DEBUGGING TOOLS
// Logs the contents of a dictionary and its sub-dict