At 2:40 PM +0100 4/27/01, Nicholas Clark wrote:
>On Thu, Apr 26, 2001 at 05:41:58PM -0700, Peter Prymmer wrote:
>>
> > Without the enclosed patch:
> > # Child expect 'Parent' got 'Parent
> > '
>Is this these "mailbox" things that have mentioned before?
It looks like it to me, yes, though I don't know what analysis Peter
might have done.
>Apart from sifting through the regression tests, is there any collected
>wisdom of how to write tests so that they work first time without taking
>up the time of the VMS porters?
Thanks for thinking of us. There are three things I can think of
right off that most commonly cause portability trouble, so I've
described them below. #2 and #3 probably affect other platforms as
well as VMS.
1.) Due to the treatment of carriage returns by the virtual IPC
device called a "mailbox," data that needs to be on one line and that
is written via a pipe (as nearly all tests are) should be written as
one integral I/O:
print 'a' . 'b' . "c\n"; # this works
print 'a', 'b', "c\n"; # this sometimes doesn't
print 'not ' if ! $ok; # this usually
print "ok 3\n"; # does not work
print $ok ? "ok 3\n" : "not ok 3\n"; # but this does
If we knew how to fix this it would be a bug; since any fix would be
non-trivial or even non-possible, it's a feature :-(.
2.) Processing of filename components should be done using the
appropriate File::Spec methods. For example, never create a file
specification by concatenating together strings with slashes between
them; use File::Spec->catfile() or File::Spec->catdir() instead.
Also, don't try to construct your own search for a temporary
directory (use File::Spec->tmpdir()) or a null device (use
File::Spec->devnull()).
3.) Filenames should not be used to store case sensitive
identifiers. For example, assume that if you search for a file with
a readdir() or glob operation, it's name will be case-flattened when
it is returned to you.
>I don't spot anything in perlport.pod about what to do, and what not to do.
I'll take a look in there for appropriate places to add/integrate the above.
--
________________________________________
"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser