Skip to content

Commit

Permalink
cleanup_policy can be set from ENV
Browse files Browse the repository at this point in the history
  • Loading branch information
nothingmuch committed Jun 22, 2008
1 parent 672780a commit dc3da4b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions lib/Test/TempDir/Factory.pm
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ has dir_name => (
default => sub { dir($ENV{TEST_TEMPDIR} || $ENV{TEST_TMPDIR} || "tmp") },
);

has cleanup_policy => (
isa => "Str",
is => "rw",
default => sub { $ENV{TEST_TEMPDIR_CLEANUP} || "success" },
);

has t_dir => (
isa => Dir,
is => "rw",
Expand Down Expand Up @@ -85,6 +91,7 @@ sub create {
my $h = $self->new_handle(
dir => $path,
( defined($lock) ? ( lock => $lock ) : () ),
cleanup_policy => $self->cleanup_policy,
@args,
);

Expand Down
2 changes: 1 addition & 1 deletion t/factory.t
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use ok 'Test::TempDir::Factory';

my $tmp = dir( tempdir( CLEANUP => 1 ) );

delete @ENV{qw(TEST_TEMPDIR TEST_TMPDIR)};
delete @ENV{qw(TEST_TEMPDIR TEST_TMPDIR TEST_TEMPDIR_CLEANUP)};

my $f = Test::TempDir::Factory->new;

Expand Down

0 comments on commit dc3da4b

Please sign in to comment.