diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2012-06-06 16:41:29 +0000 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-26 13:46:50 +0000 |
commit | 7c48e67cf07ee41bfde7139a62bb232bd23a4a48 (patch) | |
tree | 6d7686b5075bd5cba253dabf2e6c302acb3a147c /t/lib.pl | |
download | perl-dbi-tarball-master.tar.gz |
Diffstat (limited to 't/lib.pl')
-rw-r--r-- | t/lib.pl | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/t/lib.pl b/t/lib.pl new file mode 100644 index 0000000..e1512c6 --- /dev/null +++ b/t/lib.pl @@ -0,0 +1,33 @@ +#!/usr/bin/perl + +# lib.pl is the file where database specific things should live, +# whereever possible. For example, you define certain constants +# here and the like. + +use strict; + +use File::Basename; +use File::Path; +use File::Spec; + +my $test_dir; +END { defined( $test_dir ) and rmtree $test_dir } + +sub test_dir +{ + unless( defined( $test_dir ) ) + { + $test_dir = File::Spec->rel2abs( File::Spec->curdir () ); + $test_dir = File::Spec->catdir ( $test_dir, "test_output_" . $$ ); + $test_dir = VMS::Filespec::unixify($test_dir) if $^O eq 'VMS'; + rmtree $test_dir; + mkpath $test_dir; + # There must be at least one directory in the test directory, + # and nothing guarantees that dot or dot-dot directories will exist. + mkpath ( File::Spec->catdir( $test_dir, '000_just_testing' ) ); + } + + return $test_dir; +} + +1; |