NAME
dbsubprocess - invoke a subprocess as a Fsdb filter object
SYNOPSIS
dbsubprocess program [arguments...]
DESCRIPTION
Run PROGRAM as a process, with optional ARGUMENTS as program arguments, feeding its standard input and standard output as fsdb streams.
This program is primarily for internal use by dbmapreduce.
Like dbpipeline, dbsubprocess program does have a Unix command; instead it is used only from within Perl.
OPTIONS
and the standard fsdb options:
- -d
-
Enable debugging output.
- -i or --input InputSource
-
Read from InputSource, typically a file, or - for standard input, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects.
- -o or --output OutputDestination
-
Write to OutputDestination, typically a file, or - for standard output, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue objects.
- --autorun or --noautorun
-
By default, programs process automatically, but Fsdb::Filter objects in Perl do not run until you invoke the run() method. The
--(no)autorun
option controls that behavior within Perl. - --help
-
Show help.
- --man
-
Show full manual.
SAMPLE USAGE
Input:
#fsdb name id test1
a 1 80
b 2 70
c 3 65
d 4 90
e 5 70
f 6 90
Command:
the following perl code:
use Fsdb::Filter::dbsubprocess;
my $f = new Fsdb::Filter::dbsubprocess(qw(cat));
$f->setup_run_finish;
exit 0;
Output:
#fsdb name id test1
a 1 80
b 2 70
c 3 65
d 4 90
e 5 70
f 6 90
# | dbsubprocess cat
SEE ALSO
CLASS FUNCTIONS
new
$filter = new Fsdb::Filter::dbsubprocess(@arguments);
Create a new dbsubprocess object, taking command-line arugments.
set_defaults
$filter->set_defaults();
Internal: set up defaults.
parse_options
$filter->parse_options(@ARGV);
Internal: parse options
setup
$filter->setup();
Internal: setup, parse headers.
_subproc_preprocessor
$filter->_subproc_preprocessor
(internal) Send output to the subprocess.
_subproc_postprocessor
$filter->_subproc_postprocessor
(internal) Read output from the subprocess and convert back to a fsdb stream.
_dbsubprocess_open2
($pid, $from_child, $to_child) = _open2('some', 'cmd', 'and', 'args');
Cribbed off of IPC::Open3.pm to avoid leaking symbols in perl-5.10.0, but simplified considerably. Basically the Symbol.pm
GENnn symbols were leaking, for whatever reason.
This command cannot fail (it will die if it fails).
run
$filter->run();
Internal: run over all data rows.
AUTHOR and COPYRIGHT
Copyright (C) 1991-2008 by John Heidemann <johnh@isi.edu>
This program is distributed under terms of the GNU general public license, version 2. See the file COPYING with the distribution for details.