diff options
author | Rick Delaney <rick@consumercontact.com> | 2004-10-01 21:04:49 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-10-04 10:57:15 +0000 |
commit | d411a6a9eb5df09116806ed1c441d30d37e8d5e8 (patch) | |
tree | 11fc1e6ca8b85f70c7028f3f3d5115fa0ffe117d /lib/overload.t | |
parent | 78b110b07ed3c6a4447914870f86996e65674caf (diff) | |
download | perl-d411a6a9eb5df09116806ed1c441d30d37e8d5e8.tar.gz |
Re: [perl #31793] Data::Dumper: Useqq interacts badly with overloading
Message-ID: <20041002050448.GB5059@biff.bort.ca>
p4raw-id: //depot/perl@23347
Diffstat (limited to 'lib/overload.t')
-rw-r--r-- | lib/overload.t | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/overload.t b/lib/overload.t index 519c6d8810..c1b92c574a 100644 --- a/lib/overload.t +++ b/lib/overload.t @@ -1097,8 +1097,6 @@ test ($a->xet('b'), 42); test (!defined eval { $a->{b} }); test ($@ =~ /zap/); -test (overload::StrVal(qr/a/) =~ /^Regexp=SCALAR\(0x[0-9a-f]+\)$/); - { package t229; use overload '=' => sub { 42 }, @@ -1139,6 +1137,23 @@ test (overload::StrVal(qr/a/) =~ /^Regexp=SCALAR\(0x[0-9a-f]+\)$/); sub numify { ${$_[0]} } } +{ + package perl31793; + use overload cmp => sub { 0 }; + package main; + my $o = bless [], 'perl31793'; + 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({}) =~ /^HASH\(0x[0-9a-f]+\)$/); + test (overload::StrVal(sub{1}) =~ /^CODE\(0x[0-9a-f]+\)$/); + test (overload::StrVal(\*GLOB) =~ /^GLOB\(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($no) =~ /^no_overload=ARRAY\(0x[0-9a-f]+\)$/); +} + # These are all check that overloaded values rather than reference addressess # are what is getting tested. my ($two, $one, $un, $deux) = map {new Numify $_} 2, 1, 1, 2; @@ -1160,4 +1175,4 @@ foreach my $op (qw(<=> == != < <= > >=)) { } } # Last test is: -sub last {484} +sub last {492} |