Subject: | Can't dclone a qr// |
It appears that freezing and thawing a qr// doesn't return the original object. To wit,
$ cat storable_re.pl
#!/usr/bin/perl -w
use strict;
use Storable qw(freeze thaw dclone);
my $r = qr/hello/i;
for my $mushy(0,1) {
$r = thaw freeze $r if $mushy;
print "(\$r is $r)\n";
print "Hi!\n" if $ARGV[0] =~ /$r/;
}
$ perl storable_re.pl Hello
($r is (?i-xsm:hello))
Hi!
($r is Regexp=SCALAR(0x8100028))
$
I posted this to London.pm which generated some interesting discussion and then some code by James Duncan that appears to go some way to fixing this (it includes Storable hooks).
http://www.ululate.co.uk/code/Regexp-Copy-0.01.tar.gz
The original discussion is at
http://london.pm.org/pipermail/london.pm/Week-of-Mon-20021125/015272.html
HTH!
Paul Makepeace