App-PipeFilter

 view release on metacpan or  search on metacpan

META.yml  view on Meta::CPAN

  ExtUtils::MakeMaker: 6.30
dynamic_config: 0
generated_by: 'Dist::Zilla version 4.300015, CPAN::Meta::Converter version 2.120921'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: 1.4
name: App-PipeFilter
requires:
  JSON::Path: 0
  JSON::XS: 0
  Moose: 0
  MooseX::Getopt: 0
  YAML::Any: 0
resources:
  bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=App-PipeFilter
  repository: git://github.com/rcaputo/app-pipefilter.git
version: 0.005

Makefile.PL  view on Meta::CPAN

    "bin/json2yaml",
    "bin/jsonpath",
    "bin/jsort",
    "bin/mysql2json",
    "bin/pcap2json"
  ],
  "LICENSE" => "perl",
  "NAME" => "App::PipeFilter",
  "PREREQ_PM" => {
    "JSON::Path" => 0,
    "JSON::XS" => 0,
    "Moose" => 0,
    "MooseX::Getopt" => 0,
    "YAML::Any" => 0
  },
  "VERSION" => "0.005",
  "test" => {
    "TESTS" => "t/*.t"
  }
);

TODO.otl  view on Meta::CPAN

[_] 61% Stable.
	[_] 90% Requirements for CPAN 1.000 release
		[X] 100% Support multiline JSON input using JSON::XS's incremental parser.
		[X] 100% Read input in large chunks, parsing incrementally.
		[X] 100% Rename jpath to jsonpath.
			Open the jpath name for JPath, which is something different.
			http://bluelinecity.com/software/jpath/
		[X] 100% Document the libraries.
			[X] 100% First draft utilities.
			[X] 100% First draft modules.
				[X] 100% lib/App/PipeFilter/Generic/Json.pm
				[X] 100% lib/App/PipeFilter/Generic.pm
				[X] 100% lib/App/PipeFilter/JsonCat.pm

dist.ini  view on Meta::CPAN

name              = App-PipeFilter
author            = Rocco Caputo <rcaputo@cpan.org>
license           = Perl_5
copyright_holder  = Rocco Caputo

[Prereqs]
JSON::Path     = 0
JSON::XS       = 0
Moose          = 0
MooseX::Getopt = 0
YAML::Any      = 0

[MetaResources]
bugtracker        = http://rt.cpan.org/Public/Dist/Display.html?Name=App-PipeFilter
repository        = http://github.com/rcaputo/app-pipefilter

[Repository]
git_remote = gh

lib/App/PipeFilter/JsonSort.pm  view on Meta::CPAN


use Moose;
extends 'App::PipeFilter::Generic';
with qw(
  App::PipeFilter::Role::Reader::Sysread
  App::PipeFilter::Role::Input::Json
  App::PipeFilter::Role::Writer::Print
  App::PipeFilter::Role::Transform::None
);

use JSON::XS;

has k => (
  is            => 'rw',
  isa           => 'ArrayRef',
  default       => sub { die "requires one or more -k flag" },
  lazy          => 1,
  documentation => 'key fields to sort on',
);

has n => (

lib/App/PipeFilter/MysqlToJson.pm  view on Meta::CPAN


use Moose;

extends 'App::PipeFilter::Generic';
with qw(
  App::PipeFilter::Role::Reader::LineByLine
  App::PipeFilter::Role::Output::Json
  App::PipeFilter::Role::Transform::None
);

use JSON::XS;

has _fields => (
  is  => 'rw',
  isa => 'ArrayRef',
);

before filter_file => sub {
  my ($self, $ifh, $ofh) = @_;

  # First line of MySQL bulk output (-B) is the field headers.

lib/App/PipeFilter/Role/Input/Json.pm  view on Meta::CPAN

package App::PipeFilter::Role::Input::Json;
{
  $App::PipeFilter::Role::Input::Json::VERSION = '0.005';
}

use Moose::Role;

use JSON::XS;

has _json => (
  is      => 'rw',
  isa     => 'JSON::XS',
  lazy    => 1,
  default => sub { JSON::XS->new() },
);

sub decode_input {
  my ($self, $buffer_ref) = @_;
  my (@return) = $self->_json()->incr_parse($$buffer_ref);
  $$buffer_ref = "";
  return @return;
}

1;

lib/App/PipeFilter/Role/Output/Json.pm  view on Meta::CPAN

package App::PipeFilter::Role::Output::Json;
{
  $App::PipeFilter::Role::Output::Json::VERSION = '0.005';
}

use Moose::Role;

use JSON::XS;

sub encode_output {
  # Skips $self in $_[0].
  return map { encode_json($_) . "\n" } @_[1..$#_];
}

1;

__END__



( run in 1.830 second using v1.01-cache-2.11-cpan-995e09ba956 )