base compiler detection at example of gcc
[ExtUtils-XBuilder.git] / t / lib.pl
blobbb57d71e9a7159695711ec1873956465151f2699
1 #!/usr/bin/perl
3 # lib.pl is the file where database specific things should live,
4 # whereever possible. For example, you define certain constants
5 # here and the like.
7 use strict;
8 use warnings FATAL => 'all';
10 use Cwd;
11 use File::Basename;
12 use File::Path;
13 use File::Slurp;
14 use File::Spec;
15 use File::Temp;
16 use JSON;
18 my $test_dir;
19 END { defined( $test_dir ) and rmtree $test_dir }
21 sub test_dir
23 unless( defined( $test_dir ) )
25 $test_dir = File::Spec->rel2abs( File::Spec->curdir () );
26 $test_dir = File::Spec->catdir ( $test_dir, "test_output_" . $$ );
27 $^O eq 'VMS' and $test_dir = VMS::Filespec::unixify($test_dir);
28 rmtree $test_dir;
29 mkpath $test_dir;
32 return $test_dir;
35 my $test_data;
37 sub test_data
39 unless( defined( $test_data ) )
41 my $dist_basedir = Cwd::abs_path( File::Spec->catdir( File::Basename::dirname($0), File::Spec->updir() ) );
42 $test_data = File::Spec->catdir( $dist_basedir, 'test_data' );
43 $^O eq 'VMS' and $test_data = VMS::Filespec::unixify($test_data);
46 return $test_data;