ification, a simple data
interchange format better suited to low-level network communication than
JSON. See http://tnetstrings.org/ for more details.
use Text::TNetstrings qw(:all);
my $data = enc
{
# require JSON::PP;
# $benchmarks{'JSON::PP int'} = sub{JSON::PP::encode_json("9627")};
#} or warn "Unable to require JSON::PP";
eval {
require JSON::XS;
JSON::XS->import('encode_json');
my $arr
y = encode_json(["hello", 9627]);
my $bool = "[true]";
my $float = encode_json([3.14]);
my $hash = encode_json({"hello" => 9627});
my $int = encode_json([9627]);
my $null = encode_json([undef]);
ode_json(["hello"]);
$benchmarks{'JSON::XS int'} = sub {JSON::XS::decode_json($int)};
$benchmarks{'JSON::XS bool'} = sub {JSON::XS::decode_json($bool)};
$benchmarks{'JSON::XS float'} = sub {JSON::X
ziness, $language ) = ( 25, 50, 'Default' );
my( $CSV, $storable, $outfile, $infile, $text, $cx, $json, $debug, %argspec );
GetOptions( 'csv' => \$CSV,
'width=i' => \$col_width,
'storable'
s' => \$outfile,
'store=s' => \$infile,
'text' => \$text,
'cx' => \$cx,
'json' => \$json,
'debug:i' => \$debug,
'argspec=s' => \%argspec,
'fuzziness=i' => \$fuzzines
', 'sliding' => 0, 'inclusive' => 0 );
}
## Get busy.
my( @files ) = @ARGV;
if( $json ) { # The 'file' is the JSON string.
my @lines;
while( <> ) {
push( @lines, $_ );
}
@files = (
e JSON::PP;
$benchmarks{'JSON::PP'} = sub{JSON::PP::encode_json($structure)};
} or warn "Unable to require JSON::PP";
eval {
require JSON::XS;
$benchmarks{'JSON::XS'} = sub{JSON::XS::encode_json($
structure)};
} or warn "Unable to require JSON::XS";
eval {
require Convert::Bencode;
$benchmarks{'Convert::Bencode'} = sub{Convert::Bencode::bencode($structure)};
} or warn "Unable to require Conv
NAME
HTML::HTML5::Outline - implementation of the HTML5 Outline algorithm
=head1 SYNOPSIS
use JSON;
use HTML::HTML5::Outline;
my $html = <<'HTML';
<!doctype html>
<h1>Hello</h1>
<h2>World</
Morning</h1>
<h2>Vietnam</h2>
HTML
my $outline = HTML::HTML5::Outline->new($html);
print to_json($outline->to_hashref, {pretty=>1,canonical=>1});
=head1 DESCRIPTION
This is an implementation o
algorithm, as per
L<http://www.w3.org/TR/html5/sections.html#outlines>.
The module can output a JSON-friendly hashref, or an RDF model.
=head2 Constructor
=over
=item * C<< HTML::HTML5::Outline->
********************************
no Moose;
1;
__END__
=head1 NAME
Zenoss::Router::Process - A JSON/ExtDirect interface to operations on processes
=head1 SYNOPSIS
use Zenoss;
my $api = Ze
defaults and return content.
The documentation for this module was mostly taken from the Zenoss JSON API docs. Keep in mind
that their (Zenoss Monitoring System) programming is based around python,
de qw( decode_utf8 );
use File::Temp;
use Graph::Easy;
use IPC::Run qw( run binary );
use JSON qw( decode_json );
use Module::Load;
use Text::CSV_XS;
use Text::TEI::Collate::Diff;
use Text::TEI::Colla
( $xml_file ) )
}
$aligner->align( @manuscripts );
# Read from a JSON input.
@manuscripts = $aligner->read_source( $JSON_string );
$aligner->align( @manuscripts );
=head1 DESCRIPTION
Te
ay title for the collation output results, should those
results need a display title (e.g. TEI or JSON output).
=item B<language> - Specify the language module we should use from those
available in T
equire JSON::PP;
my $encoded = JSON::PP::encode_json($structure);
$benchmarks{'JSON::PP'} = sub{JSON::PP::decode_json($encoded)};
} or warn "Unable to require JSON::PP";
eval {
require JSON::XS;
my $encoded = JSON::XS::encode_json($structure);
$benchmarks{'JSON::XS'} = sub{JSON::XS::decode_json($encoded)};
} or warn "Unable to require JSON::XS";
eval {
require Convert::Bencode;
my $encode
********************************
no Moose;
1;
__END__
=head1 NAME
Zenoss::Router::ZenPack - A JSON/ExtDirect interface to operations on ZenPacks
=head1 SYNOPSIS
use Zenoss;
my $api = Zen
defaults and return content.
The documentation for this module was mostly taken from the Zenoss JSON API docs. Keep in mind
that their (Zenoss Monitoring System) programming is based around python,
yMQ::Trait::AMQP;
use Moose::Role;
use File::ShareDir;
use AnyEvent;
use AnyEvent::RabbitMQ;
use JSON;
use Try::Tiny;
use Carp qw(croak carp);
has host => (is => "ro", isa => "Str");
has port => (is
er}->method_frame->routing_key;
try { $self->topics->{$topic}->AnyMQ::Topic::publish(JSON::from_json($payload)) }
catch { croak "failed to republsih on $topic: $_" };
};
}
sub new
use strict;
use warnings;
use JSON;
use Text::TNetstrings qw(:all);
use Benchmark qw(cmpthese);
my $structure = {
'resources' => {
'license' => [
'http://opensource.org/licenses/mit-license.php'
y $tn = encode_tnetstrings($structure);
my $json = encode_json($structure);
print "TNetstrings (" . length($tn) . ")
$tn
JSON (" . length($json) . ")
$json
";
cmpthese(-10, {
'TNetstrings' => sub{d
ecode_tnetstrings(encode_tnetstrings($structure))},
'JSON' => sub{decode_json(encode_json($structure))},
});
package Redis::Dump::Restore;
use Moose;
use MooseX::Types::Path::Class;
use JSON;
with 'MooseX::Getopt';
use Redis 1.904;
# ABSTRACT: It's a simple way to restore data to redis-server based on re
}
}
}
}
sub _set_values_by_keys {
my $self = shift;
my %keys = %{ from_json( $self->file->slurp ) };
$self->_conn->flushall if $self->flushall;
foreach my $key ( ke
xt');
=head1 DESCRIPTION
It's a simple way to restore data to redis-server based on redis-dump (JSON).
=head1 COMMAND LINE API
This class uses L<MooseX::Getopt> to provide a command line api. The
t Dumper( \$dump->run );
=head1 DESCRIPTION
It's a simple way to dump data from redis-server in JSON format or any format
you want.
=head1 COMMAND LINE API
This class uses L<MooseX::Getopt> to pro
vity => '/activities/ID'
);
# transform our api dispatch above into an HTTPS request
# returns JSON decoded result or throws exception otherwise
sub _request {
my ($self, $api, $id, $args) = @_;
uccess and return $tx->res->json;
# we never get here, unless something went wrong
my $message = $tx->error;
$tx->res->json and do {
my $json_err = $tx->res->json->{error}->{message};
$
message = join ' ', $message => $json_err;
};
die "Error: $message";
}
sub new {
my $self = bless {}, shift;
croak "API key required" unless $_[0] and $_[0] eq 'key';
$self->key($_[1]);
kage Redis::Dump::Config;
use Moose;
use MooseX::Types::Path::Class;
with 'MooseX::Getopt';
use JSON;
use Redis 1.904;
# ABSTRACT: It's a simple way to dump and backup config from redis-server
our
} = $value;
}
return %cf;
}
sub _restore {
my $self = shift;
my %keys = %{ from_json( $self->restore->slurp ) };
foreach my $key ( keys %keys ) {
my $value = $keys{$key}
Dumper( \$dump->run );
=head1 DESCRIPTION
It's a simple way to dump config from redis-server in JSON format or any format
you want.
=head1 COMMAND LINE API
This class uses L<MooseX::Getopt> to pro
'.';
$dist_info = {};
if( -r ( $meta_file = File::Spec->catfile( $dist_root, 'META.json' ) ) or
-r ( $meta_file = File::Spec->catfile( $dist_root, 'META.yml' ) ) )
{
ta } = CPAN::Meta->load_file( $meta_file );
}
else
{
$log->warningf( "No META.json or META.yml file found, " .
"is '%s' a distribution directory?", $dist_root )
uild
./Build test
./Build install
=end readme
=head1 BOOTSTRAPPING WITH META.json/META.yml
Since the META.json/yml file is often generated with an abstract extracted
from the POD, and L<App::po
::Meta::Dynamic::Config is a L<Dist::Zilla> plugin that allows an author to
specify in the C<META.json> and/or C<META.yml> files produced by L<Dist::Zilla> that their
distribution performs some dynami
package Tribunais::TJES;
use strict;
use warnings;
use JSON;
use WWW::Mechanize;
use HTML::TreeBuilder::XPath;
use Path::Class;
use utf8;
sub new
{
my $class = shift;
my $self = {
_edNumP
my $json = { fases => \@items }; # cria hash com nome de $json, insere no hash uma key com nome de andamentos tendo o array @registros no value dessa key
my $string_json = to_json($json); #
encoda o hash com nome de $json em uma string no formato JSON, e atribui à var $string_json
return $string_json;
}
1;
__END__
=encoding utf8
=head1 NAME
Tribunais::TJES - Interface de co
package WWW::Yahoo::Smushit;
use strict;
use warnings;
use Moose;
use LWP::UserAgent;
use JSON;
our $VERSION = '0.03';
has _ua => (
is => 'rw',
lazy => 1,
required => 1,
d
my $json = JSON->new->allow_nonref;
my $resp = $json->decode($req->content);
return 1
if($self->_create_attrs_from_json($resp));
return 0;
}
sub _create_attrs_from_json {
m
y ($self, $json) = @_;
for (keys %{$json}) {
$self->meta->add_attribute($_, is => 'rw');
$self->$_($json->{$_});
}
$self->meta->make_immutable;
return 0
if not
package Tribunais::TRTES;
use strict;
use warnings 'all';
use JSON;
use WWW::Mechanize;
use HTML::TreeBuilder::XPath;
use utf8;
sub new
{
my $class = shift;
my $self = {
_tiponumer
my $json = { fases => \@items }; # cria hash com nome de $json, insere no hash uma key com nome de andamentos tendo o array @registros no value dessa key
my $string_json = to_json($json); #
encoda o hash com nome de $json em uma string no formato JSON, e atribui à var $string_json
return $string_json;
}
1;
__END__
=encoding utf8
=head1 NAME
Tribunais::TRTES - Interface de