Filter::tee#

📦 std

Copies the source that follows use Filter::tee to a file, as the compiler reads it.

Synopsis#

use Filter::tee 'filename';     # empty the file first, then write
use Filter::tee '>filename';    # the same
use Filter::tee '>>filename';   # append

How it works#

import opens the file and installs a source filter. Each time the compiler reads more of the file being compiled, the filter passes the text on unchanged and writes a copy of it to the file; at the end of the source it closes the file and removes itself. Used after another filter (use Filter::decrypt; use Filter::tee ...), it copies what that filter produced, which is what makes it a debugging aid for filters.

This is a native implementation of tee.xs of Filter 1.65; its Filter/tee.pm is used unchanged.

Differences from upstream#

None.