summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/overload.pm6
-rw-r--r--lib/overload.t6
2 files changed, 6 insertions, 6 deletions
diff --git a/lib/overload.pm b/lib/overload.pm
index 237856f7ff..71b550ad53 100644
--- a/lib/overload.pm
+++ b/lib/overload.pm
@@ -93,11 +93,7 @@ sub AddrRef {
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) = @_;
diff --git a/lib/overload.t b/lib/overload.t
index 173a177088..a30a53b1eb 100644
--- a/lib/overload.t
+++ b/lib/overload.t
@@ -1139,9 +1139,12 @@ test ($@ =~ /zap/);
{
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]+\)$/);
@@ -1151,6 +1154,7 @@ test ($@ =~ /zap/);
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]+\)$/);
}
@@ -1199,4 +1203,4 @@ foreach my $op (qw(<=> == != < <= > >=)) {
# Last test is:
-sub last {496}
+sub last {497}