k?
my $cb = ref $_[-1] eq 'CODE' ? pop : undef;
$res->$cb if $cb;
my @mods = @{$res->json->{data}{children}};
# FIXME should we return User objects instead? or combined?
my @coll
my $pkg = 'Mojo::Snoo::Subreddit::About::' . $self->name;
$self->_monkey_patch($pkg, $res->json->{data});
}
sub _toggle_subscribe {
my ($self, $action) = @_;
# Calling $self->about fe
ams->{title} //= $title // '';
$params->{sr} = $self->name;
$params->{api_type} = 'json';
$params->{kind} = $kind;
my $res = $self->_do_request('POST', '/api/submit', %$par
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
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'} =~
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
my %tunnels = (
T00001 => Net::SixXS::Data::Tunnel->from_json(\%data1),
T00002 => Net::SixXS::Data::Tunnel->from_json(\%data2),
);
my $s = Net::SixXS::Server::AnyEvent->new(usernam
my ($captcha_id, $captcha_text) = $self->_solve_captcha();
my %form = (
api_type => 'json',
captcha => $captcha_text,
iden => $captcha_id,
subject => 'subjec
my %tunnels = (
T00001 => Net::SixXS::Data::Tunnel->from_json(\%data1),
T00002 => Net::SixXS::Data::Tunnel->from_json(\%data2),
);
my $s = Net::SixXS::Server::Inetd->new(username =
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
, 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
::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
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
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-
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
r_transport {
my $class = shift;
my ($sims) = @_;
# Convert objects into columns/values for JSON encoding.
my %flattened;
while ( my ($k, $v) = each %{$sims} ) {
$flattened{$k} = [ map {
or_transport($sims);
}
return $rv // { error => 'No actions taken' };
}
use JSON::XS qw( encode_json decode_json );
use Plack::Request;
use Web::Simple; # Needed for the prototypes
sub dispatch
v);
my $request = decode_json($r->content);
my $rv = $class->do_sims( $request );
[ 200, [ 'Content-type', 'application/json' ],
[ encode_json($rv) ],
]
},
}
}
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
ckage
dotconfig::Decoder;
use strict;
use warnings;
use Math::BigInt;
use Math::BigFloat;
use JSON ();
use constant {
DC_SPACE => ' ',
DC_TAB => "\t",
DC_LF
shift->_consume_if(DC_FALSE) ? \JSON::false : undef }
sub true { shift->_consume_if(DC_TRUE) ? \JSON::true : undef }
sub null { shift->_consume_if(DC_NULL) ? \JSON::null : undef }
sub number {
delete $params{to} );
my $nexmo = Nexmo::SMS->new(
server => 'https://rest.nexmo.com/sms/json',
username => $self->{"_username"},
password => $self->{"_password"},
);
my $sms
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
{
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
s file
Set($FillTicketDataSettingsFile =>
'/home/rt/rt4/etc/fill_ticket_data_settings.json');
=head1 DESCRIPTION
The purpose of this plugin is to provide a "Fill data" button, which, giv
ID, will send this ID to the server and retrieve data according to the
configuration provided in JSON config file. Possible external sources are:
database, shell command output, plain text specified
c/fill_ticket_data_settings.json (or etc/ticket_data_settings_ru.json) for
the example of settings file.
=cut
use DBI;
use Digest::MD5 qw(md5_hex);
use JSON qw(decode_json);
#use Data::Dumper;
#loc