################################################################### #### NOTE env-var TEMP_DIRS_KEEP=1 will stop erasing tmp files ################################################################### use strict; use warnings; our $VERSION = '1.01'; use Test::More; use Test::More::UTF8; use FindBin; use File::Temp 'tempdir'; use File::Path qw( remove_tree ); my $curdir = $FindBin::Bin; my $tmpdir = File::Temp::tempdir( CLEANUP=>0, TEMPLATE => 'ooooooooXXXX' ); ok(-d $tmpdir, "tmpdir exists $tmpdir") or BAIL_OUT; #die 123; # this should keep the tmpdir intact for inspection #BAIL_OUT('bailing out'); # this should keep the tmpdir intact for inspection # if you set env var TEMP_DIRS_KEEP=1 when running # the temp files WILL NOT BE DELETED otherwise # they are deleted automatically diag "temp dir: $tmpdir ..."; do { remove_tree( $tmpdir ); diag "temp files cleaned!"; } unless exists($ENV{'TEMP_DIRS_KEEP'}) && $ENV{'TEMP_DIRS_KEEP'}>0; # END done_testing;