App-Pipeline-Simple

 view release on metacpan or  search on metacpan

bin/spipe  view on Meta::CPAN

use Carp;

use strict;
use warnings;

use constant PROGRAMME_NAME => 'spipe';
# ABSTRACT: simple pipeline running interface
our $VERSION = '0.9.1'; # VERSION
# PODNAME: spipe

# raising $OUTPUT_AUTOFLUSH flag to get immediate reporting
$| = 1;

# catch interuptions cleanly
$SIG{'INT'} = 'CLEANUP';
sub CLEANUP { exit(1) }


# variables to catch command line options
our $DEBUG = '';
our $CONFIG = '';
our $DIR = '.';
our $GRAPHVIZ;
our $INPUT = '';
our $ITYPE  =  '';
#our $CONTINUE; # not implemented yet
our $START  =  '';
our $STOP  =  '';
our $VERBOSE;

GetOptions(
           'v|version'     => sub{ print PROGRAMME_NAME, ", version ", $VERSION, "\n";
				   exit(1); },
           'g|debug'       => \$DEBUG,
           'c|config:s'    => \$CONFIG,
           'd|directory:s' => \$DIR,
           'i|input:s'     => \$INPUT,
           'it|itype:s'    => \$ITYPE,
	   'graphviz'      => \$GRAPHVIZ,
#	   'continue'      => \$CONTINUE,
	   'start:s'       => \$START,
	   'stop:s'        => \$STOP,
	   'verbose:i'     => \$VERBOSE,
           'h|help|?'      => sub{ exec('perldoc',$0); exit(0) },
           );


my %args;
$args{config} = $CONFIG if $CONFIG;
$args{dir}   = $DIR;
$args{input} = $INPUT if $INPUT;
$args{itype} = $ITYPE if $ITYPE;
$args{start} = $START if $START;
$args{stop}  = $STOP  if $STOP;
$args{verbose} = $VERBOSE  if $VERBOSE;

unless (-e "$DIR/config.yml" or $CONFIG ) {
    croak "ERROR: Need either explicit config file or ".
	"it has to be found the working directory\n"
}



( run in 0.357 second using v1.01-cache-2.11-cpan-4e96b696675 )