summaryrefslogtreecommitdiff
path: root/lib/overload.t
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2004-10-10 19:18:00 +0000
committerDave Mitchell <davem@fdisolutions.com>2004-10-10 19:18:00 +0000
commit131b3ad08b25bcfcb31b9933319b3186bdd13248 (patch)
tree49a4863bce88baf2d0050c81f56637cb3eb2c742 /lib/overload.t
parent54cf8e17f0d40db1139c694ac85474f8b0c35b86 (diff)
downloadperl-131b3ad08b25bcfcb31b9933319b3186bdd13248.tar.gz
Turn regcomp into a list op
p4raw-id: //depot/perl@23357
Diffstat (limited to 'lib/overload.t')
-rw-r--r--lib/overload.t26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/overload.t b/lib/overload.t
index c1b92c574a..7d076c2bfe 100644
--- a/lib/overload.t
+++ b/lib/overload.t
@@ -1174,5 +1174,29 @@ foreach my $op (qw(<=> == != < <= > >=)) {
}
}
}
+{
+ # check that overloading works in regexes
+ {
+ package Foo493;
+ use overload
+ '""' => sub { "^$_[0][0]\$" },
+ '.' => sub {
+ bless [
+ $_[2]
+ ? (ref $_[1] ? $_[1][0] : $_[1]) . ':' .$_[0][0]
+ : $_[0][0] . ':' . (ref $_[1] ? $_[1][0] : $_[1])
+ ], 'Foo493'
+ };
+ }
+
+ my $a = bless [ "a" ], 'Foo493';
+ test('a' =~ /$a/);
+ test('x:a' =~ /x$a/);
+ test('x:a:=' =~ /x$a=$/);
+ test('x:a:a:=' =~ /x$a$a=$/);
+
+}
+
+
# Last test is:
-sub last {492}
+sub last {496}