summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/lib/overload.pm
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-12-03 03:02:54 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-12-03 03:02:54 +0000
commitba0a2090f574df90404f8a0bbe689389ce0ebcab (patch)
tree53f8d0ad53e5fc0f05d68a0073273080ef5bd392 /gnu/usr.bin/perl/lib/overload.pm
parent0121b80e4f69c2ad9631e8d20b5c91f3b2a40434 (diff)
Resolve conflicts for perl 5.8.2, remove old files, and add OpenBSD-specific scaffolding
Diffstat (limited to 'gnu/usr.bin/perl/lib/overload.pm')
-rw-r--r--gnu/usr.bin/perl/lib/overload.pm25
1 files changed, 14 insertions, 11 deletions
diff --git a/gnu/usr.bin/perl/lib/overload.pm b/gnu/usr.bin/perl/lib/overload.pm
index fb1a0d1236e..6fc69d60672 100644
--- a/gnu/usr.bin/perl/lib/overload.pm
+++ b/gnu/usr.bin/perl/lib/overload.pm
@@ -1,8 +1,8 @@
package overload;
-our $VERSION = '1.00';
+our $VERSION = '1.01';
-$overload::hint_bits = 0x20000;
+$overload::hint_bits = 0x20000; # HINT_LOCALIZE_HH
sub nil {}
@@ -84,10 +84,13 @@ sub Method {
sub AddrRef {
my $package = ref $_[0];
return "$_[0]" unless $package;
- bless $_[0], overload::Fake; # Non-overloaded package
- my $str = "$_[0]";
- bless $_[0], $package; # Back
- $package . substr $str, index $str, '=';
+
+ require Scalar::Util;
+ my $class = Scalar::Util::blessed($_[0]);
+ my $class_prefix = defined($class) ? "$class=" : "";
+ my $type = Scalar::Util::reftype($_[0]);
+ my $addr = Scalar::Util::refaddr($_[0]);
+ return sprintf("$class_prefix$type(0x%x)", $addr);
}
sub StrVal {
@@ -108,11 +111,11 @@ sub mycan { # Real can would leave stubs.
}
%constants = (
- 'integer' => 0x1000,
- 'float' => 0x2000,
- 'binary' => 0x4000,
- 'q' => 0x8000,
- 'qr' => 0x10000,
+ 'integer' => 0x1000, # HINT_NEW_INTEGER
+ 'float' => 0x2000, # HINT_NEW_FLOAT
+ 'binary' => 0x4000, # HINT_NEW_BINARY
+ 'q' => 0x8000, # HINT_NEW_STRING
+ 'qr' => 0x10000, # HINT_NEW_RE
);
%ops = ( with_assign => "+ - * / % ** << >> x .",