NAME

cs::Sink - a data sink


SYNOPSIS

use cs::Sink;


DESCRIPTION

The cs::Sink module provides generic data sink facilities. cs::Sinks may be created which wire to a variety of objects.


GENERAL FUNCTIONS

put(sink-args, data...)

Creates a new cs::Sink using the arguments in the array references by sink-args and writes the data to it. Returns undef on error.


OBJECT CREATION

open(path)

Create a new sink attached to the file named in path.

new cs::Sink (type,args...)

Create a new sink of the specified type. args... varies according to the type:

FILE, handle

Attach to the filehandle handle. Flushes any pending output in handle as a side-effect.

APPEND, path

Attach to the file named by path in append mode.

PATH, path

Attach to the file named in path in rewrite mode.

PIPE, shcmd

Attach to a pipe to the shell command shcmd.

ARRAY, arrayref

Attach to the array referenced by arrayref. Each Write() to the sink pushes a single string onto the array.

SCALAR, scalarref

Attach to the scalar referenced by scalarref. Each Write() appends to the scalar.

Sink, sink

Attach to the cs::Sink object sink. Typically used by subclasses to apply a filter to data before depositing in sink.

tmpSink(tmpnam-args)

Create a new sink object attached to a new temporary file allocated by cs::Pathname::tmpnam(tmpnam-args).


OBJECT METHODS

Path()

For sinks attached to files, return the pathname of the file.

Handle()

For sinks attached to files or filehandles, return the filehandle.

Put(data...)

Write all the data to the sink.


SEE ALSO

cs::Source(3), cs::Pathname(3)


AUTHOR

Cameron Simpson <cs@zip.com.au>