Test::TempDir::Factory(3)

NAME
Test::TempDir::Factory - A factory for creating Test::TempDir::Handle objects.

SYNOPSIS
    my $f = Test::TempDir::Factory->new;

    my $d = $f->create;

    $d->empty;

    # ...

    $d->cleanup

DESCRIPTION
This class creates Test::TempDir::Handle objects with the right "dir" parameter, taking care of obtaining locks, creating directories, and handling fallback logic.

ATTRIBUTES

"lock"
    Whether or not to enable locking.

    Defaults to true.

"lock_opts"
    A hash reference to pass to File::NFSLock.

    Defaults to "NONBLOCKING"

"lock_attempts"
    How many times to try to create and lock a directory.

    Defaults to 2.

"dir_name"
    The directory under "t_dir" to use.

    Defaults to "tmp"

"t_dir"
    Defaults to "t"

"use_subdir"
    Whether to always use a temporary subdirectory under the temporary root.

    This means that with a "success" cleanup policy all failures are retained.

    When disabled, "t/tmp" will be used directly as "temp_root".

    Defaults to true.

"subdir_template"
    The template to pass to "tempdir". Defaults to "File::Temp::TEMPXXX".

"handle_class"
    Defaults to Test::TempDir::Handle.

"verbose"
    Whether or not to "carp" diagnostics when falling back.

    If you subclass this factory and add a "logger" method a la MooseX::Logger then this parameter is ignored and all messages will be "warn"ed on the logger.

METHODS

"create"
    Create a Test::TempDir::Handle object with a proper "dir" attribute.