develooper Front page | perl.perl5.porters | Postings from December 2009

Re: deprecation of defined(%hash)

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
December 9, 2009 08:53
Subject:
Re: deprecation of defined(%hash)
Message ID:
20091209165335.GH2582@plum.flirble.org
On Tue, Dec 08, 2009 at 07:14:19AM -0800, Sean wrote:
> Why was this feature deprecated?  Is there another way to check for

Because it is very sensitive to the internal storage representation of
hashes and arrays. This makes code that uses it fragile.

> the existence of a hash or array without creating the associated glob?

It *doesn't* test for the existence of a hash or array.

Any code which assumes that this is what it does already subtly buggy.
If you want to check for the existence, then yes, you need to check the glob.

Currently it actually returns true if memory is allocated for the body of
an array or hash. What causes this to happen for a hash changed between 5.8
and 5.10, and may change again.

Nicholas Clark

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