http://qs1969.pair.com?node_id=1149356

dallen16 has asked for the wisdom of the Perl Monks concerning the following question:

I'm working on my first CPAN package and have a question about how, really where the test scripts are run. I'd like to include a data file that is accessed by the test script (eg, 00_core.t). My question is what is the directory where the test scripts are run? Is it reliably the parent directory of the "t" (./t) directory? If I put the test data file in t/data (which some modules seem to do), can I assume that from the test script, the file path would be "./t/data/mytestdata.dat"?

Part B of wisdom seeking question is how careful / involved does the test script need to be to specify the directory path and filename in a portable manner?

Observation... looking at the test scripts in other packages, I noticed that is it common for test scripts to create a temporary file, write test data to the file, close it, then re-open it to use for one or more tests, and then delete (unlink) it. Is this the preferred way to do it? Seems like it might avoid potential problems with say end of line characters, EBCDIC machines, and questions about file directories ...

Many thanks for sharing your experience and wisdom.