in reply to Re: "localise" package's our variables? They affect other packages (e.g. File::Temp::KEEP_ALL)
in thread "localise" package's our variables? They affect other packages (e.g. File::Temp::KEEP_ALL)
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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: "localise" package's our variables? They affect other packages (e.g. File::Temp::KEEP_ALL)
by choroba (Cardinal) on Oct 11, 2024 at 11:28 UTC | |
|
Re^3: "localise" package's our variables? They affect other packages (e.g. File::Temp::KEEP_ALL)
by ikegami (Patriarch) on Oct 11, 2024 at 11:33 UTC | |
by bliako (Abbot) on Oct 11, 2024 at 12:36 UTC | |
by ikegami (Patriarch) on Oct 12, 2024 at 15:57 UTC |