#!/usr/bin/perl
use strict;
use JSON::XS;
use Web::Scraper;
use URI;
sub extract_url { (m!(http://\S*)!)[0] }
my $uri = URI->new( shift || "http://www.oembed.com/" );
my $scraper = scraper {
pr
(text(), 'Endpoint')]", api => [ 'TEXT', \&extract_url ];
};
result 'providers';
};
my @providers = grep { defined $_->{url} } @{ $scraper->scrape($uri) };
print encode_json(\@providers);
arams{'sUnit'} = "artist";
$hParams{'sFormat'} = (defined $hArgs{'format'} ? $hArgs{'format'} : "json");
$hParams{'hArgs'} = __getParams(\%hArgs);
return __getDataSet($self, \%hParams);
}
# getUs
hParams{'sUnit'} = "user";
$hParams{'sFormat'} = (defined $hArgs{'format'} ? $hArgs{'format'} : "json");
$hParams{'hArgs'} = __getParams(\%hArgs);
return __getDataSet($self, \%hParams);
}
# getAl
Params{'sUnit'} = "album";
$hParams{'sFormat'} = (defined $hArgs{'format'} ? $hArgs{'format'} : "json");
$hParams{'hArgs'} = __getParams(\%hArgs);
return __getDataSet($self, \%hParams);
}
# getTr
_res, matched_uri => $uri );
my $data;
if ($http_res->content_type =~ /json/) {
$data = $res->parse_json($http_res->content);
} elsif ($http_res->content_type =~ /xml/) {
ata = $res->parse_xml($http_res->content);
} else {
croak "Content-Type is not either JSON or XML: " . $http_res->content_type;
}
for my $key (keys %$data) {
if ($res->can
= $data->{$key};
}
}
$res;
}
sub parse_json {
my($self, $json) = @_;
require JSON::XS;
JSON::XS->new->decode($json);
}
sub parse_xml {
my($self, $xml) = @_;
requ
:Escape;
use LWP::UserAgent;
#use Carp;
our $VERSION = '0.40';
#http://search.twitter.com/search.json?q=<query>
sub Status {
my $self = shift;
#$self->set_user_agent("Net::Generatus-$VERSION (P
;
#Based heavily on Net::Twitter
$VERSION = "0.15";
use 5.005;
use strict;
use URI::Escape;
use JSON::Any 1.19;
use LWP::UserAgent 2.032;
use Carp;
sub new {
my $class = shift;
my %conf;
if ( sca
{ JSON::Any->jsonToObj( $self->{response_error} ) };
if ( !defined $response ) {
$response = {
request => undef,
error => "DIGITAL NZ RETURNED ERROR MESSAGE BUT PARSING OF THE JSON R
my $query = shift;
my $params = shift;
my $url = $self->{apiurl} . "records/v1.json/?";
$url .= 'api_key='. $self->{api_key};
$url .= '&search_text='. uri_escape($query);
d_call( %params )
Example:
mk_jQuery_method_call('ul.sf-menu', ['supersubs', [ 'json text' ]], ['superfish', [ 'json text' ]]);
=cut
sub mk_jQuery_method_call {
my $self = shift;
my $selec
act the author.
=head1 AUTHOR
Adam Kennedy E<lt>adamk@cpan.orgE<gt>
=head1 SEE ALSO
L<Mirror::JSON>, L<Mirror::CPAN>, L<YAML::Tiny>
=head1 COPYRIGHT
Copyright 2007 - 2009 Adam Kennedy.
This pro
5.006;
use strict;
use Mirror::JSON;
use vars qw{$VERSION @ISA};
BEGIN {
$VERSION = '0.90';
@ISA = 'Mirror::JSON';
}
sub filename {
return 'modules/07mirror.json';
}
1;
# Copyright 2007 - 2
RI> is an abstract base class for the mirror
auto-discovery modules L<Mirror::YAML> and L<Mirror::JSON>.
See their documentation for more details.
=head1 SUPPORT
Bugs should be reported via the CPA
=head1 AUTHOR
Adam Kennedy E<lt>adamk@cpan.orgE<gt>
=head1 SEE ALSO
L<Mirror::YAML>, L<Mirror::JSON>, L<Mirror::CPAN>
=head1 COPYRIGHT
Copyright 2007 - 2009 Adam Kennedy.
This program is free so
y;
use warnings;
use strict;
use Moose;
use DBI;
use DBIx::Simple;
use SQL::Script;
use JSON;
my $json = JSON->new->allow_blessed(1)->convert_blessed(1);
has app => qw/is ro isa App::PM::Announce r
$self = shift;
my $uuid = shift;
my %data = @_;
my $db = $self->db;
my $data = $json->encode( \%data );
$db->query( 'INSERT INTO event (uuid, data) VALUES (?, ?)', $uuid, $data
;
my $result = $self->fetch( $uuid ) or die "Couldn't find record for $uuid";
my $data = $json->encode( { %{ $result->{data} }, %data } );
$db->query( 'UPDATE event SET data = ? WHERE uui
use Carp ();
use Date::Parse ();
use File::Slurp ();
use HTTP::Date ();
use JSON::XS ();
use WWW::Mechanize ();
use constant BLOG_URL => q{http://blog.360.yahoo.com/blog
ername and password.
#
# $Id$
BEGIN { $| = 1 }
use strict;
use warnings;
use Getopt::Long;
use JSON::XS;
use WWW::Scraper::Yahoo360;
our $verbose;
our $debug;
sub debug {
if ($verbose) {
s;
debug("Reading all blog comments...");
my $comments = $y360->get_blog_comments($posts);
$blog_info->{comments} = $comments;
my $json = JSON::XS->new()->pretty;
print $json->encode($blog_info);
package Net::Mosso::CloudFiles::Container;
use Moose;
use MooseX::StrictConstructor;
use JSON::XS::VersionOneAndTwo;
has 'cloudfiles' =>
( is => 'ro', isa => 'Net::Mosso::CloudFiles', required =>
);
$url->query_param( 'prefix', $prefix );
$url->query_param( 'format', 'json' );
my $request = HTTP::Request->new( 'GET', $url,
[ 'X-Auth-Token' =
return undef unless $response->content;
my @objects;
my @bits = @{ from_json( $response->content ) };
return unless @bits;
foreach my $bit (@bits) {
ails.
=cut
our %BUGS = (
'not_dopplr_any_more' => {
'cuddled' => 1,
'json_response' => 1,
},
);
sub new {
my $class = shift;
my %params = @_;
$params{_u
f ($opts{_compat}->{json_response}) {
eval 'use JSON::Any';
die "You need to install JSON::Any to use JSON responses" if $@;
%values = %{JSON::Any->from_json($response->content
sish::CoreHelpers;
use Railsish::TextHelpers qw(camelcase);
use MIME::Base64;
use Crypt::CBC;
use JSON::XS;
sub dispatch {
my ($class, $request) = @_;
my $path = $request->request_uri;
m
_unbase64 = decode_base64($ciphertext_base64);
my $json = $cipher->decrypt($ciphertext_unbase64);
$session = decode_json($json);
}
return $session;
}
sub _store_session {
t::CBC->new(-key => "railsish", -cipher => "Rijndael");
my $json = encode_json($session);
my $ciphertext = $cipher->encrypt($json);
my $ciphertext_base64 = encode_base64($ciphertext, '');
rsion; our $VERSION = $Parley::VERSION;
use base 'Catalyst::Controller';
use Image::Magick;
use JSON;
use Image::Size qw( html_imgsize imgsize );
use Parley::App::Error qw( :methods );
# ~~~~~~~~~
my ($self, $c) = @_;
my ($return_data, $json);
my $fieldname = $c->request->param('fieldname');
$c->response->content_type('text/json');
$return_data->{old_value} = $c->request-
return_data->{updated} = 0;
$json = to_json($return_data);
$c->response->body( $json );
$c->log->info( $json );
return;
};
e->is_success();
if ($self->{output} eq "json" and eval {
require JSON::Any;
1;
}) {
my $result = $response->content();
my $j = JSON::Any->new;
my $data = $j->decode($result)
ss;
for(qw(request response controller action format params
session render render_json render_xml redirect_to)) {
*{"$caller\::$_"} = *{"$_"};
}
for (@Railsish::Contro
utf8($output));
}
use JSON -convert_blessed_universally;
sub render_json {
my %variables = @_;
my $json = JSON->new;
$json->allow_blessed(1);
my $out = $json->encode(\%variables);
$response->headers->header('Content-Type' => 'text/x-json');
$response->body( Encode::encode_utf8($out) );
}
use XML::Simple;
sub render_xml {
# still not write testing
my %variable
gs;
use Parley::Version; our $VERSION = $Parley::VERSION;
use base 'Catalyst::Controller';
use JSON;
use Proc::Daemon;
use Proc::PID::File;
use Parley::App::Error qw( :methods );
# there are ACL
= $person->get_columns;
push @results, \%data;
}
$c->response->body(
to_json(
{
ResultSet => {
person => \@results,
);
return;
}
sub roleSaveHandler :Local {
my ($self, $c) = @_;
my ($return_data, $json);
my ($person_id, $role_id, $value, $person);
$person_id = $c->request->param('person')