NAME

IPC::PrettyPipe::Stream::Utils - support utilities for streams

SYNOPSIS

use IPC::PrettyPipe::Stream::Utils qw[ parse_spec ];

$opc = parse_spec( $op );

DESCRIPTION

Stream Specification

A stream specification is a string which may take one of the forms in the Spec column:

 Spec    Op    Mode    File    Function
 ----    ---  ----    ----    -----------------------
 <       <     I       y       read from file via fd 0
 <N      <     I       y       read from file via fd N
 >       >     O       y       write to file via fd 1
 >N      >     O       y       write to file via fd N

 >&      >&    O       n       redirect fd 2 to fd 1
 &>      &>    O       n       redirect fd 2 to fd 1

 N<&-    <&-   ?       n       close fd N

 M<&N    <&    I       n       dup fd M as fd N
 N>&M    >&    O       n       dup fd M as fd N

where
  • M and N are integers indicating file descriptors

  • Mode indicates input (I), output (O), or not applicable (?)

  • File indicates whether an additional parameter with a file name is required.

Any resemblance to stream operators used by IPC::Run is purely non-coincidental.

FUNCTIONS

IPC::PrettyPipe::Stream::Utils exports the following functions upon request:

parse_spec
$components = parse_spec( $spec )

Parse a stream specification into components Op, N, and M. Returns a hashref with the information indexed by the component names.

If the specification indicates that additional parameters are required (such as the name of a file to be read or written to), the key param will be set.

COPYRIGHT & LICENSE

Copyright 2014 Smithsonian Astrophysical Observatory

This software is released under the GNU General Public License. You may find a copy at

http://www.fsf.org/copyleft/gpl.html

AUTHOR

Diab Jerius <djerius@cfa.harvard.edu>