Subject: | Don't use string value of $! for checks |
Some of my smokers report failures of the form:
...
at t/11-copy-to-directory-with-rename.t line 35.
# Tests were run but no plan was declared and done_testing() was not seen.
# Looks like your test exited with 255 just after 3.
t/11-copy-to-directory-with-rename.t ..
Dubious, test returned 255 (wstat 65280, 0xff00)
All 3 subtests passed
...
This happens under two circumstances:
* perl version is < 5.23.0
* a non-English locale is in effect
Problem is probably this line:
while (not $opened and $! =~ /File exists/i ) {
Stringified errno messages are highly non-portable. The wording can differ between operating systems, and may be localized. It's better to use the symbolic value, e.g. $!{EEXISTS}. See perldoc Errno.
Also what's problematic: the error message looks quite empty in this case. There's nothing before "at t/11-opy-to-directory-with-rename.t ...".
Regards,
Slaven