se;
use namespace::autoclean;
use Moose::Util::TypeConstraints;
coerce 'Bool', from class_type('JSON::XS::Boolean'), via { $_ ? 1 : 0 };
has id => (
isa => 'Int',
is => 'ro',
required =
e::autoclean;
use LWP::UserAgent;
use Net::CoverArtArchive::CoverArt;
use JSON::Any;
has json => (
default => sub { JSON::Any->new( utf8 => 1 ) },
lazy => 1,
is => 'ro'
);
has lwp => (
wp->get("$host/release/$release_mbid");
if ($res->is_success) {
my $index = $self->json->jsonToObj($res->decoded_content);
return [
map {
Net::CoverArt
package App::PipeFilter::JsonPcapToEthernet;
{
$App::PipeFilter::JsonPcapToEthernet::VERSION = '0.005';
}
use Moose;
extends 'App::PipeFilter::Generic::Json';
with 'App::PipeFilter::Role::Transform
::DataSource::VERSION = '0.01';
}
use strict;
use warnings;
use Moose;
use Clone qw/clone/;
use JSON::XS;
use Digest::MD5 qw/md5_hex/;
=head1 NAME
Data::Google::Visualization::DataSource - Google
tty pictures from your data. By design
it has a fair amount of Google-cruft, such as non-standard JSON and stuffing
configuration options in to a single CGI query parameter. It's also got somewhat
con
e_auth => $q->header('X-DataSource-Auth')
});
# Set it by hand...
->new({ reqId => 3, out => 'json', sig => 'deadbeef' });
C<new()> will set the following object attributes based on this, all bas
package App::PipeFilter::JsonToYaml;
{
$App::PipeFilter::JsonToYaml::VERSION = '0.005';
}
use Moose;
extends 'App::PipeFilter::Generic';
with (
"App::PipeFilter::Role::Reader::Sysread",
"App::
put::Json",
"App::PipeFilter::Role::Transform::None",
"App::PipeFilter::Role::Output::Yaml",
"App::PipeFilter::Role::Writer::Print",
);
1;
__END__
=pod
=head1 NAME
App::PipeFilter::JsonToYa
f JSON objects into YAML
=head1 VERSION
version 0.005
=head1 SYNOPSIS
Here is the json2yaml(1) pipeline filter.
#!/usr/bin/perl
use App::PipeFilter::JsonToYaml;
exit App::PipeFilter::JsonTo
serializer_class => 'JSON',
},
artifacts => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
extended
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
);
__PACKAGE__->set_primary_key('package_id');
__PACKAGE__->uuid_columns('
);
#__PACKAGE__->many_to_many( package_transitions => 'processes', 'transitions' );
sub TO_JSON {
my $self = shift;
my %parms = map { $_ => $self->$_ } grep { $self->$_ }
qw/pa
package App::PipeFilter::JsonCat;
{
$App::PipeFilter::JsonCat::VERSION = '0.005';
}
use Moose;
extends 'App::PipeFilter::Generic::Json';
with 'App::PipeFilter::Role::Transform::None';
1;
__END__
peFilter::JsonCat - useless use of cat(1) for JSON streams
=head1 VERSION
version 0.005
=head1 SYNOPSIS
Here is the jcat(1) pipeline filter.
#!/usr/bin/perl
use App::PipeFilter::JsonCat;
ex
it App::PipeFilter::JsonCat->new_with_options()->run();
=head1 DESCRIPTION
App::PipeFilter::JsonCat implements the jcat(1) pipeline filter.
Please see jcat(1) for usage instructions.
This module su
package Net::Fastly::Client;
use strict;
use warnings;
use JSON::Any;
=head1 NAME
Net::Fastly::Client - communicate with the Fastly HTTP API
=head1 SYNOPSIS
=head1 PROXYING
There are two ways to
my $port = $opts{base_port} ||= 80;
$self->{user} ||= $self->{username};
$self->{_json} = JSON::Any->new;
$self->{_ua} = Net::Fastly::Client::UserAgent->new($base, $port, $opts{pro
self->{password});
die "Unauthorized" unless $res->is_success;
my $content = $self->_json->from_json($res->decoded_content);
$self->{_cookie} = $res->header('set-cookie');
return w
package App::PipeFilter::PcapToJson;
{
$App::PipeFilter::PcapToJson::VERSION = '0.005';
}
use Moose;
extends 'App::PipeFilter::Generic';
with (
"App::PipeFilter::Role::Opener::PcapInput",
"App
::Role::Writer::Print",
"App::PipeFilter::Role::Input::ArrayBuffer",
"App::PipeFilter::Role::Transform::None",
"App::PipeFilter::Role::Output::Json",
);
1;
__END__
# vim: ts=2 sw=2 expandtab
package App::PipeFilter::JsonPath;
{
$App::PipeFilter::JsonPath::VERSION = '0.005';
}
use Moose;
extends 'App::PipeFilter::Generic::Json';
use JSON::Path;
has o => (
is => 'rw',
is
[JSON::Path]',
lazy => 1,
default => sub {
my $self = shift;
return [ map { JSON::Path->new($_) } @{$self->o()} ];
},
);
sub transform {
my $self = shift();
my @json
put;
my $c = 0;
foreach my $json_path (@json_paths) {
my $r = 0;
foreach my $json_value ($json_path->values($_[0])) {
$output[$r++]{"col$c"} = $json_value;
}
++$c;
}
re
reads JSON,
does no transformations on the deserialized data, and writes new JSON
one object per line.
package App::PipeFilter::JsonCat;
use Moose;
extends 'App::PipeFilter::Generic::Json';
gNode::Web;
use strict;
use warnings 'all';
use base 'ASP4::ConfigNode';
use Carp 'confess';
use JSON::XS;
sub new
{
my $class = shift;
my $s = $class->SUPER::new( @_ );
$s->{handler_resol
ding: $!";
local $/;
my $json = eval { decode_json( scalar(<$ifh>) ) }
or confess "Error parsing '$item->{include_routes}': $@";
ref($json) eq 'ARRAY'
or confess "Fil
e '$item->{include_routes}' should be an arrayref but it's a '@{[ ref($json) ]}' instead.";
@$json;
} : $_
} @original;
my $router = Router::Generic->new();
map { $router->add_route
END__
=pod
=abstract a generic pipeline filter.
=head1 SYNOPSIS
=for example App::PipeFilter::JsonToYaml
=head1 DESCRIPTION
App::PipeFilter::Generic is a generic shell pipeline filter. It is
de
For example, L<App::PipeFilter::JsonToYaml> extends the generic
pipeline filter with a role to read data in large chunks, a role to
parse that input as a stream of JSON objects, a role that doesn't
al
.
This method is usually implemented by Input roles.
=for example App::PipeFilter::Role::Input::Json decode_input
=head2 encode_output ARRAY
encode_output() accepts an array of Perl data structure
p::PipeFilter::JsonToTsv;
{
$App::PipeFilter::JsonToTsv::VERSION = '0.005';
}
use Moose;
extends 'App::PipeFilter::Generic';
# TODO - Refactor into a common role? Duplicated in JsonCut.pm.
has o
e::Input::Json",
"App::PipeFilter::Role::Transform::None",
"App::PipeFilter::Role::Output::Tsv",
);
1;
__END__
=pod
=head1 NAME
App::PipeFilter::JsonToTsv - translate streams of JSON objects
is the json2tsv(1) pipeline filter.
#!/usr/bin/perl
use App::PipeFilter::JsonToTsv;
exit App::PipeFilter::JsonToTsv->new_with_options()->run();
=head1 DESCRIPTION
App::PipeFilter::JsonToTsv i
package ASP4::Error;
use strict;
use warnings 'all';
use ASP4::HTTPContext;
use JSON::XS;
sub new
{
my $class = shift;
my ($err_str, %args);
if( @_ )
{
if( @_ == 1 )
{
$err_s
{stacktrace},
code => $code,
form_data => encode_json($Form) || "{}",
session_data => eval { encode_json(\%session_data) } || "{}",
http_referer => $ENV{HTTP_REFERER},
acktrace
A string - defaults to the value of C<$@>.
=head2 form_data
JSON-encoded C<$Form> object.
=head2 session_data
JSON-encoded C<$Session> object.
=head2 http_referer
Default value is C<$E
ic::Json;
use Moose;
extends 'App::PipeFilter::Generic';
with qw(
App::PipeFilter::Role::Reader::Sysread
App::PipeFilter::Role::Input::Json
App::PipeFilter::Role::Output::Json
)
ackage' => { meta_noindex => 1, } ],
qw(
MetaYAML
MetaJSON
),
[ 'AutoVersion' => { major => $self->major_version, } ],
qw[
README.pod
META.json
]
],
}
],
),
[ 'CopyFilesFromBuild' => {
copy => [qw[ META.json ]],
move => [qw[ .gitignore ]],
}
],
serializer_class => 'JSON',
},
formal_params => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
assignment
serializer_class => 'JSON',
},
extended_attr => {
data_type => 'TEXT',
is_nullable => 1,
serializer_class => 'JSON',
},
created =>
{process_name} ||= $attrs->{process_uid};
return $class->next::method($attrs);
}
sub TO_JSON {
my $self = shift;
my %params = map { $_ => $self->$_ } grep { $self->$_ }
qw/p
__PACKAGE__->VARS;
use LWP::UserAgent;
use HTTP::Request::Common;
use HTTP::Date 'time2iso';
use JSON::XS;
use Data::Dumper;
require ASP4;
our $ua;
sub run
{
my ($s, $context) = @_;
my $erro
ndler::Remote - Send your errors someplace else via http.
=head1 SYNOPSIS
In your C<asp4-config.json>:
...
"errors": {
"error_handler": "ASP4::ErrorHandler::Remote",
"post_erro
peConstraints;
use JSON;
subtype 'Bing::Search::Response::Types::JSON'
=> as 'HashRef';
coerce 'Bing::Search::Response::Types::JSON'
=> from 'Str'
=> via { decode_json( $_ ) };
has 'dat
a' => (
is => 'rw',
coerce => 1,
isa => 'Bing::Search::Response::Types::JSON',
trigger => \&_parse
);
with 'Bing::Search::Role::Response::Version';
with 'Bing::Search::Role::Response::Qu
" or "Video" or so forth and so on.
=item C<data>
A hashref, it initially contains the deparsed JSON structure. As objects are
populated, it is depopulated. Anything left over is something Bing se