Test::DataDirs::Exporter - manage t/data and t/temp directories for your tests
version 0.1.2
Like the base class Test::DataDirs, this is a convenience which provides data directories from which to source information for your tests, and temp directories you can write data.
Declare some temp and data directories you need in your test script as below. These are implicitly relative to t/temp/<yourscriptname> and t/data/<yourscriptname>. Then you may refer to them using the imported variables, and assume the dirs exist and that the temp dirs have been (re-)created.
t/temp/<yourscriptname>
t/data/<yourscriptname>
# File: t/test-01.t use Test::DataDirs::Exporter ( temp => [temp_stuff => 'actual-dir', more_temp => 'another-dir'], data => [data_stuff => 'actual-dir'], ); print "My test data is checked into $data_stuff\n" print "below $data_dir\n" # Prints (except with absolute paths): # My test data is checked into t/data/test-01/actual-dir # below t/data/test-01 print "I can write temp data into $temp_stuff\n" print "and $more_temp, "below $temp_dir\n" # Prints (except with absolute paths): # I can write temp data into t/temp/test-01/actual-dir # and t/temp/test-01/another-dir below t/data/test-01
To install Test::DataDirs, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::DataDirs
CPAN shell
perl -MCPAN -e shell install Test::DataDirs
For more information on module installation, please visit the detailed CPAN module installation guide.