TP::
=item * Image::
=item * Inline::
=item * IO::
=item * IPC::
=item * JavaScript::, JS::, JSON::
=item * Jifty::
=item * Language::
=item * Lingua::
自然语言相关模块
=item * Log::
ggregate>, L<Test::Most>
=item * PERIGRIN L<http://search.cpan.org/~PERIGRIN/>
Chris Prather, L<JSON::Any>, L<Task::Kensho>
=item * PETDANCE L<http://search.cpan.org/~PETDANCE/>
Andy Lester, L<ack
接的文本($c->res->body),可以是 HTML(如 L<Catalyst::View::TT>), 可以是 RSS, 或者是 JSON 或其他的(如 Wx 等 GUI)。所有的输出都是经过 ->res->body 或 ->res->write, 最
View
View 是最常见的一种扩展,最常用的如 L<Catalyst::View::TT>, L<Catalyst::View::JSON>, TT::Alloy, PHP, Mason, Template::Declare, GraphViz, GD 等。所有的 View 扩展都基于 L<C
ter
{
my $class = $self->config->{Formatter}
|| __PACKAGE__ . '::Formatter::JSON';
$class->require or croak $@;
$self->formatter( $class->new( context => $self )
$fe->location( format => 'xml' ); # returns xml
my $loc = $fe->location( format => 'json' ); # returns json
# returns result on success. dies or returns undef on failure
my $return =
ate_location( "500 Third St., San Francisco, CA" );
# Find a location. Returns either xml or json
my $return = $fe->lookup_location( "Pensacola" );
=head1 ABOUT
Fire Eagle is a site that st
tion.
Options are passed in as a hash and may be one of
=over 4
=item format
Either 'xml' or 'json'. Defaults to 'xml'.
=back
=cut
sub location {
my $self = shift;
my %opts = @_;
m
$c->{'facebook'} = WWW::Facebook::API->new(
'desktop' => 0,
'format' => 'JSON',
'parse' => 1,
%{ $c->config->{'facebook'} || { } },
);
t::Plugin::CookiedSession;
use strict;
use warnings;
use Catalyst::Exception;
use Crypt::CBC;
use JSON::XS::VersionOneAndTwo;
use MIME::Base64;
use NEXT;
use base qw/Class::Accessor::Fast/;
our $VERSI
my $json = $c->_cookiedsession_cipher->decrypt($ciphertext_unbase64);
$session = decode_json($json);
$c->log->debug("CookiedSession: found cookie $name containing $json")
= $c->_cookiedsession_session;
my $json = encode_json($session);
my $ciphertext = $c->_cookiedsession_cipher->encrypt($json);
my $ciphertext_base64 = encode_base64
er(@_) } );
}
sub return_parser { die };
1;
__END__
=head1 SYNOPSIS
my $pfunc = get_parser('JSON', $filehandle, %opts);
while ($log = &$pfunc()) {
}
=head1 DESCRIPTION
Each format that we m
;
use Digest::SHA;
use JSON::XS;
use Storable;
__PACKAGE__->export_rule(qw/SELF_CODED SERIALIZE/);
sub SELF_CODED {
my ($method_name, $args) = @_;
our $ENCODER ||= JSON::XS->new->convert_ble
ssed(1);
local *UNIVERSAL::TO_JSON = sub { Storable::nfreeze \@_ };
my $json = $ENCODER->encode($args->[0]);
$args->[0] = Digest::SHA::sha1_base64($json);
return;
}
sub SERIALIZE {
, $args) = @_;
our $ENCODER ||= JSON::XS->new->convert_blessed(1);
local $^W = 0;
local *UNIVERSAL::TO_JSON = sub { Storable::nfreeze \@_ };
my $json = $ENCODER->encode($args);
$me
;
use 5.008008;
use strict;
use warnings;
{
use Carp;
use LWP::UserAgent;
use JSON qw( from_json );
use Unicode::Japanese;
}
my (
$USER_AGENT_ALIAS, $OUTPUT_TYPE_REGEX, $DEFAULT_
ml|perl|json ) \z}xms;
Readonly $DEFAULT_OUTPUT_TYPE => 'perl';
Readonly $MT_STR => "";
Readonly %RESPONSE_TYPE_FOR => (
json => 'json',
perl => 'json',
::decode($results);
return $results
if $self->{output_type} =~ m/(?: xml|json )/xms;
return from_json($results);
}
sub _build_url {
my $self = shift @_;
die "unbalanced args"
icJSON;
use Exporter;
@ISA = ('Exporter');
@EXPORT = qw();
our $VERSION = 0.05;
use strict;
use warnings;
use XML::LibXML;
use JSON::XS;
=head1 NAME
XML::GenericJSON - for turning XML into JSON,
SYNOPSIS
my $json_string = XML::GenericJSON::string2string($xml_string);
my $json_string = XML::GenericJSON::file2string($xml_filename);
XML::GenericJSON::string2file($xml_string,$json_filename);
ename,$json_filename);
=head1 DESCRIPTION
XML::GenericJSON provides functions for turning XML into JSON. It uses LibXML to parse
the XML and JSON::XS to turn a perlish data structure into JSON. The
my %args = @_;
my $json = $self->api_post( '/api/json/reviewrequests/new/', [%args] );
if ( !$json->{review_request} ) {
LOGDIE "create couldn't determine ID from this JSON that it got back from
server: " . Dumper $json;
}
$self->{rr} = $json->{review_request};
return $self;
}
sub fetch {
my $self = shift;
my $id = shift;
my $json = $self->api_get( '/api/json/reviewrequests/' . $
id );
$self->{rr} = $json->{review_request};
return $self;
}
sub fetch_all_from_user {
my $self = shift;
my $from_user = shift;
my $json = $self->api_get( '/api/json/reviewrequests/from/use
package WebService::ReviewBoard;
use strict;
use warnings;
use JSON::Syck;
use Data::Dumper;
use Log::Log4perl qw(:easy);
use HTTP::Request::Common;
use LWP::UserAgent;
use version; our $VERSION = q
rname";
my $password = shift or LOGCROAK "you must pass login a password";
my $json = $self->api_post(
'/api/json/accounts/login/',
[
username => $username,
password => $password
]
);
quest($request);
DEBUG "Got response:\n" . $response->as_string();
my $json;
if ( $response->is_success ) {
$json = JSON::Syck::Load( $response->content() );
}
else {
LOGDIE "Error fetching
CGI;
use JSON;
use Xpriori::XMS::Svc;
my $oCgi = new CGI();
my $sMethod = $oCgi->param('_method');
my $sConn = $oCgi->param('_connect');
my $raPrm = from_json($oCgi->param
cial API page, which seems to still be in beta.
=cut
use Carp;
use Digest::MD5 qw(md5_hex);
use JSON::Any;
use URI::Escape;
use WWW::Grooveshark::Response qw(:fault);
our @ISA = ();
=head1 CONSTR
in API call requests. May be blank. Defaults to
"json" so that the full default API root URL becomes
E<lt>http://api.grooveshark.com/ws/1.0/?jsonE<gt>.
=item I<agent>
Value to use for the C<User-
.0',
_query_string => $opts{query_string} || 'json',
_https => $opts{https} || 0,
_session_id => undef,
_json => new JSON::Any,
}, $pkg);
}
=back
=head1 DESTRUCTOR
ode
and message (in case of errors).
Internally, this class is just a C<bless>ed decoding of the JSON response, so
if you're too lazy or stubborn to familiarize yourself with this interface,
you may
t.EasyPlot(
"$args{type}",
@{[Jifty::JSON::objToJson( $args{options} )]},
\$("$chart_id"),
@{[Jifty::JSON::objToJson( $args{data} )]}
);
};
YAHOO.util.Event.onAvail
alar', 1, 'yes_no' ],
'xte_enable_fop', [ 'scalar', 1, 'yes_no' ],
'xte_enable_json', [ 'scalar', 1, 'yes_no' ],
'xte_enable_mxmlc', [ 'scalar', 1, 'yes_no' ]
[ 'scalar', 1, 'yes_no' ],
'xte_enable_fop',
[ 'scalar', 1, 'yes_no' ],
'xte_enable_json',
[ 'scalar', 1, 'yes_no' ],
'xte_enable_mxmlc',
[ 'scalar', 1, 'yes_no' ],
'xte_
json()
Returns true if output via XML::GenericJSON is enabled.
=cut
sub xte_enable_json {
my $self = shift;
if ( ( lc( $self->{start_xte} ) eq 'yes' )
and $self->{xte_enable_json
:GoogleViz;
use strict;
use warnings;
use base 'Jifty::Plugin::Chart::Renderer';
use Jifty::JSON 'objToJson';
=head1 NAME
Jifty::Plugin::Chart::Renderer::GoogleViz - chart renderer using Google Cha
l;
my $chart_class = $self->chart_class;
my $load_params = objToJson($self->load_params);
my $draw_params = objToJson($self->draw_params($args{options}));
my $callback_name = 'callback
value->hour,
$value->minute,
$value->second;
}
}
die "Can't handle the date '$value'";
}
return objToJson($value);
}
1;
ous HTTP requests.
It will work to serve a mini-cpan repository.
It has been used to create a JSON message-passing hub.
=head1 HISTORY
=over 8
=item 0.01
August 18-22, 2004. %CgiBin is not ye
t;
use 5.8.1;
our $VERSION = '0.04';
use Any::Moose;
has 'format' => (is => 'rw', default => 'json');
has 'discovery' => (is => 'rw');
has 'providers' => (is => 'rw', isa => 'ArrayRef', default =>
bed consumer
=head1 SYNOPSIS
use Web::oEmbed;
my $consumer = Web::oEmbed->new({ format => 'json' });
$consumer->register_provider({
url => 'http://*.flickr.com/*',
api => 'http:
=over 4
=item new
$consumer = Web::oEmbed->new;
$consumer = Web::oEmbed->new({ format => 'json' });
Creates a new Web::oEmbed instance. You can specify the default format
that will be used wh