develooper Front page | perl.perl5.porters | Postings from June 2016

[perl #128479] Assigning hashref to symtable not an error since(somewhere before 5.21.10 )

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
June 25, 2016 14:33
Subject:
[perl #128479] Assigning hashref to symtable not an error since(somewhere before 5.21.10 )
Message ID:
rt-4.0.18-31462-1466865231-1629.128479-15-0@perl.org
On Sat Jun 25 07:31:51 2016, sprout wrote:
> $ perl5.12 -e 'BEGIN {$Foo::{bar} = {}} Foo::bar()'
> Cannot convert a reference to HASH to typeglob at -e line 1.
> $ perl5.10 -e 'BEGIN {$Foo::{bar} = {}} warn defined Foo::bar()'
> Warning: something's wrong at -e line 1.
> $ perl5.8.7 -e 'BEGIN {$Foo::{bar} = {}} Foo::bar()'
> Undefined subroutine &Foo::bar called at -e line 1.
> 
> So this was not terribly consistent to begin with. :-)

Even more interesting is that the behaviour changes back if I add the ampersand:

$ perl5.10 -e 'BEGIN {$Foo::{bar} = {}} &Foo::bar()'
Cannot convert a reference to HASH to typeglob at -e line 1.
$ perl5.12 -e 'BEGIN {$Foo::{bar} = {}} &Foo::bar()'
Cannot convert a reference to HASH to typeglob at -e line 1.
$ perl5.24.0 -e 'BEGIN {$Foo::{bar} = {}} &Foo::bar()'
Cannot convert a reference to HASH to typeglob at -e line 1.

(5.8.7 still gives ‘Undefined subroutine’.)

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=128479

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About