Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Storable CPAN distribution.

Report information
The Basics
Id: 1827
Status: new
Priority: 0/
Queue: Storable

People
Owner: Nobody in particular
Requestors: cpan.org [...] paulm.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.05
Fixed in: (no value)



Subject: Can't dclone a qr//
Download (untitled) / with headers
text/plain 2.3k
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
From: jduncan [...] fotango.com
Download (untitled) / with headers
text/plain 435b
Show quoted text
> 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
It will actually freeze and thaw a qr regex. I'm not sure how to go about integrating it more tightly with Storable however, as I've not had time to investigate it yet. Regards, James.
From: markstos [...] cpan.org
Download (untitled) / with headers
text/plain 913b
I rediscovered this bug today with 2.08. I found it interesting because if I use a qr// as hash key, it's copied correctly. But as a hash value, it's not. This is with Perl 5.8.0. My output and test are below. I use this construct in my Data::FormValidator module. In a complex validation system I'm developing for a project, I need to deep copy the profile. Thanks! Mark use Test::More tests => 2; use Storable (qw/dclone/); use strict; my %hash = ( qr/as_key/ => qr/as_value/, ); my $copy = dclone(\%hash); is( (keys %$copy)[0], qr/as_key/, 'qr hash keys are preserved'); is($copy->{qr/as_key/},'as_value', 'qr hash values are preserved'); __END__ ok 1 - qr hash keys are preserved not ok 2 - qr hash values are preserved # Failed test (/usr/home/mark/tmp/storable_qr_bug.t at line 11) # got: 'Regexp=SCALAR(0x8202974)' # expected: 'as_value' # Looks like you failed 1 tests of 2.
From: markstos [...] cpan.org
Download (untitled) / with headers
text/plain 494b
Hello, The following fixes a bug in my test and is an example of a solution that now "works for me". I had read the above about Regexp::Copy, but it wasn't clear that this simple syntax would work: use Test::More tests => 2; use Regexp::Copy; use Storable (qw/dclone/); use strict; my %hash = ( qr/as_key/ => qr/as_value/, ); my $copy = dclone(\%hash); is( (keys %$copy)[0], qr/as_key/, 'qr hash keys are preserved'); is($copy->{qr/as_key/},qr/as_value/, 'qr hash values are preserved');


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.