Thank you. It is far from elegant (not your fault:)) but perhaps my test files will be templated on the below from now on. The question still remains though re: global variables in packages ...
################################################################### #### 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 ins +pection # 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;
In reply to Re^2: "localise" package's our variables? They affect other packages (e.g. File::Temp::KEEP_ALL)
by bliako
in thread "localise" package's our variables? They affect other packages (e.g. File::Temp::KEEP_ALL)
by bliako
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |