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. A "--" can separate arguments to dbsubprocess from the program and its arguments.

As with similar tools, like open2, the caller is expected to take care that the subprocess does not deadlock.

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

-w or --warnings

Enable warnings in user supplied code. (Default to include warnings.)

-E or --endsub SUB

Call Perl SUB when the subprocess terminates. The sub runs in the parent and is a Fred ending sub, see Fsdb::Support::Freds.

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 objects. (For this case, it cannot be Fsdb::BoundedQueue).

-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

dbpipeline(1), Fsdb(3)

CLASS FUNCTIONS

new

    $filter = new Fsdb::Filter::dbsubprocess(@arguments);

Create a new dbsubprocess object, taking command-line arguments.

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.

run

    $filter->run();

Internal: run over all data rows.

finish

    $filter->finish();

Internal: run over all data rows.

AUTHOR and COPYRIGHT

Copyright (C) 1991-2018 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.