';
use Net::CIDR::Lite;
use Parallel::Scoreboard;
use JSON;
use Fcntl qw(:DEFAULT :flock);
use IO::Handle;
our $VERSION = '0.04';
my $JSON = JSON->new->utf8(0);
has conf => sub { +{} };
has skip_ps
if ( ($env->{QUERY_STRING} || $req->url->query->to_string ||'') =~ m!\bjson\b!i ) {
return $self->render(json => $status)
}
return $self->render(text => $bod
=> $env->{USER},
time => time(),
};
}
$self->{__scoreboard}->update($JSON->encode({
%{$prev},
pid => $$,
ppid => getppid(),
uptime => $self
;
$WWW::Pocket::Script::VERSION = '0.03';
use Moose;
use Getopt::Long 'GetOptionsFromArray';
use JSON::PP;
use List::Util 'sum';
use Path::Class;
use URI;
use Pod::Usage;
use WWW::Pocket;
has consu
} values %$list;
}
sub _pretty_print {
my $self = shift;
my ($data) = @_;
print JSON::PP->new->utf8->pretty->canonical->encode($data), "\n";
}
sub add {
my $self = shift;
my
atsd *server*
package Net::Statsd::Server;
# Use statements {{{
use strict;
#se warnings;
use JSON::XS ();
use Socket qw(SOL_SOCKET SO_RCVBUF);
use Time::HiRes ();
use AnyEvent;
use AnyEvent::Han
f->{$_} = $opt->{$_}
for keys %{ $opt };
bless $self, $class;
}
# Flatten JSON booleans to avoid calls to JSON::XS::bool
# in the performance-critical code paths
sub _flatten_bools {
my ($se
$conf_hash->{$_} = !! $conf_hash->{$_};
}
return $conf_hash;
}
sub _json_emitter {
my ($self) = @_;
my $js = JSON::XS->new()
->utf8(1)
->shrink(1)
->space_before(0)
->space
use utf8;
use 5.008_005;
our $VERSION = '0.02';
use Moose;
use Types::Standard qw< :types >;
use JSON::MaybeXS;
use Path::Tiny;
use List::Util qw< first >;
use namespace::autoclean;
=encoding utf-8
In a controller action
#
my $vega = $c->view('Vega');
$vega->specfile('patient-chart.json');
$vega->bind_data({
"patient" => [{
id => $patient->id,
clone(@args);
}
=head1 ATTRIBUTES
=head2 json
Read-only. Object with C<encode> and C<decode> methods for reading and writing
JSON. Defaults to:
JSON::MaybeXS->new->utf8->convert_blessed->can
e flush code wasn't doing this previously.
Fixed management commands (:8126) to output correct JSON data
structures.
This is the first fully functional statsd server release.
=head2 Net::St
Pocket v3 API
use HTTP::Tiny;
use IO::Socket::SSL; # Necessary for https URLs on HTTP::Tiny.
use JSON::PP;
use Carp;
has consumer_key => (
is => 'ro',
isa => 'Str',
required
content => encode_json($params),
headers => {
'Content-Type' => 'application/json; charset=UTF-8',
'X-Accept' => 'application/json',
},
esponse->{status}): $response->{content}"
unless $response->{success};
return decode_json($response->{content});
}
__PACKAGE__->meta->make_immutable;
no Moose;
1;
__END__
=pod
=enco
$t = Test::Statsd->new({
binary => './bin/statsd',
config => './bin/sample-config.json'
});
# Brings up the statsd server in the background
# with the specified configurat
sdIndex . '/_bulk',
method => 'POST',
headers => {
'Content-Type' => 'application/json',
'Content-Length' => length($payload),
}
};
my $req = HTTP::Request->new();
$re
JSON::XS ();
use base qw(Net::Statsd::Server::Backend);
sub init {
my ($self) = @_;
=cut
$self->{statsCache} = {
counters => {},
timers => {},
};
=cut
$self->{json_emitter} = JSON
=> $metrics->{sets},
pctThreshold => $metrics->{pctThreshold},
};
print STDERR $self->{json_emitter}->encode($out), "\n";
return;
}
sub status {
my ($self) = @_;
return {
last_fl
se;
use namespace::autoclean;
use Types::Standard qw/Str HashRef/;
use Path::Tiny;
use JSON::MaybeXS 'decode_json';
with 'Badge::Depot';
# ABSTRACT: Shantanu Bhadoria's Travis plugin for Badge::Depot
sion,
};
}
return {} if !path('META.json')->exists;
my $json = path('META.json')->slurp_utf8;
my $data = decode_json($json);
return {} if !exists $data->{'resources'}{'r
a::Plugin::MetaProvides::Package;
use Dist::Zilla::Plugin::MetaYAML;
use Dist::Zilla::Plugin::MetaJSON;
use Dist::Zilla::Plugin::Git::CommitBuild;
use Dist::Zilla::Plugin::PerlTidy;
use Dist::Zilla::
? $_[0]->payload->{exclude_filename}
: [qw/dist.ini Changes README.pod README.md META.json META.yml/];
},
);
has stopwords => (
is => 'ro',
isa => 'ArrayRef',
la
taYAML'
, # core : Helps avoid kwalitee croaks and supports older systems
'MetaJSON', # core
[
'ChangelogFromGit::CPAN::Changes' => {
tag_rege
package WWW::AUR::RPC;
use warnings 'FATAL' => 'all';
use strict;
use JSON qw();
use Carp qw();
use WWW::AUR::URI qw( rpc_uri );
use WWW::AUR qw( _category_name _useragent );
my %_RENAME_FOR = ( '
'LastModified' => 'mtime',
);
#---HELPER FUNCTION---
# Purpose: Map JSON package info keys to their new names...
sub _munge_result
{
my ($info_ref) = @_;
my %res
info AUR RPC: ' . $resp->status_line
unless $resp->is_success;
my $json = JSON->new;
my $data = $json->decode( $resp->content );
if ( $data->{type} eq "error" ) {
Carp::
Suite;
use strict;
use warnings;
use Carp;
use File::Basename;
use File::Spec;
use FindBin;
use JSON;
use Test::More;
sub run {
my ($class, %opts) = @_;
%opts = (
base_dir => $opt
n} ? ( $self->{base_dir}, $self->{version} ) : ( $self->{base_dir} ),
$self->{suite} . ".json"
);
note $test_suite_file;
unless (-f $test_suite_file) {
croak sprintf("No
@$self{qw/base_dir version suite/});
}
open(my $fh, "<", $test_suite_file) or croak $!;
my $test_suite = decode_json(do { local $/; <$fh> });
close $fh;
return $test_suite;
}
1;
ow_immediate
enable_history
enable_format
formats
history
json
loose_type
/],
ro => [qw/
errors
current_type
current_ke
current_schema_pointer
schema_pointer_history
/],
);
use Carp qw(croak);
use JSON;
use JSV::Keyword qw(:constants);
use JSV::Util::Type qw(detect_instance_type detect_instance_typ
ance {
my $self = shift;
my $instance;
if ( JSON::is_bool($self->current_instance) ) {
if ( $self->current_instance == JSON::true ) {
$instance = "true";
}
ackage JSV::Keyword::Draft4::Maximum;
use strict;
use warnings;
use parent qw(JSV::Keyword);
use JSON;
use JSV::Keyword qw(:constants);
sub instance_type() { INSTANCE_TYPE_NUMERIC(); }
sub keyword(
value($schema);
my $exclusive_maximum = $class->keyword_value($schema, "exclusiveMaximum") || JSON::false;
if ($exclusive_maximum) {
if ($instance >= $maximum) {
$context-
e Scalar::Util qw(blessed looks_like_number);
use JSON;
our @EXPORT_OK = (qw/
detect_instance_type
detect_instance_type_loose
escape_json_pointer
/);
our %REF_TYPE_MAP = (
HASH => "
if (!blessed $instance) {
return $REF_TYPE_MAP{$ref_type};
}
elsif (JSON::is_bool($instance)) {
return "boolean";
}
else {
croak(s
$/;
return "number_or_string";
}
}
return $type_strict;
}
sub escape_json_pointer {
my $property = shift;
return unless defined $property;
# according to http
um;
use strict;
use warnings;
use parent qw(JSV::Keyword);
use JSV::Keyword qw(:constants);
use JSON;
use List::MoreUtils qw(firstidx);
sub instance_type() { INSTANCE_TYPE_ANY(); }
sub keyword() {
>keyword_value($schema);
my $instance_as_json = $context->json->encode($instance);
my $matched_idx = firstidx { $instance_as_json eq $context->json->encode($_); } @$enum;
if ($matched_idx
grep {
( /^[A-Z.]+$/ && !/^MANIFEST/ ) ||
m{^(Change(s|log)|META.(json|yml)|(ex|s)amples?|e[gx]|demos?)$}i
}
map { basename $_ }
grep { m!^[^/]+
our $VERSION = "0.08";
1;
__END__
=encoding utf-8
=head1 NAME
JSV - A perl implementation of JSON Schema (draft-04) validator
=head1 SYNOPSIS
=head1 DESCRIPTION
See e.g. L<JSV::Validator>
=he
ry
throw_error
throw_immediate
formats
/]
);
use Clone qw(clone);
use JSON;
use JSV::Keyword qw(:constants);
use JSV::Reference;
use JSV::Context;
use Module::Pluggable::Ob
current_schema_pointer => "",
schema_pointer_history => [],
json => JSON->new->allow_nonref,
loose_type => $opts->{loose_type},
);
alidator;
}
1;
__END__
=encoding utf-8
=head1 NAME
JSV::Validator - A perl implementation of JSON Schema (draft-04) validator
=head1 SYNOPSIS
use feature qw(say);
use JSV::Validator;
JSV