App-RecordStream

 view release on metacpan or  search on metacpan

lib/App/RecordStream/Aggregator/Concatenate.pm  view on Meta::CPAN

use App::RecordStream::DomainLanguage::Registry;

use base 'App::RecordStream::Aggregator::MapReduce::Field';

sub new
{
  my $class = shift;
  my $delim = shift;
  my $field = shift;

  my $this = $class->SUPER::new($field);
  $this->{'delim'} = $delim;

  return $this;
}

sub new_from_valuation
{
  my $class     = shift;
  my $delim     = shift;
  my $valuation = shift;

  my $this = $class->SUPER::new_from_valuation($valuation);
  $this->{'delim'} = $delim;

  return $this;
}

sub map_field
{
  my ($this, $value) = @_;

  return [$value];

lib/App/RecordStream/Aggregator/Percentile.pm  view on Meta::CPAN

use App::RecordStream::DomainLanguage::Registry;

use base qw(App::RecordStream::Aggregator::InjectInto::Field);

sub new
{
  my $class      = shift;
  my $percentile = shift;
  my $field      = shift;

  my $this = $class->SUPER::new($field);
  $this->{'percentile'} = $percentile;

  return $this;
}

sub new_from_valuation
{
  my $class      = shift;
  my $percentile = shift;
  my $valuation  = shift;

  my $this = $class->SUPER::new_from_valuation($valuation);
  $this->{'percentile'} = $percentile;

  return $this;
}

sub initial {
  return [];
}

sub combine_field

lib/App/RecordStream/Aggregator/PercentileMap.pm  view on Meta::CPAN

  # be careful, split(' ', ...) is extreme magic split, not split on one space
  return [split(' ', $percentiles)];
}

sub new
{
  my $class       = shift;
  my $percentiles = shift;
  my $field       = shift;

  my $this = $class->SUPER::new($field);
  $this->{'percentiles'} = _make_percentiles($percentiles);

  return $this;
}

sub new_from_valuation
{
  my $class       = shift;
  my $percentiles = shift;
  my $valuation   = shift;

  my $this = $class->SUPER::new_from_valuation($valuation);
  $this->{'percentiles'} = _make_percentiles($percentiles);

  return $this;
}

sub initial {
  return [];
}

sub combine_field

lib/App/RecordStream/Clumper/KeyLRU.pm  view on Meta::CPAN

use App::RecordStream::LRUSheriff;

use base 'App::RecordStream::Clumper::Key';

sub new
{
  my $class = shift;
  my $field = shift;
  my $size = shift;

  my $this = $class->SUPER::new($field);

  $this->{'size'} = $size;

  return $this;
}

sub new_from_valuation
{
  my $class = shift;
  my $name = shift;
  my $valuation = shift;
  my $size = shift;

  my $this = $class->SUPER::new_from_valuation($name, $valuation);

  $this->{'size'} = $size;

  return $this;
}

