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


version 0.12


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

  $opc = parse_spec( $op );


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

  • 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.


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

  $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.


Please report any bugs or feature requests on the bugtracker website or by email to

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.


The development version is on github at and may be cloned from git://


Please see those modules/websites for more information related to this module.


Diab Jerius <>


This software is Copyright (c) 2018 by Smithsonian Astrophysical Observatory.

This is free software, licensed under:

  The GNU General Public License, Version 3, June 2007