1#!./perl -w 2 3BEGIN { 4 chdir 't' if -d 't'; 5 require './test.pl'; 6 set_up_inc('../lib'); 7 undef &Regexp::DESTROY; 8} 9 10plan tests => 2; 11 12my $destroyed; 13{ 14 sub Regexp::DESTROY { $destroyed++ } 15} 16 17{ 18 my $rx = qr//; 19} 20 21is( $destroyed, 1, "destroyed regexp" ); 22 23undef $destroyed; 24 25{ 26 my $var = bless {}, "Foo"; 27 my $rx = qr/(?{ $var })/; 28} 29 30is( $destroyed, 1, "destroyed regexp with closure capture" ); 31 32