logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Test::Trap::Builder::TempFile - Capture strategies using File::Temp

Author

       Eirik Berg Hanssen, "<ebhanssen@cpan.org>"

Bugs

       Please report any bugs or feature requests directly to the author.

Caveats

       Using File::Temp, we need privileges to create tempfiles.

       We need disk space for the output of every trap (it should clean up after the trap is sprung).

       Disk access may be slow -- certainly compared to the in-memory files of PerlIO.

       If the options specify (explicitly or via preserve on handles with) perlio custom layers, they may (or
       may not) fail to apply to the tempfile read and write handles.

       Threads?  No idea.  It might even work correctly.

Description

       This module by default provides a capture strategy based on File::Temp for the trap's output layers.

       The import accepts a name (as a string; default tempfile) and options (as a hashref; by default empty),
       and registers a capture strategy with that name and a variant implementation based on the options.

       Note that you may specify different strategies for each output layer on the trap.

       See also Test::Trap (:stdout and :stderr) and Test::Trap::Builder (output_layer).

Name

       Test::Trap::Builder::TempFile - Capture strategies using File::Temp

Options

       The following options are recognized:

   preserve_io_layers
       A boolean, indicating whether to apply to the handles writing to and reading from the tempfile, the same
       perlio layers as are found on the to-be-trapped output handle.

   io_layers
       A colon-separated string representing perlio layers to be applied to the handles writing to and reading
       from the tempfile.

       If the preserve_io_layers option is set, these perlio layers will be applied on top of the original
       (preserved) perlio layers.

Version

       Version 0.3.5

See Also