return sprintf("$class_prefix$type(0x%x)", $addr);
}
-sub StrVal {
- (ref $_[0] && OverloadedStringify($_[0]) or ref($_[0]) eq 'Regexp') ?
- (AddrRef(shift)) :
- "$_[0]";
-}
+*StrVal = *AddrRef;
sub mycan { # Real can would leave stubs.
my ($package, $meth) = @_;
{
package perl31793;
+ use overload cmp => sub { 0 };
+ package perl31793_fb;
use overload cmp => sub { 0 }, fallback => 1;
package main;
my $o = bless [], 'perl31793';
+ my $of = bless [], 'perl31793_fb';
my $no = bless [], 'no_overload';
test (overload::StrVal(\"scalar") =~ /^SCALAR\(0x[0-9a-f]+\)$/);
test (overload::StrVal([]) =~ /^ARRAY\(0x[0-9a-f]+\)$/);
test (overload::StrVal(\$o) =~ /^REF\(0x[0-9a-f]+\)$/);
test (overload::StrVal(qr/a/) =~ /^Regexp=SCALAR\(0x[0-9a-f]+\)$/);
test (overload::StrVal($o) =~ /^perl31793=ARRAY\(0x[0-9a-f]+\)$/);
+ test (overload::StrVal($of) =~ /^perl31793_fb=ARRAY\(0x[0-9a-f]+\)$/);
test (overload::StrVal($no) =~ /^no_overload=ARRAY\(0x[0-9a-f]+\)$/);
}
# Last test is:
-sub last {496}
+sub last {497}