What's going on with overloading in 0.60? The docs say it will compare
a string-overloaded object with a string but when I run the code below
I get

=======
# x = stringy
not ok 1
#     Failed test (over.pm at line 8)
Operation `eq': no method found,
        left argument in overloaded package over,
        right argument has no overloaded magic at
/usr/lib/perl5/5.8.5/Test/More.pm line 1073.
=======

If I uncomment the eq overloading I get

=======
# x = stringy
not ok 1
#     Failed test (over.pm at line 8)
#     Structures begin differing at:
#          $got = Does not exist
#     $expected = 'stringy'
=======

which is even stranger.

F

use strict;
use warnings;

use Test::More 'no_plan';

my $x = over->new();
diag("x = $x")
is_deeply($x, "stringy");

package over;

use overload
#  'eq' => \&get_eq,
  '""' => \&get_s;

sub new { return bless {}, "over" }

sub get_s {  return "stringy" }

sub get_eq { return 1 }

Reply via email to