ATAL => 'all';
use Moo;
use Getopt::Long qw(GetOptionsFromArray);
use Try::Tiny;
use MongoDB;
use JSON;
=head1 NAME
Uninets::Check::Modules::MongoDB - Uninets::Check module to check mongodb servers.
my ($self, $status, $value, $format) = @_;
return JSON->new->encode(
{
message => $value,
status => $status,
}
) if $format eq 'json';
# default last in case some non supported format
'Default: num'
},
formats => {
'num' => 'Returns the status code',
'json' => 'Returns a JSON structure',
},
},
},
}
}
=head1 AUTHOR
Matthias Krull, C<< <<m.krull at uni
types are getting more and more
common as CSV data representation starts to give way to XML and JSON.
RDB's can handle complex data by using I<relational tables>. (the I<R> in
I<RDB>.) But RDB da
App::BCSSH::Message qw(send_message BCSSH_SUCCESS BCSSH_FAILURE BCSSH_COMMAND);
use JSON qw(encode_json decode_json);
use Moo::Role;
has 'agent' => ( is => 'ro', default => sub { $ENV{SSH_AUTH_SOCK}
@_;
my $key = $self->auth_key || '';
my $message = join '|', $self->handler, $key, encode_json(\@args);
my ($rtype, $rmessage) = send_message($self->agent_socket, BCSSH_COMMAND, $message);
unless (defined $rmessage && length $rmessage) {
return;
}
my $response = decode_json($rmessage);
return wantarray ? @$response : 1;
}
1;
__END__
=head1 NAME
App::BCSSH::Client
= '0.07';
our $EXTENTIONS_MAP = {
pl => 'Perl',
perl => 'Perl',
js => 'JSON',
json => 'JSON',
yml => 'YAML',
yaml => 'YAML',
};
sub new {
my $class = shift;
bles
C<< Perl >>, C<< JSON >> and C<< YAML >> format.
The file format is determined by the extension type. extensions map are:
pl => Perl
perl => Perl
js => JSON
json => JSON
yml => YAML
n considers that file is envfile.
Also, if you use C<< YAML >> and C<< JSON >>, L<< Data::Encoder >> and L<< YAML >> or L<< JSON >> module is required.
=head1 AUTHOR
xaicron E<lt>xaicron@cpan.orgE<
' ' . $WebService::Rackspace::DNS::VERSION);
$self->content_type('application/json');
# $self->extension('json');
$self->auth_type('none');
$self->mapping({
user => 'us
:Perl::Distmap::VERSION = '0.2.0';
}
# ABSTRACT: A reader/writer for the C<metadata/perl/distmap.json> file.
use 5.010000;
use Moose;
has map => (
isa => 'Gentoo::Perl::Distmap::Map',
is
2] }
sub decoder {
return state $json = do { require JSON; JSON->new->pretty->utf8->canonical; }
}
sub encoder {
return state $json = do { require JSON; JSON->new->pretty->utf8->canonical; }
}
for the C<metadata/perl/distmap.json> file.
=head1 VERSION
version 0.2.0
=head1 SYNOPSIS
my $dm = Gentoo::Perl::Distmap->load( file => '../path/to/distmap.json' );
$dm->save( file => '/tmp/fo
package App::BCSSH::Handler;
use Moo::Role;
use JSON qw(encode_json decode_json);
use App::BCSSH::Message;
use MooX::CaptainHook qw(on_application);
my %handlers;
sub handlers {
return %handlers;
{
my ($self, $args, $send, $socket) = @_;
my $json_send = sub {
my @response = @_;
my $rmessage = @response ? encode_json(\@response) : '';
$send->(BCSSH_SUCCESS, $rme
ssage);
return $socket;
};
my $handler_args = decode_json($args);
$self->handle($json_send, @$handler_args);
return;
}
sub handler {
my $self = shift;
return sub {
Dezi::MultiTenant;
use strict;
use warnings;
use Dezi::Server;
use Dezi::MultiTenant::Config;
use JSON;
use Plack::Builder;
use Plack::Request;
use Plack::App::URLMap;
use Data::Dump qw( dump );
use C
tion/xml',
'application/json',
],
vary_user_agent => 1;
# JSONP response based on 'callback' param
enable "JSONP";
# / is self-description
available => \%avail,
};
my $resp = to_json($about);
return [
200,
[ 'Content-Type' => 'application/json',
'Content-Length' => length $resp,
em Filtering, etc
Of objects, requests, etc. Javascript or serverside, it doesn't matter.
=item JSON/YAML/XML feeds
Maybe it's useful for someone.
=back
=head1 MINI-TUTORIAL
=head2 Why use LeakT
package Finance::MtGox;
use warnings;
use strict;
use Carp qw( croak );
use JSON::Any;
use WWW::Mechanize;
use URI;
use Time::HiRes qw( gettimeofday );
use Digest::SHA qw( hmac_sha512 );
use MIME::Ba
rgs->{secret}
or croak "You must provide 'key' and 'secret' credentials.";
$args->{json} = JSON::Any->new;
$args->{mech} = WWW::Mechanize->new(stack_depth => 0);
return bless $args
2 call( $name )
Run the API call named C<$name>. Returns a Perl data structure
representing the JSON returned from MtGox.
=cut
sub call {
my ( $self, $name ) = @_;
croak "You must provide
'Memcached' => { servers => ['127.0.0.1'] }
],
serialization => 'JSON',
expires => 3600,
fields => {
user => {
inflate => s
App::BCSSH::Proxy;
use App::BCSSH::Options;
use App::BCSSH::Util qw(find_mods rc_dir);
use JSON qw(decode_json);
use constant DEBUG => $ENV{BCSSH_DEBUG};
with Options(
permute => 0,
);
with 'App:
rc_dir . '/config'
or return {};
my $raw = do { local $/; <$fh> };
return decode_json($raw);
}
sub run {
my $self = shift;
my $args = $self->args;
my $host = $self->host;
ccess to unofficial API of booklog.jp
our $VERSION = 'v0.0.1'; # VERSION
use LWP::UserAgent;
use JSON::Any;
sub new
{
my ($self) = @_;
my $class = ref $self || $self;
return bless {
_UA => LWP:
_} } keys %$data;
$param = "?$param" if length $param;
my $ret = JSON::Any->from_json($self->{_UA}->get('http://api.booklog.jp/json/'.$account.$param)->content);
$ret->{category} = {} if ref $ret->
rn $ret;
}
sub get_review
{
my ($self, $book_id) = @_;
my $ret = JSON::Any->from_json($self->{_UA}->get('http://booklog.jp/json/review/'.$book_id)->content);
return $ret->{$book_id} if exists $re
sub preset {
return $presets{$_[1]} if %presets;
use JSON ();
my $json = JSON->new;
while ( <DATA> ) {
my $data = $json->decode($_);
my $preset = __PACKAGE__->new;
$preset->chorus
"D Min7 4" );
# Add section to song.
$song->add_section($section);
# Export as json.
print $song->json, "\n";
=head1 DESCRIPTION
Chordbot is a songwriting tool / electronic backup band fo
ordBot can import and export songs in JSON format. Music::ChordBot
provides a set of modules that can be used to programmatically
build songs and produce the JSON data suitable for import into
ChordBo
$song->name("Perl Song");
$song->tempo(120);
$song->add_section(...);
print $song->json, "\n";
=head1 METHODS
=head2 new [ args ]
Creates a new Music::ChordBot::Opus object.
Initial
y || "opus" ] );
}
=head2 json [ pretty ]
Produces a string representing the song, in JSON format, suitable
for import into the ChordBot app.
If argument is true, the JSON is pretty-printed for rea
.
=cut
sub json {
my ( $self, $pretty ) = @_;
$self->_wrapup;
use JSON ();
my $json = JSON->new;
$json->canonical(1);
$json = $json->pretty if $pretty;
$json->encode($sel
al_machines');
$self->auth_type('basic');
$self->content_type('application/json');
$self->extension('json');
$self->wrapper('virtual_machine');
$self->mapping({
os
construct a CordBot song. Upon program termination, the song is
written out to standard output in JSON format, suitable for import into
the ChordBot app.
=cut
our $VERSION = 0.01;
use Music::ChordB
he program.
sub END {
_export() if $song;
}
sub json { $song->json }
sub _export {
binmode( STDOUT, ':utf8');
print STDOUT $song->json, "\n";
}
=head1 QUICK ACCESS CHORDS
For convenien
Net::Groonga::HTTP;
use 5.008005;
use strict;
use warnings;
our $VERSION = "0.03";
use JSON::XS qw(encode_json);
use Furl;
use URI;
use Net::Groonga::HTTP::Response;
use Mouse;
has end_point => (
ll($function, %args);
};
}
sub load {
my ($self, %args) = @_;
$args{values} = encode_json($args{values}) if ref $args{values};
return $self->call('load', %args);
}
1;
__END__
=encod
,
values => \@values,
);
Load the data to database. This method encodes I<values> to JSON automatically, if it's arrayref.
=item $groonga->select(%args)
=item $groonga->status(%args)
=
Plack::Component);
use Plack::Util::Accessor qw( dsn dbh);
use Plack::Request;
use JSON::PP qw(encode_json decode_json);
use parent qw(Exporter);
our $VERSION = '0.06';
our @EXPORT = qw(pgrest);
sub
1 ? @_ : dsn => 'dbi:Pg:'.$_[0] )->to_app;
}
# maintain json object field order
use Tie::IxHash;
my $obj_parser_sub = \&JSON::PP::object;
*JSON::PP::object = sub {
tie my %obj, 'Tie::IxHash';
$obj_
$n = shift;
return $n unless $n;
return decode_json $n
}
method select($param, $args) {
use Data::Dumper;
my $req = encode_json({
collection => $args->{collection},
l