-=head2 TEMPORARY DIRECTORY
-
-=head3 tmpdir
-
-Returns the absolute path to a tmp dir used in tests.
-
-=cut
-
-sub tmpdir {
- if (-d $tmpdir) {
- return $tmpdir;
- } else {
- $tmpdir = File::Temp->newdir(TEMPLATE => 'shredderXXXXX', CLEANUP => 0);
- return $tmpdir;
- }
-}
-
-=head2 create_tmpdir
-
-Creates a tmp dir if one doesn't exist already. Returns tmpdir path.
-
-=cut
-
-sub create_tmpdir { my $n = tmpdir(); File::Path::mkpath( [$n] ); return $n }
-
-=head3 cleanup_tmp
-
-Deletes all the tmp dir used in the tests.
-See also the C<test_name> function.
-
-=cut
-
-sub cleanup_tmp
-{
- my $dir = File::Spec->catdir(tmpdir(), test_name());
- return File::Path::rmtree( File::Spec->catdir( tmpdir(), test_name() ));
-}
-