CC: | perl5-porters [...] perl.org, bug-Marpa-R2 [...] rt.cpan.org |
Subject: | [perl #119047] Bleadperl v5.19.2-138-g137da2b breaks JKEGL/Marpa-R2-2.064000.tar.gz |
Date: | Sun, 28 Jul 2013 12:57:48 -0700 |
To: | "OtherRecipients of perl Ticket #119047":; |
From: | "Father Chrysostomos via RT" <perlbug-followup [...] perl.org> |
On Sat Jul 27 14:28:11 2013, andreas.koenig.7os6VVqR@franz.ak.mind.de wrote:
Show quoted text
> git bisect
> ----------
> 137da2b05b4b7628115049f343163bdaf2c30dbb is the first bad commit
> commit 137da2b05b4b7628115049f343163bdaf2c30dbb
> Author: Father Chrysostomos <sprout@cpan.org>
> Date: Sun Jun 30 20:26:34 2013 -0700
>
> [perl #79908] Stop sub inlining from breaking closures
It is relying on a bug in perl.
It uses a single lexical variable whose value keeps changing, and
creates closures that are not really closures but snapshots of the
current value of the variable.
The cited commit fixes that bug, such that closures work properly.
(What it was relying on was an awful hack that, at the time it was
added, was *supposed* to be transparent, but got implemented in a way
that was not.)
The attached patch makes Marpa::R2 use constant.pm to create constants.
Unfortunately, it is more complicated than it ought to be, because
constant.pm does not accept fully-qualified constant names. Is there
any reason it shouldn’t?
--
Father Chrysostomos
---
via perlbug: queue: perl5 status: new
https://rt.perl.org:443/rt3/Ticket/Display.html?id=119047
diff -rup Marpa-R2-2.064000-EIBDuD-orig/lib/Marpa/R2/Internal.pm Marpa-R2-2.064000-EIBDuD/lib/Marpa/R2/Internal.pm
--- Marpa-R2-2.064000-EIBDuD-orig/lib/Marpa/R2/Internal.pm 2013-07-11 09:25:42.000000000 -0700
+++ Marpa-R2-2.064000-EIBDuD/lib/Marpa/R2/Internal.pm 2013-07-28 12:55:22.000000000 -0700
@@ -19,6 +19,7 @@ use 5.010;
use strict;
use warnings;
use Carp;
+use constant;
use vars qw($VERSION $STRING_VERSION);
$VERSION = '2.064000';
@@ -84,8 +85,10 @@ sub Marpa::R2::offset {
Marpa::R2::exception("Unacceptable field name: $field")
if $field =~ /[^A-Z0-9_]/xms;
- my $field_name = $prefix . $field;
- *{$field_name} = sub () {$offset};
+ local *Marpa::R2::Internal::_temp:: = $prefix;
+ package Marpa::R2::Internal::_temp;
+ no warnings;
+ constant->import($field => $offset);
} ## end for my $field (@fields)
return 1;
} ## end sub Marpa::R2::offset