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

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

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

#!perl
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";
__END__

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
that.

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

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About