ilms <wilms@cs.umn.edu>';
$VERSION = 0.11;
use warnings;
use strict;
use LWP::UserAgent;
use JSON::Any;
=head1 NAME
Net::Digg - Quickly consume and interface with the Digg API.
=head1 SYNOPSIS
'http%3A%2F%2Fsearch.cpan.org%2Fdist%2FNet-Digg' unless defined $conf{appkey};
$conf{type} = 'json' unless defined $conf{type};
$conf{ua} = LWP::UserAgent->new();
$conf{ua}->agent($conf{us
dle_args($queryargs);
my $req = $self->{ua}->get($url);
return ($req->is_success) ? JSON::Any->jsonToObj($req->content) : undef;
}
=pod
=head2 get_popular_stories (\%params)
Given
=over
it button"
=item return_format=>(keyonly|text|json): the type of output at submission time (default is keyonly, but a text key=value perl line, but json should also be possible)
=item form_name=>str
key();
}elsif($retformat eq 'text'){
$ret="key=".$self->key()."\n";
}elsif($retformat eq 'json'){
$ret='not yet...';
}else{
$query->header(-type=>'text/plain');
die "unknown retu
rollers.
=cut
use base qw(Solstice::Controller);
use strict;
use warnings;
use 5.006_000;
use JSON;
use Solstice::View::Remote;
use Solstice::ButtonService;
use Solstice::Session;
use Solstice::CG
#prepare the js data
my $data = param('solstice_remote_data');
my $json = JSON->new();
$data = $json->jsonToObj($data);
#Okay, what controller do we run?
my $config = Solstice
e $vars->{'_froody_type'};
$self->type($type);
if ($type and $type eq 'json') {
$self->callback( delete $vars->{"_json_callback"} );
}
$self->params($vars);
return $self;
}
=item get
, 1 );
$vars{ $pname } = $value;
}
}
if ($type and $type eq 'json') {
$self->callback( delete $vars{"_json_callback"} );
}
$self->params(\%vars);
return $self;
}
=back
=
::Response;
use Froody::Logger;
my $logger = get_logger("froody.server");
use Froody::Renderer::json;
# XXX: move down to autoload when doing autodetect
eval q{
use Apache::Constants;
use F
ts the header for a type of server.
=cut
my $h4t = {
xml => "text/xml; charset=utf-8",
json => 'text/json',
};
sub content_type_for_type {
my $class = shift;
my $type = shift;
unless (@
or::Chained::Fast );
__PACKAGE__->mk_accessors(qw( endpoint ));
use LWP::UserAgent;
use JSON::XS qw( from_json );
use HTTP::Request::Common;
use Encode qw( encode_utf8 );
=head1 ATTRIBUTES
=over
=
{ $_[0] } : @_;
# we want json
$args{_type} = "json";
my $response = $self->call_raw($method, %args);
# parse as Frooy/JSON response
my $data = eval { from_json( $response ) };
unless (r
defined $res;
}
=head1 PREREQUISITES
This module uses Net::Twitter, so you'll need that (and JSON::Any).
You'll also need Net::Social.
=head1 CAVEATS
The 'friends' API method only returns the l
## no critic;
} ## no critic
}
1; # keep require happy.
__END__
=pod
=for stopwords YAML JSON CPAN Solem Gaal Yahas pre namespace
=head1 NAME
Class::Plugin::Util - Utility functions for sup
ty to export data.
Right now you need support for exporting to a list of formats, let's say YAML, JSON and XML,
As there are several implementations of YAML on CPAN you want to load the best module t
ST_OF_JSON_HANDLERS = qw(
MyApp::Export::JSON::Syck
MyApp::Export::JSON::PC
MyApp::Export::JSON
);
my %FORMAT_TO_HANDLER = (
'JSON' =>
package Template::Plugin::deJSON;
=head1 NAME
Template::Plugin::DeJSON - de-JSONify a JSON string
=head1 SYNOPSIS
[%
USE deJSON;
hash = deJSON.deJSON(json_string);
FOREACH field=ha
IPTION
Well, I needed this. I had JSON string things flying around between servers,
and passed into templates. (If you must know, objects were stringified using
JSON, and bit-shifted around the world
thing a bit more useful.
So it takes a JSON string, and gives you back a hash. Or me. It gives it back
to me. YMMV.
It also copes with JSON strings within JSON strings, returning a nice data
structu
package WWW::Metaweb;
use 5.008006;
use strict;
use warnings;
use JSON::XS;
use LWP::UserAgent;
use URI::Escape;
use HTTP::Request;
use Carp;
# debugging
use Data::Dumper;
our $VERSION = '0.02';
o
lread',
write_uri => '/api/service/mqlwrite',
trans_uri => '/api/trans',
pretty_json => 1 );
my $query = {
'/type/object/creator' => undef,
cover_appearances => [{
type
uery, 'json');
print $result;
The complicated way:
$mh->add_query('read', $query);
$mh->send_envelope('read')
or die $WWW::Metaweb::errstr;
my $result = $mh->result('read', 'json');
p
:JSONLikePerl;
use 5.008006;
use strict;
use warnings;
use Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw();
our @EXPORT_OK = qw(jsonlp_fetch jsonlp_replace jsonlp_insert jsonlp_quote jsonl
_TAGS = (standard => [qw(jsonlp_fetch jsonlp_replace jsonlp_insert jsonlp_quote jsonlp_unquote)]);
our $VERSION = 0.01;
=head1 NAME
WWW::Metaweb::JSONLikePerl - Access a JSON string like a Perl stru
cture
=head1 SYNOPSIS
use strict;
use WWW::Metaweb::JSONLikePerl qw(:standard);
my json = qq({
"cover_appearances": [
{
"part_of_series": "Runaways",
> 'text/javascript',
src => qr{http://twitter\.com/statuses/user_timeline/[0-9A-Za-z\-_]+\.json\?callback=twitterCallback2&count=\d+},
}},
{ type => 'end', name=>'script' } ],
[
> 'text/javascript',
src => qr{http://twitter\.com/statuses/user_timeline/[0-9A-Za-z\-_]+\.json\?callback=twitterCallback2&count=\d+},
}},
{ type => 'end', name=>'script' } ],
]);
package Socialtext::Resting::RSS;
use strict;
use warnings;
use Carp qw/croak/;
use JSON;
use XML::RSS;
use Text::Diff;
use File::Path qw/mkpath/;
=head1 NAME
Socialtext::Resting::RSS - Create rss f
my $json_text;
{ local $/; $json_text = <$fh> }
close $fh;
my $json = jsonToObj($json_text);
$cache{$json->{page_id}} = $json;
print " Loaded $json->{page_
}";
open(my $fh, ">$filename") or die "Can't write $filename: $!";
print $fh objToJson($new->{$p});
close $fh or die "Can't write $filename: $!";
}
# Pages will never
use warnings;
use strict;
use base qw(Class::Accessor);
use URI::Escape;
use LWP::UserAgent;
use JSON::XS;
use Metaweb::Result;
__PACKAGE__->mk_accessors(qw(
username
password
server
- any other website built on the Metaweb platform.
The Metaweb Query Language (MQL) is based on JSON and query-by-example.
The MQL and API documentation can be found on the Freebase website in
the d
# all people!
});
The query is a a Perl data structure that's converted to JSON using the
L<JSON::XS> module's C<to_json()> method. The MQL envelope will
automatically be put around the query, usi
);
property plconfig => isa_Object('Config::PlConfig');
property dumper => isa_String('JSON');
my $GLOBAL_AUTOSAVE = 0;
my %DUMPER = (
'YAML' => sub {
require
return XML::Simple::XMLout(@_);
},
'JSON' => sub {
require JSON::Syck;
return JSON::Syck::Dump(@_);
},
);
sub write_key {
getopts('c:j:h:t:', \%opts);
my $cfg = Config::Simple->new($opts{'c'});
my %args = ('exhibit_json' => $opts{'j'},
'exhibit_html' => $opts{'h'},
'tags' => $opts{'t'});
lt B<name> argument is "__report". The default B<min_level> argument
is "info".
=back
=cut
use JSON::Any;
use IO::AtomicFile;
use File::Basename;
=head1 PACKAGE METHODS
=cut
=head2 __PACKAGE__->
the I<flickr.photos.search>
API method and :
=over 4
=item * B<exhibit_json>
String. I<required>
The path where Exhbit JSON data should be written to disk.
=item * B<exhibit_html>
String. I<requ
getopts('c:j:h:t:', \%opts);
my $cfg = Config::Simple->new($opts{'c'});
my %args = ('exhibit_json' => $opts{'j'},
'exhibit_html' => $opts{'h'},
'tags' => $opts{'t'});
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.
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