nvalid tunnel $tid");
} else {
$self->client_write_line($client, "201 $tid");
my $h = $t->to_json;
$self->client_write_line($client, "$_: $h->{$_}") for
sort keys %{$h};
$self->client_w
uted if the request accept header like prefers and accepts
# type 'application/json'.
sub myaction_JSON :Action { }
# Executed if the request accept header like prefers and accepts
xecuted if the request accept header like prefers and accepts
# type 'application/json'.
sub myaction_JSON :Action { }
# Executed if the request accept header like prefers and accepts
ir';
use Module::Runtime 'use_module';
use Path::Tiny;
use Template::Tiny;
use File::HomeDir;
use JSON::PP;
our $VERSION = '0.005';
sub getopt_spec {
return (
'skeletor %o',
['template|t=s
->my_home, '.skeletor.json'))) {
print "Found user options at: $saved_options_path\n";
my $json_opts = decode_json($saved_options_path->slurp);
@args = (@args, %$json_opts);
}
local @
URATION
You may store repeated or common configuration options in ~/skeletor.json, for example:
cat ~/.skeletor.json
{
"--author": "John Nap"
}
Then when you build a project the
, queue_name => 'other_queue'
);
# Producer:
$q->enqueue_item("foo");
# You can pass any JSON-serializable data structure
$q->enqueue_item({ bar => "baz" });
$q->enqueue_item({ id=> 12},{
> are serialized
using JSON (cf. L<JSON::XS>), so
any data structures supported by that can be enqueued.
We use JSON because that is supported at the Lua side as well (the cjson
library).
The impleme
{
my ($self, $c) = @_;
my $best_media_type = $c->req->choose_media_type('application/json', 'text/html');
}
sub choose :Local {
my ($self, $c) = @_;
my $body = $c->re
'no_match' => sub { 'none' },
'text/html' => sub { 'html' },
'application/json' => sub { 'json' });
$c->res->body($body);
}
sub filter : Local {
my ($self, $c) =
of the request to make decisions about what to do,
for example what format to return (HTML, XML, JSON, other). This role can
be applied to your L<Catalyst::Request> to add some useful helper methods
ject->date_last_modified
) =>sub { http_choose_accept (
'application/json' => sub { to_json $secret_object },
'application/xml' => sub { to_xml $secret_object },
nt-type does the client want
http_choose_accept (
[ 'application/json', 'application/xml' ] => sub {
# find the resource
for (http_accept) {
when ('application/json') {
return to_json ( $secret_object )
}
when
erl 5 you may have available.
=head1 SEE ALSO
L<Limper>
L<Limper::Engine::PSGI>
L<Limper::SendJSON>
=cut
__DATA__
html text/html
htm text/html
shtml text/html
css text/css
xml text/xml
gif image
ff
jar application/java-archive
war application/java-archive
ear application/java-archive
json application/json
hqx application/mac-binhex40
doc application/msword
pdf application/pdf
ps application/p
lar keys %$self;
require JSON;
my $j = $p ? $jp ||= JSON->new->allow_unknown->allow_blessed->utf8->convert_blessed->canonical->pretty
: $js ||= JSON->new->allow_unknown->allow_b
return join "\n", map {sprintf "%-${m1}s at %-${m2}s line %${m3}s%s", @$_} @trace;
}
sub TO_JSON { return {%{$_[0]}} }
sub classify {
my ($err, $ref) = @_;
$ref = {$ref => 1} if ! ref $
ll json error stringification to use pretty. You can also set _pretty => 1 in
individual errors, but sometimes you won't have access to the error object before
it stringifies.
=item TO_JSON
JSONifi
ing, JSON is easier, while Sereal::* is
# faster (about 7%) and delivers smaller serialized blobs.
use JSON::XS; # use the real stuff, no fall back on pure Perl JSON please
my $serializer = JSON::XS
->new->utf8->pretty(0);
my $deserializer = JSON::XS->new->utf8->pretty(0);
#use Sereal::Encoder;
#use Sereal::Decoder;
#my $serializer = Sereal::Encoder->new();
#my $deserializer = Sereal::Decoder-
ckage Apache::Hadoop::Watcher::Conf;
use 5.010001;
use strict;
use warnings;
use XML::Twig;
use JSON;
require Apache::Hadoop::Watcher::Base;
our @ISA = qw();
our $VERSION = '0.01';
# methods
sub
ations
=head1 SEE ALSO
Apache::Hadoop::Watcher
Apache::Hadoop::Watcher::Base
XML::Twig
JSON
=head1 AUTHOR
Snehasis Sinha, E<lt>snehasis@cpan.orgE<gt>
=head1 COPYRIGHT AND LICENSE
Copy
hasis Sinha
#
package Apache::Hadoop::Watcher::Yarn;
use 5.010001;
use strict;
use warnings;
use JSON;
require Apache::Hadoop::Watcher::Base;
our @ISA = qw();
our $VERSION = '0.01';
# Preloaded m
,"\n" if $self->{'debug'};
# actual work
$self->{'out'} = (decode_json $base->_wget (url=>$url)); #->{'nodeInfo'};
$base->_jsontr ( $self->{'out'} );
return $self;
}
1;
__END__
=head1 NAME
Ap
# changing json boolean object to perl values
sub _jsontr {
my ($self, $hash) = (@_);
foreach my $v ( values %{$hash} ) {
$v = ($v ? 'true' : 'false') if ref $v eq 'JSON::PP::Boolean
';
$self->_jsontr ( $v ) if ref $v eq 'HASH';
}
#return $hash;
}
sub _jsonjmx {
my ($self, $hook) = (@_);
if ( ref $hook eq 'HASH' ) {
$self->_jsontr ( $hook );
}
if ( ref $hook
eq 'ARRAY' ) {
foreach my $e ( @$hook ) {
$self->_jsontr ( $e );
}
}
}
# dumps output hashref
sub _print {
my ($self, %opts) = (@_);
print Dumper ( $opts{'output'} );
}
1;
__END__
age Queue::Q::ReliableFIFO::CLI;
use strict;
use Redis;
use Term::ReadLine;
use Data::Dumper;
use JSON::XS;
use File::Slurp;
use Carp qw(croak);
use Queue::Q::ReliableFIFO::Redis;
use Class::XSAccess
my %conf;
if (!$params{ignore_config_file} and -f $conf_file) {
%conf = %{decode_json(read_file($conf_file))};
$self->open(server => $conf{server}, port => $conf{port})
$self->path;
}
$conf{history} = \@history;
write_file($conf_file, encode_json(\%conf));
exit 0;
};
my %commands = map { $_ => undef } (qw(
open
hasis Sinha
#
package Apache::Hadoop::Watcher::Jmx;
use 5.010001;
use strict;
use warnings;
use JSON;
require Apache::Hadoop::Watcher::Base;
our @ISA = qw();
our $VERSION = '0.01';
# Preloaded m
' ', $_;
}
next;
}
print sprintf "%30s %s\n", $e->{'key'}, $e->{'value'};
}
}
# jmx json methods
sub _query {
my ($self, %opts) = (@_);
my $base = Apache::Hadoop::Watcher::Base->new;
$self->{'jmx'};
$self->{'out'} = (decode_json $base->_wget (url=>$url))->{'beans'};
#$self->{'out'} = (decode_json $base->_wget (url=>$url));
$base->_jsonjmx ( $self->{'out'} );
$self->{'out'} =~
";
$state->{cfg}->{db} ||= "table";
$state->{cfg}->{out} ||= "json";
$state->{cfg}->{jsonout} = sprintf("%s/%s/",
$state->{c
>{$con}->{files} =
[split("\n",`ls -R /home/santex/repos/KnowledgeInterDisciplinary/data/json | egrep -i "($con)";`)];
}
return $x;
}
sub import {
my $class = shift;
my @structu
ACKAGE__->drop($StructureName);
exit 0;
}
if($new==1){
use Term::ReadKey;
use JSON;
my $data = decode_json(lc`micro-sense $StructureName words`);
my $char;
my $line;
my $senses=@{$data-
package WebService::SetlistFM;
use JSON::XS;
use Cache::LRU;
use Net::DNS::Lite;
use Furl;
use URI;
use URI::QueryParam;
use Carp;
use Moo;
use namespace::clean;
our $VERSION = "0.04";
$Net::DNS::Li
ift;
return $self->request("artist/$mbid.json");
}
sub city {
my $self = shift;
my $geoid = shift;
return $self->request("city/$geoid.json");
}
sub search_artists {
my $self =
elf->request("search/artists.json", $query_param);
}
sub search_cities {
my $self = shift;
my $query_param = shift;
return $self->request("search/cities.json", $query_param);
}
sub sea
ader,
the value can be a JSON-encoded payload which can be processed
in Perl. Perl can return the results of the processing through
a global PHP variable (again, possibly JSON encoded). The
C<t/10-hea
d> where I<payload> is the JSON-encoding
of a hash that defines C<n>, the number to operate on, and
C<result>, the name of the PHP variable to publish the results to.
JSON-encoding the header value
ines. For complex results, it is also
convenient to assign a JSON-encoded value to a single PHP global
variable.
...
use Mojo::JSON;
...
app->plugin('MojoX::Plugin::PHP',
{ ph
::Log::LogDispatch> this can be thought of as a common logging interface.
package MyApp::View::JSON;
extends 'MyApp::View';
with 'MooseX:Log::Log4perl';
sub bar {
$self->logger->info("E
#!/usr/bin/env perl
use File::Find::Rule;
use strict;
use warnings;
use JSON;
use Cache::Memcached::Fast;
use Try::Tiny;
use Data::Dumper;
use Digest::MD5 qw(md5 md5_hex md5_base64);
our $memd = new
compress_ratio => 0.9,
max_failures => 1,
max_size => 512 * 1024,
});
our $all = {};
our $json = JSON->new->allow_nonref;
sub mytry{
my $cmd = shift;
try {
#if($cmd){
my @ret = split "\n