---
name: "Test::TempDir::Handle"
section: "3pm"
platform: "linux"
package: "libtest-tempdir-perl"
version: "0.11-2"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Test::TempDir::Handle"
---

# Test::TempDir::Handle(3pm)

A handle for managing a temporary directory root

## NAME

Test::TempDir::Handle - A handle for managing a temporary directory root

## VERSION

version 0.11

## SYNOPSIS

```
    use Test::TempDir::Handle;
    my $h = Test::TempDir::Handle->new( dir => dir("t/tmp") );
    $h->empty;
    # ...
    $h->cleanup; # will delete on success by default
```

## DESCRIPTION

This class manages a temporary directory.

## ATTRIBUTES

### "dir"

The Path::Class::Dir that is being managed.

### "lock"

No longer used.

### "cleanup\_policy"

One of `"success"`, `"always"` or `"never"`.

`"success"` means that `"cleanup"` deletes only if `"test_builder"` says the tests have passed.

### "test\_builder"

The Test::Builder singleton.

## METHODS

### "empty"

Cleans out the directory but doesn't delete it.

### "delete"

Cleans out the directory and removes it.

### "cleanup"

Calls `"delete"` if the `"cleanup_policy"` dictates to do so.

This is normally called automatically at destruction.

## SUPPORT

Bugs may be submitted through the RT bug tracker \<https://rt.cpan.org/Public/Dist/Display.html?Name=Test-TempDir\> (or bug-Test-TempDir@rt.cpan.org \<mailto:bug-Test-TempDir@rt.cpan.org\>).

There is also a mailing list available for users of this distribution, at \<http://lists.perl.org/list/perl-qa.html\>.

There is also an irc channel available for users of this distribution, at `"#perl"` on `"irc.perl.org"` \<irc://irc.perl.org/#perl-qa\>.

## AUTHOR

XXXX XXX'XX (Yuval Kogman) \<nothingmuch@woobling.org\>

## COPYRIGHT AND LICENCE

This software is copyright (c) 2006 by XXXX XXX'XX (Yuval Kogman).

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
