Subject: | Uses stacked file test options, fails on < 5.9.1 |
In, for example, lib/Mail/Builder/Image/File.pm, the file check uses stacked file tests, i.e.
croak(qq[Could not find/open file: $obj->{'path'}])
unless (-r -f $obj->{'path'});
according to perldoc -f -X:
As of Perl 5.9.1, as a form of purely syntactic
sugar, you can stack file test operators, in a way
that "-f -w -x $file" is equivalent to "-x $file
&& -w _ && -f _". (This is only syntax fancy: if
you use the return value of "-f $file" as an
argument to another filetest operator, no special
magic will happen.)
So on versions of Perl < 5.9.1, code using stacked file tests fail. This includes the test suite:
t/001_load.t ......... ok
t/002_pod.t .......... ok
t/003_podcoverage.t .. ok
t/004_address.t ...... ok
t/005_list.t ......... ok
t/006_attachment.t ... Could not find/open file: t/testfile.txt at t/006_attachment.t line 9
Show quoted text
Failed 23/23 subtests
t/007_image.t ........ Could not find/open file: t/testfile.gif at t/007_image.t line 9
Show quoted text
Failed 16/16 subtests
t/008_builder.t ...... 35/72 Could not find/open file: t/testfile.pdf at /usr/home/jamesw/Mail-Bui
lder-1.15/blib/lib/Mail/Builder/List.pm line 130
Show quoted text
Failed 13/72 subtests
$ perl -v | perl -
This is perl, v5.8.9 built for i386-freebsd
croak(qq[Could not find/open file: $obj->{'path'}])
unless (-r -f $obj->{'path'});
according to perldoc -f -X:
As of Perl 5.9.1, as a form of purely syntactic
sugar, you can stack file test operators, in a way
that "-f -w -x $file" is equivalent to "-x $file
&& -w _ && -f _". (This is only syntax fancy: if
you use the return value of "-f $file" as an
argument to another filetest operator, no special
magic will happen.)
So on versions of Perl < 5.9.1, code using stacked file tests fail. This includes the test suite:
t/001_load.t ......... ok
t/002_pod.t .......... ok
t/003_podcoverage.t .. ok
t/004_address.t ...... ok
t/005_list.t ......... ok
t/006_attachment.t ... Could not find/open file: t/testfile.txt at t/006_attachment.t line 9
Show quoted text
# Looks like your test exited with 2 before it could output anything.
t/006_attachment.t ... Dubious, test returned 2 (wstat 512, 0x200) Failed 23/23 subtests
t/007_image.t ........ Could not find/open file: t/testfile.gif at t/007_image.t line 9
Show quoted text
# Looks like your test exited with 2 before it could output anything.
t/007_image.t ........ Dubious, test returned 2 (wstat 512, 0x200) Failed 16/16 subtests
t/008_builder.t ...... 35/72 Could not find/open file: t/testfile.pdf at /usr/home/jamesw/Mail-Bui
lder-1.15/blib/lib/Mail/Builder/List.pm line 130
Show quoted text
# Looks like you planned 72 tests but ran 59.
# Looks like your test exited with 2 just after 59.
t/008_builder.t ...... Dubious, test returned 2 (wstat 512, 0x200) # Looks like your test exited with 2 just after 59.
Failed 13/72 subtests
$ perl -v | perl -
This is perl, v5.8.9 built for i386-freebsd