develooper Front page | perl.perl5.porters | Postings from September 2006

[PATCH] File::Temp doesn't handle cmp overloading

Thread Next
Rafael Garcia-Suarez
September 25, 2006 03:04
[PATCH] File::Temp doesn't handle cmp overloading
Message ID:
The following script fails with overload complaining it can't find any
"eq" method.

use strict;
use warnings;
use File::Temp ();
my $fh = new File::Temp();
print "file is $fh\n";
print 1, "$fh" eq "foo", "\n";
print 2, $fh   eq "foo", "\n";

That's because File::Temp only overloads the stringification.
The backportable fix is to add a method to File::Temp to implement
"cmp" (and the other ones by generation.) The attached patch does

However, does this mean that overload should generate cmp from stringification ?

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