Subject: | handle overloaded "==" and numify |
Date: | Sun, 28 Jun 2009 11:47:11 +1000 |
To: | bug-File-Temp [...] rt.cpan.org |
From: | Kevin Ryde <user42 [...] zip.com.au> |
With File::Temp 0.21 and recent debian i386 perl 5.10.0, the program
foo.pl below gets a warning
Argument "/tmp/0zfMwjrR4B" isn't numeric in numeric eq (==) at foo.pl line 9.
where I hoped it would compare the two handles by refaddr or whatnot as
usual for references.
Attempting a numize "0+$fh1" gets a similar warning. I struck this with
Perl6::Slurp. It tests $fh==\*ARGV to do something or other special on
ARGV. If the $fh you supply is a File::Temp object it gets the warning
above.
Perhaps the overload fallbacks in File::Temp are falling back a bit too
far, using stringize for numize too, or something.
use strict;
use warnings;
use File::Temp;
print File::Temp->VERSION,"\n";
my $fh1 = File::Temp->new;
my $fh2 = \*STDOUT;
if ($fh1 == $fh2) {
print "equal\n";
} else {
print "not equal\n";
}
exit 0;