develooper Front page | perl.perl5.porters | Postings from July 2013

[perl #69456] ck_rvconst rejects glob-as-scalar

Thread Next
Father Chrysostomos via RT
July 3, 2013 05:32
[perl #69456] ck_rvconst rejects glob-as-scalar
Message ID:
On Mon Sep 28 15:34:35 2009, wrote:
> This is a bug report for perl from,
> generated with the help of perlbug 1.36 running under perl 5.10.0.
> -----------------------------------------------------------------
> [Please enter your report here]
> I'm doing some XS work that involves generating rv2sv ops where the
> reference is a const op holding an RV that points at a suitable SV.
> If the suitable SV is a GV, ck_rvconst rejects it, saying "Constant is
> not a SCALAR reference".  Actually GVs are valid as scalars:
> $ perl -lwe '$foo=123; $glob=*foo; print ${*{\$glob}{SCALAR}}'
> 123
> so I reckon ck_rvconst should not be rejecting it.  It should probably
> also allow SVt_PVLV scalars.

It also breaks things like this:

use constant foo=>\$_;
bless \$_;
use overload '@{}' => sub { [1,2,3] };
print foo->[1], "\n";

Why shouldn’t that work?  I suggest removing that compile time check
altogether (but still making sure references don’t fall through to the
bareword lookup [come to think of it, other stuff probably also makes
its way through that code path erroneously (such as globs)]).


Father Chrysostomos

via perlbug:  queue: perl5 status: open

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About