aceEngine;
use strict;
use vars qw($VERSION);
use Readonly;
use JSON;
use LWP::UserAgent;
$VERSION = '0.03';
$JSON::QuotApos = 1;
$JSON::UTF8 = 1;
Readonly my $API_HOST => 'http://www.placeengi
_RTAGD) if !$res->is_success;
my $cont = $res->content;
my ($long,$lat,$result,$opt) = @{jsonToObj($cont)};
for my $name (qw/long lat result/) {
$opt->{$name} = eval qq{\$$name};
my $param = '/loc?rtag=' . $rtag . '&t=' . $time;
$param .= '&appk=' . $self->appkey .'&fmt=json';
my $ua = $self->ua || $self->ua(LWP::UserAgent->new(agent=>$AGENT_DEFAULT));
my $res =
Blikistan::MagicEngine::TT2';
use base 'Blikistan::MagicEngine::YamlConfig';
use URI::Escape;
use JSON;
=head1 NAME
Blikistan::MagicEngine::PerlSite
=head1 SYNOPSIS
use Blikistan;
my $b = Blikista
# Need to get the metadata here
$r->accept('application/json');
my $return = _get_page($r, $page);
my $page_obj = jsonToObj($return);
my $page_name = $page_obj->{name};
my $pa
use Carp;
our $HAVE_JSON_SYCK;
eval { require JSON::Syck; $HAVE_JSON_SYCK = 1 };
eval { require JSON } unless $HAVE_JSON_SYCK;
Carp::croak("JSON::Syck or JSON required to use " . __PA
CKAGE__) if $@;
*_parse_json =
$HAVE_JSON_SYCK ? sub { JSON::Syck::Load($_[1]) }
: sub { JSON::jsonToObj($_[1]) };
}
__PACKAGE__->mk_accessors(qw(api_key secret
sub _get_auth_as_json {
my $self = shift;
my $cert = shift or croak "You must specify your cert as an argument.";
my $uri = URI->new('http://auth.hatena.ne.jp/api/auth.json');
my $requ
r;
use strict;
use warnings;
use base qw(MozRepl::Plugin::Base);
use Carp::Clan qw(croak);
use JSON;
=head1 NAME
MozRepl::Plugin::LinkExtor - Extract "a" and "link" elements.
=head1 VERSION
ver
Data::Dump qw(dump);
my $repl = MozRepl->new;
$repl->setup({ plugins => { plugins => [qw/JSON OpenNewTab LinkExtor/] } });
$repl->open_new_tab({ url => "http://search.cpan.org/", selecte
cute {
my ($self, $ctx, $args) = @_;
croak("Please include MozRepl::Plugin::JSON") unless ($ctx->can("json"));
my $params = {};
$params->{repl} = $ctx->repl;
$params->{all} = ($
1 = $fb->{uid})");
## Get results in manageable form:
use JSON::Syck; # or whatever...
$fb->format = 'JSON';
my $arrayref = JSON::Syck::Load $fb->query("...");
=head1 DESCRIPTION
WWW::Faceb
le with SQL, this may be a
more comfortable interface. Results are currently returned in the raw
JSON or XML format, but more palatable options may be available in the
future.
=cut
use URI::Escape;
{secret} = $self->{private};
my $resp = $self->_request_nofail('auth.createToken', format => 'JSON');
$self->{auth_token} = eval $resp->decoded_content;
}
sub _get_session
{
my $self = sh
lugin::Location;
use strict;
use warnings;
use base qw(MozRepl::Plugin::Base);
use JSON::Any qw(XS DWIW Syck JSON);
=head1 NAME
MozRepl::Plugin::Location - Dump window.location object as possible.
$self->process('execute', $params);
my $result = $ctx->execute($command);
return JSON::Any->new->jsonToObj($result);
}
=head1 AUTHOR
Toru Yamaguchi, C<< <zigorou@cpan.org> >>
=head1 BUGS
epl::Plugin::Location
__DATA__
__execute__
(function(all) {
function getLocationAsJSON(tWindow) {
var json = {};
for (var p in tWindow.location) {
var type;
try {
typ
ntent types provided by the base class are:
[] ?format=xml or Accept: application/xml
[] ?format=json or Accept: text/javascript
[] ?format=html or Accept: text/html
HTML will be returned if the req
use XML::Dumper; import XML::Dumper; "; ## Conditional Output format: XML
eval "use JSON; import JSON; "; ## Conditional Output format: JavaScript Object Notation
our( $VERSION ) = '0.5
if (-f $INC{"JSON.pm"})
{
$this->{mimetype_mapping}->{json} = "text/javascript"; ## Support: ?format=json
$this->format( "text/javascript",
\&REST::Resource::format_json,
"Re
e CPAN::WWW::Testers;
use DateTime;
use DBI;
use File::Copy;
use File::stat;
use File::Slurp;
use JSON::Syck;
use LWP::Simple;
use Parse::BACKPAN::Packages;
use Path::Class;
use Template;
use Storable
ile( $directory, 'show', $distribution . ".json" );
print "Writing $destfile\n";
overwrite_file( $destfile->stringify,
_make_json_distribution( $distribution, \@reports ) )
-' . $entry->{version};
push @yaml, $entry;
}
return Dump( \@yaml );
}
sub _make_json_distribution {
my ( $dist, $data ) = @_;
my @data;
foreach my $test (@$data) {
Authentication::Credential::AOL;
use strict;
our $VERSION = '0.02';
use UNIVERSAL::require;
use JSON::Any;
sub setup {
my $c = shift;
my $config = $c->config->{authentication}->{aol} ||= {}
getInfo");
$uri->query_form(
devId => $config->{devId},
f => 'json',
# referer needs to be an actual Referer: header, but since
# we do redi
ailure: HTTP error " . $res->status_line);
return;
}
my $data = JSON::Any->jsonToObj($res->content);
unless (($data->{response}->{statusCode} || '') eq '200') {
use Carp;
our $HAVE_JSON_SYCK;
eval { require JSON::Syck; $HAVE_JSON_SYCK = 1 };
eval { require JSON } unless $HAVE_JSON_SYCK;
Carp::croak("JSON::Syck or JSON required to use " . __PA
CKAGE__) if $@;
*_parse_json =
$HAVE_JSON_SYCK ? sub { JSON::Syck::Load($_[1]) }
: sub { JSON::jsonToObj($_[1]) };
}
sub new {
my $class = shift;
my %p
my %query = (
app_key => $self->app_key,
v => $self->ver,
format => 'json',
token => $user->token,
t => time,
);
$query{sig} = $self->calc_sig(\%qu
e strict;
use warnings;
our $VERSION = '0.01';
use HTTP::Request::Common;
use HTTP::Date ();
use JSON::Any;
use POE qw( Component::Client::HTTP );
use URI;
sub spawn {
my($class, %args) = @_;
0,OBJECT];
my $req = HTTP::Request::Common::POST(
$heap->{args}->{apiurl} . '/update.json',
[ status => $status ],
);
$req->authorization_basic($heap->{args}->{username},
@_[KERNEL,HEAP,ARG0,OBJECT];
my $uri = URI->new($heap->{args}->{apiurl} . '/friends_timeline.json');
$uri->query_form(since => HTTP::Date::time2str($heap->{since})) if $heap->{since};
$he
se strict;
use warnings;
use v5.8.8;
use Moose;
use LWP::UserAgent;
use HTTP::Request;
use JSON::Syck;
$JSON::Syck::ImplicitUnicode = 1;
our $VERSION = '0.0.1';
has url_root => ( is => 'rw', isa =>
lf);
my $id = shift;
return _get("@{[$self->url_root]}/=/model/@{[$self->model]}/id/${id}.json");
}
sub update {
my $self = shift;
$self = $self->new unless ref($self);
my $id = s
%$attributes };
_ua()->post(
"@{[$self->url_root]}/=/action/update@{[$self->model]}.json",
$orig
);
return {};
}
sub create {
my $self = shift;
my $attributes =
structures.
There are modules or encodings that do support arbitrarily complex
data structures. JSON, YAML and Data::Dumper all have their own
way of encoding complex structures. But then to pass t
ty of XForms.
Another benefit is that sparse data can be represented in a more
compact form than JSON or YAML are able to provide. However, complex data
with long key names will be more verbose as t
ccessor::Fast);
use Carp;
use CGI;
use URI;
use LWP::UserAgent;
use Digest::MD5 qw(md5_hex);
use JSON;
our $VERSION = '0.50';
__PACKAGE__->mk_accessors(qw/
appid secret userhash appdata timeout
my $WSLOGIN_PREFIX = 'https://api.login.yahoo.com/WSLogin/V1/';
my $JSON_RPC_ENDPOINT = 'http://mail.yahooapis.com/ws/mail/v1.1/jsonrpc';
sub new {
my ($class, %param) = @_;
croak('appid and
e_jsonrpc_call {
my ($self, $method, $params) = @_;
if (!$self->_get_access_credentials) {
return 0;
}
my $thecall = { params => $params, method => $method };
my $jsoncl
:Element::Convert;
my $tree = HTML::TreeBuilder->new_from_content($html);
# Search for some JSON-encoded meta-data embedded in the document and extract it:
my $element = $tree->look_down(...);
arkdown} = \&Text::Markdown::markdown unless $@ };
1 and do { eval { require JSON }; $PARSE_FUNC{JSON} = \&JSON::jsonToObj unless $@ };
1 and do { eval { require YAML::Syck }; $PARSE_FUNC{YAML}
$EXTRACT_FUNC{YAML} = \&_extract_YAML;
sub _extract_JSON { return $PARSE_FUNC{JSON}->(_as_raw_HTML shift) }
$EXTRACT_FUNC{JSON} = \&_extract_JSON;
sub _extract_markdown { return HTML::TreeBuilder->
Jan 23, 2007 - Internalized XML resources. This is 1.00RC1
# 0.99_13 : Feb 11, 2007 - Initial JSON support + initial UploadMeter object in JavaScript
# 0.99_14 : Feb 15, 2007 - Fixed config issu
ortable; that's one of the reasons we support it
# Although I expect 95% of users to use the JSON response, those same 95%
# of the users are going to be using the bundled JS code, or forkin
| $currenttime;
# JSON response
if ($format=~/^json$/i) {
# Hardcode object for now. No need to require YAML or YAML::Syck as prereq
my $json=sprintf('{"meter_id":"%s"
ript objects to help quickly create
a customized GUI interface for Apache::UploadMeter using the JSON meter type
=head1 DOM, JavaScript and Cascading StyleSheet rules
Although we aim to give ma
you're using
MeterType JSON, this will be embedded in your JavaScript as I<meter_id>. The
third parameter is the URL of the meter-status URL. If you're using
MeterType JSON, this will be embedded
ache2::RequestIO ();
use Apache2::Response ();
use Apache2::Const -compile=>qw(:common);
sub json_popup {
my $r = shift;
$r->content_type("text/html");
$r->set_etag();
return
ache2::RequestIO ();
use Apache2::Response ();
use Apache2::Const -compile=>qw(:common);
sub json_css {
my $r = shift;
$r->content_type("text/css");
$r->set_etag();
return Apa
port, json) {
this.each(function(responder) {
if (typeof responder[callback] == 'function') {
try {
responder[callback].apply(responder, [request, transport, json]);
{
var state = Ajax.Request.Events[readyState];
var transport = this.transport, json = this.evalJSON();
if (state == 'Complete') {
try {
this._complete = true;
'on' + (this.success() ? 'Success' : 'Failure')]
|| Prototype.emptyFunction)(transport, json);
} catch (e) {
this.dispatchException(e);
}
if ((this.getHeader(