On Tue, 14 Sep 2004, Bryan Baldus wrote:
> When writing tests, should one take into account the file
> systems, or is the test end-user expected to deal with this?
I strongly recommend that you take it into account yourself. Fortunately,
that's easy...
> For example, in order to use dosEOFtest.t under MacPerl, I need to
> change:
> my $record_file_name = '/t/dosEOF.usmarc';
> to
> my $record_file_name = ':t:dosEOF.usmarc';
Path::Class is your friend:
use Path::Class qw(file);
my $record_file_name = file('t', 'dosEOF.usmarc');
(But watch out -- you may need to call $record_file_name->stringify under
some circumstances, since file(...) returns an object.)
Or File::Spec;
use File::Spec;
my $record_file_name = File::Spec->catfile('t', 'dosEOF.usmarc');
(I assume you meant 't/dosEOF.usmarc', not '/t/dosEOF.usmarc'.)
File::Spec may be the better choice, since (IIRC) it's part of the Perl
core distribution. Or at least more people are likely to have it already
installed.
Paul.
--
Paul Hoffman :: [EMAIL PROTECTED] :: [EMAIL PROTECTED]
http://www.nkuitse.com/