The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

IPC::PrettyPipe::Stream - An I/O stream for an IPC::PrettyPipe pipline or command

SYNOPSIS

  use IPC::PrettyPipe::Stream;

  # standard constructor
  $stream = IPC::PrettyPipe::Stream->new( spec => $spec, %attr );
  $stream = IPC::PrettyPipe::Stream->new( spec => $spec, file => $file, %attr );

  # concise constructors
  $stream = IPC::PrettyPipe::Stream->new( $spec );
  $stream = IPC::PrettyPipe::Stream->new( [ $spec, $file ] );

DESCRIPTION

IPC::PrettyPipe::Stream objects represent I/O streams attached to either IPC::PrettyPipe or IPC::PrettyPipe::Cmd objects.

METHODS

new
  # named parameters; may provide additional attributes
  $stream = IPC::PrettyPipe::Stream->new( spec => $spec, file => $file, %attr );
  $stream = IPC::PrettyPipe::Stream->new( \%attr );

  # concise interface
  $stream = IPC::PrettyPipe::Stream->new( $spec );
  $stream = IPC::PrettyPipe::Stream->new( [ $spec, $file ] );

The available attributes are:

spec

A stream specification. See IPC::PrettyPipe::Stream::Utils for more information.

file

The optional file attached to the stream. A file is not needed if the specification is for a redirection or a close.

strict

If true, die if the stream specification requires a file but one is not provided, or it does not require a file and one is provided.

spec
  $spec = $stream->spec;

Retrieve the specification passed in to the constructor.

file
  $file = $stream->file;

Return the file passed in to the constructor (if one was).

quoted_file
  $file = $stream->quoted_file;

Return the file passed in to the constructor (if one was), appropriately quoted for passing as a single word to a Bourne compatible shell.

has_file
  $bool = $stream->has_file;

Returns true if a file was passed to the constructor.

requires_file
  $bool = $stream->requires_file;

Returns true if the stream specification requires a file.

Op
N
M
  $Op = $stream->Op;
  $N  = $stream->N;
  $M  = $stream->M;

Retrieve the components of the specification.

has_N
has_M
  $bool = $stream->has_N;
  $bool = $stream->has_M;

Return true if the stream specification contained the associated component.

apply
  ( $sub, @fh ) = $stream->apply;

Returns a subroutine which will implement the stream operations and and a list of filehandles or descriptors which would be affected. This routine is used by backend wrappers in conjunction with IO::ReStoreFH to handle pipe level stream operations (rather than command stream operations, which are done by the actual backend modules).

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>