t;
use warnings;
use base qw/Class::Accessor::Fast/;
use XML::Simple;
use UNIVERSAL::require;
use JSON::XS ;
use Time::HiRes;
our $VERSION = '0.02';
__PACKAGE__->mk_accessors(qw/data content error t
get_XML {
my $s = shift;
return $s->{content};
}
sub get_JSON {
my $s = shift;
my $data = $s->get();
return JSON::XS->new->utf8->pretty(1)->encode( $data );;
}
1;
=head1 NAME
=> 'stickam' } ) ) {
print Dumper $api->get();
print $api->get_XML();
print $api->get_JSON();
}
else {
print $api->error ;
}
=head1 DESCRIPTION
Perl implementation of Stickam API.
0.9.x+
#
package FreeMED::Relay;
use LWP::UserAgent;
use HTTP::Request::Common;
use JSON; # objToJson(), jsonToObj()
use HTTP::Cookies;
use vars qw{ $VERSION };
BEGIN {
$VERSION = '0.2.2';
}
su
= {};
bless $self, $class;
$self->{'debug'} = $debug;
$self->_init();
$JSON::UnMapping = 1;
$JSON::QuotApos = 1;
$JSON::BareKey = 1;
return $self;
}
sub set_credentials {
my $self = shift;
ame'} ];
} else {
my $json = objToJson( $param );
print "param = $param, count = $count, json = $json\n" if $self->{'debug'};
$p{"param${count}"} = ($json ? $json : $param );
$count++;
er_page => 2 } ) ) {
print Dumper $api->get();
print $api->get_XML();
print $api->get_JSON();
}
else {
print $api->error ;
}
=head1 METHOD
=head2 uri
=head1 SEE ALSO
http://labs
=> 170159586 } ) ) {
print Dumper $api->get();
print $api->get_XML();
print $api->get_JSON();
}
else {
print $api->error ;
}
=head1 METHOD
=head2 uri
=head1 SEE ALSO
http://labs
er_page => 2 } ) ) {
print Dumper $api->get();
print $api->get_XML();
print $api->get_JSON();
}
else {
print $api->error ;
}
=head1 METHOD
=head2 uri
=head1 SEE ALSO
http://labs
e=>'stickam' } ) ) {
print Dumper $api->get();
print $api->get_XML();
print $api->get_JSON();
}
else {
print $api->error ;
}
=head1 METHOD
=head2 uri
=head1 SEE ALSO
http://labs
=> 'stickam' } ) ) {
print Dumper $api->get();
print $api->get_XML();
print $api->get_JSON();
}
else {
print $api->error ;
}
=head1 METHOD
=head2 uri
=head1 SEE ALSO
http://labs
ipt data structure. This has all been
# recently (7/24/05) modified to use JSON notation:
# http://www.crockford.com/JSON/index.html
sub _as_javascript {
my ($self, $data) = @_;
my $packet;
f->resourceHooks(
qr{/parts/(\d+)} => {
GET => {
'text/json' => 'get_json',
'text/xml', => 'get_xml',
'text/xml' => 'get_html',
"$code $message");
# send header
$r->content_type("text/plain");
# send JSON document with score and other results
$r->send_http_header();
$r->print(<<"END");
testing.
The response consists of an HTTP response code and status message in
the header, and a JSON representation of the code, message, and score
in the body. If a passphrase is deemed to weak vi
end classdoc
=cut
package Pod::Classdoc::Project;
use Pod::ProjectDocs;
use Pod::Classdoc;
use JSON;
use Exporter;
use base('Exporter');
@EXPORT = ('renderProject');
use strict;
use warnings;
o
agers\s*=\s*([^\n]+)\n/);
$list = substr($list, 0, -1) if (substr($list, -1) eq ';');
$list = jsonToObj($list);
my $mans = $list->[0];
die "Unrecognizable project index\n"
unless ($mans->{de
o use something like L<JSON>
or L<JSON::XS>:
my $w1 = new WebService::CRUST(format => [ 'JSON', 'objToJson', 'jsonToObj' ]);
my $w2 = new WebService::CRUST(format => [ 'JSON::XS', 'decode', 'enco
also be a coderef, so for instance:
my $w = new WebService::CRUST(
format => [ 'JSON::Syck', sub { JSON::Syck::Load(shift) } ]
);
$w->get($url);
Formatter classes are loaded dynamically
package Geo::Google::Location;
use strict;
use warnings;
use Data::Dumper;
use URI::Escape;
use JSON;
use Geo::Google;
our $VERSION = '0.04-rc3';
use constant FMT => <<_FMT_;
<location infoStyle="%s"
toJSON {
my $self = shift;
my $json = new JSON (barekey => 1);
# Construct the shell of a new perl data structure that we
# can pass off to the JSON module for rendering to a string
my $preJSON
= Geo::Google::_JSONrenderSkeleton();
# Fill the perl data structure with information from this
# location
$preJSON->{"form"}->{"l"}->{"near"} = $self->title();
$preJSON->{"form"}->{"q"}->{"q"} =
Individual segments are used in Google Maps as
HTML with JavaScript inside a JSON response from the server.
The JSON structure used by Google Maps doesn't actually contain
segments. They are im
pl::Load/] } });
$repl->repl_load({
uri => q|http://json.org/json.js|
});
print $repl->execute("String.prototype.toJSONString;");
=head1 DESCRIPTION
Add repl_load() method to L<Mo
toJSON {
my $self = shift;
my $json = new JSON (barekey => 1);
# Construct the shell of a new perl data structure that we
# can pass off to the JSON module for rendering to a string
my $preJSON
= Geo::Google::_JSONrenderSkeleton();
# Fill the perl data structure with information from this
# location
my @locations = $self->locations();
$preJSON->{"form"}->{"l"}->{"near"} =
$location
eJSON->{"form"}->{"q"}->{"q"} = "from:" .
$locations[0]->title();
for (my $i=1; $i<=$#locations; $i++) {
$preJSON->{"form"}->{"q"}->{"q"} .= " to:" .
$locations[$i]->title();
}
$preJSON-
strStansDonutsXML = $stans->toXML();
# Export a location as JSON data to use with Google Maps
my $strRoscoesJSON = $roscoes->toJSON();
=head1 DESCRIPTION
Geo::Google provides access to the map
mentation.
=item JSON exporting is not exactly identical to the original Google
JSON response. Some of the Google Maps-specific data is discarded
during parsing, and the perl JSON module does not
allow for bare keys
while exporting to a JSON string. It should still be functionally
interchangeable with a Google JSON reponse.
=back
=head1 SEE ALSO
http://maps.google.com
http://www.goog
ference.
Specify except plugins you want to use.
$repl->load_plugins({ except_plugins => [qw/JSON/] });
=back
=cut
sub load_plugins {
my ($self, $args) = @_;
my @available_plugins = g
;
use JSON;
sub print_blog {
my $self = shift;
my $r = $self->{rester};
my $params = $self->load_config($r);
my $json = objToJson($params);
$json =~ s/'/\\'/g;
$json =~ s
#<script .+script>##;
return $self->render_template( { json_data => $json } );
}
1;
use warnings;
use base 'Blikistan::MagicEngine';
use Template;
use FindBin;
use URI::Escape;
use JSON;
sub render_template {
my $self = shift;
my $params = $self->{params} = shift || {};
pace_tags} ||= sub {
my $skip = shift || '';
$r->accept('application/json');
my $tags = jsonToObj($r->get_workspace_tags);
$tags = [
sort { $b->{page_count
};
my $r = $self->{rester};
$r->accept('application/json');
$r->json_verbose(1);
my $p = $self->{_page}{$page} = jsonToObj( $r->get_page($page) );
while ($p->{html} =~ s/<a hre