env perl
use Net::Jenkins;
use Jenkins::NotificationListener;
use Getopt::Long;
use AnyEvent;
use JSON::XS;
use YAML;
my $host = '127.0.0.1';
my $port = 8888;
my $debug;
my $result = GetOptions(
ayload = shift; # Jenkins::Notification;
if( $debug ) {
my $args = decode_json $payload->raw_json;
print "===== Payload Start =====\n";
print Dump $args;
}
pri
as parameters => ( is => 'rw' );
has api => ( is => 'rw', isa => 'Net::Jenkins' );
# raw json
has raw_json => ( is => 'rw', isa => 'Str' );
sub BUILDARGS {
my ($self,%args) = @_;
my $buil
in/perl -w
use strict;
use utf8;
use JSON -support_by_pp;
use LWP::Simple;
use IO::Uncompress::Unzip qw(unzip $UnzipError) ;
use IO::File;
=head1 NAME
ppa_json2ppa_csv.pl
=head1 VERSION
Version 0
.01
=cut
=head1 SYNOPSIS
perl -f ppa_json2ppa_csv.pl URL
DESCRIPTION
This script is able to convert
http://www.acessoainformacao.rs.gov.br/upload/20120515155323ppa_orcamento_2012.zip
into a CSV. T
my $input = "ppa.zip";
my $output = "ppa.json";
unzip $input => $output
or die "unzip failed: $UnzipError\n";
my $fh = IO::File->new();
$fh->open("< ppa.json");
open (my $saida, ">", "taxo.csv") ||
Net::Jenkins::Job::Build;
use Net::HTTP;
use LWP::UserAgent;
use Moose;
use methods;
use URI;
use JSON;
has scheme => ( is => 'rw', isa => 'Str', default => 'http' );
has host => (
is =
{
return $self->user_agent->get($uri);
}
method get_json ( $uri ) {
my $response = $self->user_agent->get($uri);
return decode_json $response->decoded_content if $response->is_success;
}
method summary {
my $uri = $self->get_base_url . '/api/json';
return $self->get_json( $uri );
}
method mode {
return $self->summary->{mode};
}
method jobs {
return map { Net::Jenkin
Jenkins::Job::Build;
use Jenkins::Notification;
use AnyEvent::Socket;
use Moose;
use methods;
use JSON::XS;
our @ISA = ( 'Moose::Object', 'Exporter' );
our @EXPORT = qw(parse_jenkins_notification);
;
sub parse_jenkins_notification {
my $json = shift;
my $args = decode_json $json;
return Jenkins::Notification->new( %$args , raw_json => $json );
}
method start ($prepare_cb) {
ret
) = @_;
my $json = '';
my $buf = '';
while( my $bytes = sysread $fh, $buf, 1024 ) {
$json .= $buf;
}
eval {
if( $json ) {
= shift;
my $uri = URI->new( $build_url );
# http://ci.jruby.org/job/jruby-git/4259/api/json
my ($job_name,$build_id) =
($build_url =~ m{/job/([^/]+)/([^/]+)});
my ($job_u
Data::Riak::Request::GetBucketProps::VERSION = '2.0';
}
use Moose;
use Data::Riak::Result::SingleJSONValue;
use namespace::autoclean;
sub as_http_request_args {
my ($self) = @_;
return {
/props', $self->bucket_name),
accept => 'application/json',
};
}
sub _mangle_retval {
my ($self, $ret) = @_;
$ret->json_value->{props};
}
with 'Data::Riak::Request::WithBucket';
has '+result_class' => (
default => Data::Riak::Result::SingleJSONValue::,
);
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=head1 NAME
Data::Riak::Request::GetBucketProps
=head1 VERS
esult::JSONValue;
{
$Data::Riak::Result::JSONValue::VERSION = '2.0';
}
# ABSTRACT: A result containing JSON data
use Moose::Role;
use JSON 'decode_json';
use namespace::autoclean;
sub json_value
{
my ($self) = @_;
decode_json $self->value;
}
1;
__END__
=pod
=head1 NAME
Data::Riak::Result::JSONValue - A result containing JSON data
=head1 VERSION
version 2.0
=head1 DESCRIPTION
Results for requests resulting in JSON data use this role to provide convenient
access to the decoded body payload.
=head1 METHODS
=head2 json_value
=head1 AUTHORS
=over 4
=item *
Andrew Nelson
s;
{
$Data::Riak::Request::Status::VERSION = '2.0';
}
use Moose;
use Data::Riak::Result::SingleJSONValue;
use Data::Riak::Exception::StatsNotEnabled;
use namespace::autoclean;
sub as_http_request_
return {
method => 'GET',
uri => 'stats',
accept => 'application/json',
};
}
sub _build_http_exception_classes {
return {
404 => Data::Riak::Exception
t::WithHTTPExceptionHandling';
has '+result_class' => (
default => Data::Riak::Result::SingleJSONValue::,
);
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=head1 NAME
Data::Riak::Reque
ta::Riak::Result::SingleJSONValue;
{
$Data::Riak::Result::SingleJSONValue::VERSION = '2.0';
}
# ABSTRACT: Single result containing JSON data
use Moose;
use JSON 'decode_json';
use namespace::autocl
Result::JSONValue',
'Data::Riak::Result::Single';
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=head1 NAME
Data::Riak::Result::SingleJSONValue - Single result containing JSON data
=
his is a result class for requests returning a single result containing JSON
encoded data. It applies L<Data::Riak::Result::JSONValue> and
L<Data::Riak::Result::Single>.
=head1 AUTHORS
=over 4
=ite
ta::Riak::Async::Bucket;
{
$Data::Riak::Async::Bucket::VERSION = '2.0';
}
use Moose;
use JSON 'decode_json';
use namespace::autoclean;
with 'Data::Riak::Role::Bucket';
sub remove_all {
my ($s
ta::Riak::MapReduce::Phase::Reduce;
use HTTP::Headers::ActionPack::LinkList;
use JSON::XS qw/decode_json encode_json/;
with 'Data::Riak::Role::HasRiak';
has name => (
is => 'ro',
isa => '
ets/%s/keys', $self->name),
query => { keys => 'true' }
})->first;
return decode_json( $result->value )->{'keys'};
}
sub count {
my $self = shift;
my $map_reduce = Data::Ria
ce->mapreduce;
my ( $result ) = $map_reduce_results->results->[0];
my ( $count ) = decode_json($result->value) || 0;
return $count->[0];
}
sub remove_all {
my $self = shift;
my $
}
# ABSTRACT: An interface to a Riak server.
use strict;
use warnings;
use Moose;
use JSON::XS qw/decode_json/;
use Data::Riak::Result;
use Data::Riak::ResultSet;
use Data::Riak::Bucket;
use Data:
} @parts
]
});
}
sub _buckets {
my $self = shift;
return decode_json(
$self->send_request({
method => 'GET',
uri => '/buckets',
use MooseX::Declare;
class App::PortDistances::Types {
use Carp;
use JSON;
use MooseX::Types -declare => [
qw/
File HoH StrArray
Coord Quadrant Hemispher
oH, from File, via {
local $/;
open my $IN, q{<}, $_ or confess $!;
JSON::decode_json(<$IN>);
};
coerce StrArray, from File, via {
open my $IN, q{<}, $_ or ret
ins with a -, or whose key consists entirely of
nonword characters (thereby covering '=', '>', pg json ops, etc.) is
processed as an operator hashpair.
=head3 operator hashpair w/node type
If a node
ason::Util
qw(can_load catdir catfile combine_similar_paths find_wanted first_index is_absolute json_decode mason_canon_path read_file taint_is_on touch_file uniq write_file);
use Memoize;
use Moose
my $line = <$fh>;
if ( my ($flags_str) = ( $line =~ /\# FLAGS: (.*)/ ) ) {
$flags = json_decode($flags_str);
}
return $flags;
}
method _flush_load_cache () {
Memoize::flush_
$VERSION = 'v3.9.4';
use Getopt::Long;
use Pod::Usage;
use MIME::Base64;
use LWP::UserAgent;
use JSON;
## no critic (Capitalization, RequireCarping)
# command line variables binds
my @pem;
next;
}
push @cert, $line;
}
close $fh or die "close: $!";
}
my $json_data = to_json( {'chain' => \@chain } );
while (my ($log_name, $log_url) = each %logs) {
write_log(
q = HTTP::Request->new('POST', $log_url . '/ct/v1/add-chain', ['Content-Type' => 'application/json'], $json_data);
my $res = $ua->request($req);
if (!$res->is_success) {
write_log('Fa
roformats;
use 5.010;
use autodie;
use strict;
use utf8;
use HTML::Microformats 0.100 qw();
use JSON 2.00 qw();
use RDF::Trine 0.135 qw();
use RDF::Query 2.900 qw();
use XML::Atom::OWL 0.100 qw();
t, $entry);
}
return $rv;
}
*entry_all_objects = \&all_objects;
sub TO_JSON
{
return $_[0]->all_objects;
}
sub json
{
my ($self, %opts) = @_;
$opts{'convert_blessed'} = 1
unless defined
ssed'};
$opts{'utf8'} = 1
unless defined $opts{'utf8'};
return JSON::to_json($self->all_objects, \%opts);
}
sub entry_json
{
my ($self, $entry, %opts) = @_;
$opts{'convert_blessed'} = 1
] [--args json-string]
# Evaluate template in string
mason.pl [mason options] [--args json-string] -e "string"
# Evaluate template in file
mason.pl [mason options] [--args json-string] t
orary directory.
=head1 ADDITIONAL OPTIONS
=over
=item --args json-string
A hash of arguments to pass to the page component, in JSON form. e.g.
--args '{"count":5,"names":["Alice","Bob"]}'
=
r2;
use strict;
use warnings;
use WWW::Curl::Easy;
use Digest::MD5 qw( md5_hex );
use JSON::XS qw( decode_json );
use URI::Escape qw( uri_escape );
BEGIN {
use Exporter ();
use vars qw($VER
est {
my ($self, $params, $method) = @_;
my $response;
my $fields = join("&", "format=json", map { join("=", $_, uri_escape($params->{$_})) } keys %$params);
if ( $method and $method
{ method => "auth.getToken", api_key => $self->{"api_key"} });
$self->{"api_token"} = decode_json($response)->{"token"} || 0;
return $self->{"api_token"};
}
sub auth_getSession {
my ($s