format => 'Text'); # uses Tool::Bench::Report::Text
$bench->report(format => 'JSON'); # uses Tool::Bench::Report::JSON
By using class names you can build your own report simply, see
L<Tool::Bench:
L::TreeBuilder;
use LWP::UserAgent;
use HTTP::Cookies;
use XML::Twig;
use Carp 'croak';
use JSON 'decode_json';
our $VERSION = 'v0.3.7';
=head1 NAME
WWW::Fimfiction - CRUD tasks for fimfiction.net
@_;
my $res = $self->_get("http://www.fimfiction.net/api/story.php?story=$id");
return decode_json($res->decoded_content)->{story};
}
=head1 AUTHOR
Cameron Thornton E<lt>cthor@cpan.orgE<gt>
=he
arnings;
package CouchDB::Utils::App::Command::dump;
use App::Cmd::Setup -command;
use URI;
use JSON::XS;
use File::Path qw(mkpath);
use File::Spec::Functions qw(rel2abs catdir catfile);
use AnyEven
sub execute {
my ($self, $opt, $args) = @_;
## this will be used to pretty format json
my $json = JSON->new->allow_nonref->pretty;
my $name = $args->[0]; ## database name
## unspecified
=> $start, ids => \@ids };
}
## pretty json formating makes it easier to edit the docs once
## they are on the file system
my $pretty_doc = $json->encode($doc);
_dump(catfile($doc_dir,'do
package Catalyst::TraitFor::Controller::jQuery::jqGrid::Search;
use 5.008;
use Moose::Role;
use JSON;
our $VERSION = '0.02';
my %qOp = (
'eq' => { pre => '', post => '', op => '=', },
{} unless $params->{_search} eq 'true';
if ( $params->{filters} ) {
return _complex_search( JSON->new->decode( $params->{filters} ) );
}
elsif ( $params->{searchField} ) {
# Simple sear
used to page
through data obtained from a back-end database. Ajax calls to the back-end
retrieve JSON data. See L<http://www.trirand.com/blog/>
This module provides a helper function to translate th
ct;
use warnings;
package CouchDB::Utils::App::Command::load;
use App::Cmd::Setup -command;
use JSON;
use MIME::Base64;
use File::Basename;
use File::Slurp qw(read_file);
use File::Spec::Functions q
$uri->port($opt->{port});
$uri->path($name);
}
my $db = couchdb($uri->as_string);
my $json = JSON->new->allow_nonref->pretty;
my @docs;
opendir (my $dh, $path) || die $!;
while (my $f = r
my $doc_path = catfile($path, $id, 'doc');
open DOC, ">$doc_path" or die $!;
print DOC $json->encode($doc);
close DOC;
} elsif ($load->{error}) {
warn "$load->{id} $load->{error}: $
' --file 't/01-works.t' --count 3 --format JSON
=head1 TODO
needs docs
=cut
die qx{perldoc $0} unless @ARGV;
my ($count,$format,$interp,$file) = (1,'JSON'); #supply defaults;
my $opt = GetOptions
FATAL => 'all';
use Carp 'croak';
use Digest::SHA qw(sha256_hex);
use LWP::UserAgent;
use JSON qw(decode_json);
our $VERSION = '0.04';
my $client_id;
my $client_secret;
my $scope = "";
my $github_
get("https://api.github.com/user?access_token=$acc");
my $json = decode_json($jresp->decoded_content);
session 'github_user' => $json;
session 'github_access_token' => $acc;
#session 'logg
=> sub{$naptime = rand(10)},
teardown => sub{$naptime = 1},
},
);
$bench->run(3);
print $bench->report(format => 'JSON');
original data.
There are several well-known serialization method, such as L<Data::Dumper>,
L<JSON>, L<YAML>, L<PHP::Serialization>, L<Data::DumpXML>, etc. Each of them
has different benefits and
its. You should read their documents
for more information.
My favorite one is L<JSON>. It will try to use L<JSON::XS> when availible.
This one is both efficient and simple. Though you can only st
lessed object,
tied data, nor references that refer to the same variable or cyclic references (L<JSON>
will extract them independently and completely).
=item base64
It's not allowed to use all
nt::Twitter;
use strict;
use warnings;
use utf8;
use 5.008;
our $VERSION = '0.64';
use Carp;
use JSON;
use URI;
use URI::Escape;
use Digest::SHA;
use Time::Piece;
use AnyEvent::HTTP;
use HTTP::Reques
;
our %RESOURCE_URL_BASE = (
'1.0' => 'http://api.twitter.com/1/%s.json',
'1.1' => 'https://api.twitter.com/1.1/%s.json',
);
sub new {
my ($class, %args) = @_;
$args{api_version}
my $cb = pop;
my ($self, $endpoint, $params) = @_;
my $type = $endpoint =~ /^http.+\.json$/ ? 'url' : 'api';
$self->request($type => $endpoint, method => 'GET', params => $params, $cb
nsole qw(format_pretty);
use Data::Dumper;
use AI::MicroStructure::Cache;
use WWW::Wikipedia;
use JSON::XS;
use Statistics::Basic qw(:all);
our $VERSION = '0.01';
our $supports = {};
our $scale = 1;
qx_nonblock);
my $micosense = qx_nonblock("micro-sense $next")->recv;
my $sense = JSON::XS->new->pretty(1)->decode($micosense);
delete($sense->{rows}->{search});
only to retrieve prerequisites
=head3 L<GraphViz>
=head2 Only necessary if you want JSON graphing
=head3 L<JSON::XS>
=head1 AUTHOR
Nathan Glenn <garfieldnate@gmail.com>
=head1 COPYRIGHT AND LICE
./generate_jsapi > app.api.js
use MyApp::Introspect;
use JSON;
my $classes = {};
my $json = JSON->new->allow_blessed->convert_blessed->pretty([1]);
my $intros
ields) = each(%{$classes})) {
$namespace =~ s/::/./;
my $objects = $json->encode($fields);
chomp $objects;
print "$namespace = $objects;
t::Scripts::tweet;
{
$Hubot::Scripts::tweet::VERSION = '0.1.3';
}
use strict;
use warnings;
use JSON::XS;
sub load {
my ( $class, $robot ) = @_;
$robot->hear(
qr/https?:\/\/(mobile\
ps://api.twitter.com/1/statuses/show/'
. $msg->match->[1]
. '.json' )->get(
sub {
my ( $body, $hdr ) = @_;
r
^2/ );
print "$body\n" if $ENV{DEBUG};
my $tweet = decode_json($body);
$msg->send("$tweet->{user}{screen_name}: $tweet->{text}");
erAgent;
use JSON;
# default options
use constant DEFAULT_USER_AGENT => 'Mozilla/5.0';
use constant DEFAULT_LANG => 'en-US';
use constant BASE_URL => 'http://imdbapi.org/?type=json';
use Obje
earch($options);
if ( $response->is_success ) {
my @results;
for ( @{ decode_json( $response->content ) } ) {
my $result = WebService::IMDBAPI::Result->new( %{$_} );
nse->is_success ) {
my $result = WebService::IMDBAPI::Result->new(
%{ decode_json( $response->content ) } );
return $result;
}
else {
die $response->status
();
use constant NAME => 'OMDB';
use constant PLOT => 'short';
use constant RESPONSE => 'json';
sub new {
my $class = shift;
my $args = shift;
my $self = $class->SUPER::new($ar
# [ { name => 'foo', href => 'bar' }, ]
$c->render_json( $results );
} => "$object/autocomplete");
}
}
o '["help"]' > hubot-scripts.json
$ hubot
hubot> hubot help
hubot> exit
=head1 DESCRIPTION
=head2 CONFIGURATION
describe scripts name to F<hubot-scripts.json>
example)
[
"he
SCRIPTION
L<Pushwoosh|http://www.pushwoosh.com/> is a push notification service which
provides a JSON API for users of its premium account. This module provides a
simple Perl wrapper around that API.
the possible error codes.
=back
=cut
our $VERSION = '0.02';
use Carp;
use Furl;
use JSON qw(from_json to_json);
use Params::Validate qw(validate validate_with validate_pos :types);
use Try::Tiny;
@_,
{ app_code => 1,
api_token => 1,
api_url => { default => 'https://cp.pushwoosh.com/json/1.3' },
furl => 0,
error_mode => { default => 'croak' },
}
);
$args{furl} ||= Furl
ror in the text, this method will return empty list), See SYNOPSIS. you can easily convert AoH to JSON or XML.
=head1 CAUTION
I'm afraid we don't have a good open source korean spell checker. but th