"be consistent" | |
PerlMonks |
Relative path in test fileby Dirk80 (Pilgrim) |
on Jul 07, 2022 at 14:15 UTC ( [id://11145332]=perlquestion: print w/replies, xml ) | Need Help?? |
Dirk80 has asked for the wisdom of the Perl Monks concerning the following question: I have my test files in a directory "t", e.g. the file ..../t/mytest.t. In mytest.t I want to open a file by using a relative path. If I want that make test is successful, I have to use a relative path like this ./t/data/test.txt. But if would call e.g. perl mytest.t it would fail, because the relative path should be ./data/test.txt. Is there an elegant way to open a file with a relative path independent if I call it from the "t" directory or its parent directory? Thank you!
Back to
Seekers of Perl Wisdom
|
|