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

[perl #107370] *{""} stringification

Thread Next
From:
Father Chrysostomos via RT
Date:
June 14, 2012 17:56
Subject:
[perl #107370] *{""} stringification
Message ID:
rt-3.6.HEAD-5009-1339721799-49.107370-14-0@perl.org
On Sun Jan 01 13:14:40 2012, sprout wrote:
> *{""} stringifies as *main::.  But *main:: stringifies as
> *main::main::.
> 
> So it doesn’t round-trip properly.
> 
> I wonder what is the best way to fix this, or where there is any way
> that wouldn’t break anything.
> 
> This oddity makes Data::Dumper more complex that it would be
> otherwise.

I think the only way to fix this properly is to make *{$foo} equivalent
to *{__PACKAGE__ ."::$foo"} in all cases where $foo is a string that
does not contain a package separator.

That means that %{""} will refer to %:: in the main package, and to
%foo:: in the foo package.

-- 

Father Chrysostomos


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