[Rt-commit] rt branch, 4.0/perl-5.19.4-compat, updated. rt-4.0.18-3-ged759db
Alex Vandiver
alexmv at bestpractical.com
Wed Feb 12 19:06:57 EST 2014
The branch, 4.0/perl-5.19.4-compat has been updated
via ed759dbeafae5f11d3f998b487935b3eddc7a569 (commit)
from ad8d7a5e1d7741b21dd38268adeedcfbe5ed59fc (commit)
Summary of changes:
lib/RT/Config.pm | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit ed759dbeafae5f11d3f998b487935b3eddc7a569
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Wed Feb 12 18:53:49 2014 -0500
Avoid errors on inlined constant lists, used in 5.19.3 and up
Perl 5.19.3 (as of 15635cbf in perl.git) inlines list constants; that
is:
use constant FOO => qw(bar baz);
...stores an array reference in the symbol table instead of a GLOB, so
long as there is no $FOO, @FOO, or so forth in the package as well.
This is not entirely new; perl 5.10.0 began inlining scalar values,
which led to aaf2bb34, followed shortly by 3d835f0d.
Inlined arrays appearing in the symbol table bypasses the existing ref()
check, and causes the following errors during tests:
Not a GLOB reference at lib/RT/Config.pm line 1222.
Compilation failed in require at li/RT/Config.pm line 899.
BEGIN failed--compilation aborted [...]
The only case in which we can later de-reference $entry as a GLOB using
*{$entry} is if it _is_ a GLOB; GLOBs have ref($entry) eq '', which
makes them easy to distinguish from inlined constants, which are all
references of some form. Rather than continue adding to the
laundry-list blacklist of ref types, simply skip _all_ non-globs found
in the symbol table.
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index b1319c0..81e3c17 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -1208,11 +1208,14 @@ sub SetFromConfig {
my $entry = ${$pack}{$k};
next unless $entry;
- # get entry for type we are looking for
- # XXX skip references to scalars or other references.
- # Otherwie 5.10 goes boom. maybe we should skip any
- # reference
- next if ref($entry) eq 'SCALAR' || ref($entry) eq 'REF';
+ # Inlined constants are simplified in the symbol table --
+ # namely, when possible, you only get a reference back in
+ # $entry, rather than a full GLOB. In 5.10, scalar
+ # constants began being inlined this way; starting in 5.20,
+ # list constants are also inlined. Notably, ref(GLOB) is
+ # undef, but inlined constants are currently either REF,
+ # SCALAR, or ARRAY.
+ next if ref($entry);
my $ref_type = ref($ref);
-----------------------------------------------------------------------
More information about the rt-commit
mailing list