sub long_usage
{
  return <<EOF;
Usage: keylru,<keyspec>,<size>

lib/App/RecordStream/Deaggregator/Split.pm  view on Meta::CPAN


use base 'App::RecordStream::Deaggregator::Field';

sub new
{
  my $class = shift;
  my $old_field = shift;
  my $delim = shift;
  my $new_field = shift;

  my $this = $class->SUPER::new($old_field);

  $this->{'delim'} = make_delim($delim);
  $this->{'new_field'} = $new_field;

  return $this;
}

sub new_from_valuation
{
  my $class = shift;
  my $valuation = shift;
  my $delim = shift;
  my $new_field = shift;

  my $this = $class->SUPER::new_from_valuation($valuation);

  $this->{'delim'} = $delim; # not make_delim, let the domain language sort it out!
  $this->{'new_field'} = $new_field;

  return $this;
}

sub make_delim
{
  my $delim = shift;

lib/App/RecordStream/Deaggregator/Unarray.pm  view on Meta::CPAN

use App::RecordStream::DomainLanguage::Registry;

use base 'App::RecordStream::Deaggregator::Field';

sub new
{
  my $class = shift;
  my $old_field = shift;
  my $new_field = shift;

  my $this = $class->SUPER::new($old_field);

  $this->{'new_field'} = $new_field;

  return $this;
}

sub new_from_valuation
{
  my $class = shift;
  my $valuation = shift;
  my $new_field = shift;

  my $this = $class->SUPER::new_from_valuation($valuation);

  $this->{'new_field'} = $new_field;

  return $this;
}

sub deaggregate_field
{
  my $this = shift;
  my $values = shift;

lib/App/RecordStream/Deaggregator/Unhash.pm  view on Meta::CPAN


use base 'App::RecordStream::Deaggregator::Field';

sub new
{
  my $class = shift;
  my $old_field = shift;
  my $new_key_field = shift;
  my $new_value_field = shift;

  my $this = $class->SUPER::new($old_field);

  $this->{'new_key_field'} = $new_key_field;
  $this->{'new_value_field'} = $new_value_field;

  return $this;
}

sub new_from_valuation
{
  my $class = shift;
  my $valuation = shift;
  my $new_key_field = shift;
  my $new_value_field = shift;

  my $this = $class->SUPER::new_from_valuation($valuation);

  $this->{'new_key_field'} = $new_key_field;
  $this->{'new_value_field'} = $new_value_field;

  return $this;
}

sub deaggregate_field
{
  my $this = shift;

lib/App/RecordStream/Operation/collate.pm  view on Meta::CPAN


sub print_usage {
  my $this    = shift;
  my $message = shift;

  if ( $message && UNIVERSAL::isa($message, 'CODE') ) {
    $message->();
    exit 1;
  }

  $this->SUPER::print_usage($message);
}

sub add_help_types {
  my $this = shift;
  $this->use_help_type('keyspecs');
  $this->use_help_type('keygroups');
  $this->use_help_type('keys');
  $this->use_help_type('domainlanguage');
  $this->use_help_type('clumping');
  $this->add_help_type(

lib/App/RecordStream/Operation/decollate.pm  view on Meta::CPAN

sub print_usage
{
  my $this = shift;
  my $message = shift;

  if($message && UNIVERSAL::isa($message, 'CODE')) {
    $message->();
    exit(1);
  }

  $this->SUPER::print_usage($message);
}

sub add_help_types
{
  my $this = shift;
  $this->use_help_type('domainlanguage');
  $this->add_help_type(
    'deaggregators',
    sub { print App::RecordStream::Deaggregator->list_implementations(); },
    'List the deaggregators'

lib/App/RecordStream/Operation/help.pm  view on Meta::CPAN

Examples:
   Show help for fromcsv command
      recs help fromcsv
   Show help for code snippets
      recs help --snippet
USAGE
}

sub init_help {
  my $this = shift;
  $this->SUPER::init_help(@_);

  # Make all help types available, sans the redundant "help-" prefix
  for my $type (keys %{ $this->{'HELP_TYPES'} }) {
    $this->use_help_type($type);
    $this->{'HELP_TYPES'}{$type}{OPTION_NAME} ||= $type;
  }
}

sub init {
  my $this = shift;

lib/App/RecordStream/Operation/multiplex.pm  view on Meta::CPAN


sub print_usage {
  my $this    = shift;
  my $message = shift;

  if ( $message && UNIVERSAL::isa($message, 'CODE') ) {
    $message->();
    exit 1;
  }

  $this->SUPER::print_usage($message);
}

sub add_help_types {
  my $this = shift;
  $this->use_help_type('keyspecs');
  $this->use_help_type('keygroups');
  $this->use_help_type('keys');
  $this->use_help_type('domainlanguage');
  $this->use_help_type('clumping');
  $this->add_help_type(

lib/App/RecordStream/Stream/Sub.pm  view on Meta::CPAN

use App::RecordStream::Stream::Base;

use base 'App::RecordStream::Stream::Base';

sub new
{
  my $class = shift;
  my $record_sub = shift;
  my $line_sub = shift;

  my $this = $class->SUPER::new();

  $this->{'RECORD_SUB'} = $record_sub;
  $this->{'LINE_SUB'} = $line_sub;

  bless $this, $class;

  return $this;
}

sub accept_record



( run in 0.445 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )