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!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Relative path in test file
by Corion (Patriarch) on Jul 07, 2022 at 14:18 UTC | |
by ikegami (Patriarch) on Jul 07, 2022 at 19:12 UTC | |
by Anonymous Monk on Jul 07, 2022 at 20:35 UTC | |
by ikegami (Patriarch) on Jul 11, 2022 at 00:57 UTC | |
|
Re: Relative path in test file
by haukex (Archbishop) on Jul 07, 2022 at 20:34 UTC | |
by Dirk80 (Pilgrim) on Jul 08, 2022 at 07:44 UTC | |
|
Re: Relative path in test file
by JayBee (Scribe) on Jul 09, 2022 at 05:35 UTC | |
by haukex (Archbishop) on Jul 09, 2022 at 07:29 UTC |