develooper Front page | perl.fwp | Postings from July 2003

Re: [OT] t/badfile....FAILED test 3

Thread Previous | Thread Next
Michael G Schwern
July 14, 2003 16:19
Re: [OT] t/badfile....FAILED test 3
Message ID:
On Mon, Jul 14, 2003 at 01:10:59PM -0700, Tim Dolezal wrote:
> #!/usr/bin/perl -w
> my $line;
> open(BAR, ">no-existing-file.$$") || die;
> eval {
> $line = <BAR> or die;
> };
> print STDERR ">>>$@<<<\n";
> close(BAR);
> unlink("no-existing-file.$$");
> On my machine (perl 5.8.0, Red Hat 9.0 on x86), this results in the
> following message:
> Value of <HANDLE> construct can be "0"; test with defined() at
> line 6.
> Filehandle BAR opened only for output at line 6.

From perldiag.

    Value of %s can be "0"; test with defined()
           (W misc) In a conditional expression, you used <HAN-
           DLE>, <*> (glob), "each()", or "readdir()" as a
           boolean value.  Each of these constructs can return a
           value of "0"; that would make the conditional expres-
           sion false, which is probably not what you intended.
           When using these constructs in conditional expres-
           sions, test their values with the "defined" operator.

Though it is likely this is a result of Redhat 9 / Unicode damage.
Try setting your LANG to C and see if it works.

Do not try comedy at home!  Milk & Cheese are advanced experts!  Attempts at
comedy can be dangerously unfunny!

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About