Skip Menu |

This queue is for tickets about the Const-Fast CPAN distribution.

Report information
The Basics
Id: 101775
Status: open
Priority: 0/
Queue: Const-Fast

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

Bug Information
Severity: (no value)
Broken in: 0.014
Fixed in: (no value)



Subject: Regexp references confuse Const::Fast
This code: say "zero level deep"; const my $zero => qr{123}; say "one level deep"; const my $one => { a => qr{123} }; say "two levels deep"; const my $two => { a => { b => qr{123} } }; dies while making C<$two> read-only. The reason is a bit complicated: - that inner hash has a refcount > 1 when seen from C<_make_readonly> - so C<_make_readonly> tries to clone it - but Storable refuses to touch regexes I haven't been able to figure out exactly where all those references are coming from, but one is definitely from C<@args> in C<const>. Using L<Clone/clone> instead of L<Storable/dclone> makes the whole thing work, regardless of refcounts.
On Tue Jan 27 12:29:40 2015, DAKKAR wrote: Show quoted text
> This code: > > say "zero level deep"; > const my $zero => qr{123}; > > say "one level deep"; > const my $one => { a => qr{123} }; > > say "two levels deep"; > const my $two => { a => { b => qr{123} } }; > > dies while making C<$two> read-only. > > The reason is a bit complicated: > - that inner hash has a refcount > 1 when seen from C<_make_readonly> > - so C<_make_readonly> tries to clone it > - but Storable refuses to touch regexes > > I haven't been able to figure out exactly where all those references > are coming from, but one is definitely from C<@args> in C<const>. > > Using L<Clone/clone> instead of L<Storable/dclone> makes the whole > thing work, regardless of refcounts.
I can reproduce this on my vendor's perl (debianish) but not on any self-compiled perl. I'm not sure what's going on there. Leon