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
$t = Test::Statsd->new({
binary => './bin/statsd',
config => './bin/sample-config.json'
});
# Brings up the statsd server in the background
# with the specified configurat
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
my %args = @_;
my $format = $args{format} // "perl";
state $dumpers = {
json => "as_json",
yaml => "as_yaml",
perl => "as_perl",
};
my $dumper = $d
for dump()") unless $dumper;
return $self->$dumper(%args);
}
sub as_json {
require JSON::MaybeXS;
my $json = JSON::MaybeXS->new
->utf8
->pretty
sed;
# JSON doesn't seem to have an easy way to say
# "just dump objects as references please". This is their
# recommended way to do it (yarf).
local *UNIVERSAL::TO_JSON = sub {
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
base 'App::GitHooks::Plugin';
# External dependencies.
use CPAN::Changes;
use Data::Dumper;
use JSON qw();
use LWP::UserAgent;
use Log::Any qw($log);
use Try::Tiny;
# Internal dependencies.
use App
lack, check under "Integration
settings" for the following information: "Webhook URL", "Send your JSON
payloads to this URL". This is the URL you need to set as the value for the
C<slack_post_url> con
%s', $channel, $message );
# Prepare payload for the request.
my $request_payload =
JSON::encode_json(
{
text => $message,
channel => $channel,
}
);
# Prepare requ
G}, 'Smart::Comments';
use WWW::AUR::URI qw(rpc_uri);
use WWW::AUR::UserAgent;
use IO::Pipe;
use JSON;
=head1 NAME
OS::CheckUpdates::AUR - checkupdates for aur
=head1 VERSION
Version 0.04
=cut
ponse = $lwp->get(rpc_uri('multiinfo', @_));
$response->is_success
and return decode_json($response->decoded_content);
### LWP decoded: $response->decoded_content
$!=1; die(__PA
;
$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
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
package Color::Brewer;
use strict;
use warnings;
use utf8;
use JSON;
use File::ShareDir;
use Params::Validate qw(:all);
use Path::Tiny;
our $VERSION = 0.001;
=encoding utf-8
=head1 NAME
Color::B
r_brewer {
if ( !defined $colors ) {
$colors = from_json( path( File::ShareDir::dist_file( 'Color-Brewer', 'colorbrewer.json' ) )->slurp_utf8() );
}
return $colors;
}
=head2 named
Brewer website and color schemes are copyrighted by Cynthia Brewer. With this module is bundled a json file with the color schemes.
This product includes color specifications and designs developed b
use WWW::SourceForge;
use WWW::SourceForge::Project;
use LWP::Simple qw();
use Data::Dumper;
use JSON::Parse;
use LWP::UserAgent;
use LWP::Authen::OAuth;
use HTTP::Request::Common;
our $VERSION = '0
the JSON and parse it. Die on bad JSON;
=cut
sub get {
my ( $self, %parameters ) = @_;
my $r = {};
my $json = LWP::Simple::get( $parameters{url} );
eval { $r = JSON::Parse::json_to_
perl( $json ); };
if ( $@ ) {
warn $@;
return {};
} else {
return $r;
}
}
=head1 post_page
$self->post_page(
page => 'NewPage',
text => 'Wiki page bo
';
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
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
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
grep {
( /^[A-Z.]+$/ && !/^MANIFEST/ ) ||
m{^(Change(s|log)|META.(json|yml)|(ex|s)amples?|e[gx]|demos?)$}i
}
map { basename $_ }
grep { m!^[^/]+
rge;
my $json;
if ( $parameters{id} ) {
warn("The Sourceforge API no longer understands user IDs.");
return 0;
} elsif ( $parameters{username} ) {
$json = $api->cal
'You must provide an id or username. Bad monkey.');
return 0;
}
$self->{data} = $json;
return $self;
}
sub email { return shift->sf_email(); }
=head2 projects
Returns an array
package WWW::SourceForge;
use strict;
use LWP::Simple qw(get);
use JSON::Parse;
use XML::Feed;
use File::HomeDir;
our $VERSION = '0.73'; # This is the overall version for the entire
# package, so sho
,
},
ref($class) || $class
);
return $self;
}
=head2 call
Usage : my $json = $sfapi->call(
method => whatever,
arg1 => 'value',
rss',
);
Returns : Hashref, containing a bunch of data. Format defaults to
'json', but in some cases, you'll want to force rss because that's
how the return is available. Wi
= $api;
my $json;
if ( $parameters{id} ) {
warn('The API does not support project IDs any more');
return 0;
} elsif ( $parameters{name} ) {
$json = $api->call(
arn('You must provide an id or name. Bad monkey.');
return 0;
}
$self->{data} = $json;
return $self;
}
=head2 admins
@admins = $project->admins();
Returns a list of WWW::Sour
end_date -> '2012-07-25'
);
=cut
# https://sourceforge.net/projects/xbmc/files/stats/json?start_date=2010-05-01&end_date=2010-05-11
sub downloads {
my $self = shift;
my %args = @_
=> hmac_sha1_hex($date_string, $self->secret),
'accept' => 'application/json',
);
}
around qw/get put post delete/ => sub {
my $orig = shift;
my $self = shift;
tions;
use JSON::XS;
use Moo;
our $VERSION = "1.01";
use constant {
REF_DB_PATH => catfile(dirname($INC{"Schema/RackTables.pm"}),
"RackTables", "versions.json")
};
has
s schema => ( is => "ro" );
has schema_version => ( is => "ro" );
my $ref_db = decode_json(do {
open my $fh, "<", REF_DB_PATH or die "Can't read '", REF_DB_PATH, "': $!\n";
local $