The treetops of a bad neighbourhood

rafael on 2003-02-13T12:39:11

Have I already mentioned here how much I dislike pseudo-hashes ? From perlref (5.8.0), we read : you may use an array reference in some contexts that would normally require a hash reference. That means that if you have mistakenly used an array ref where a hash ref was expected, (especially in the middle of a large and complex data structure, that's funnier), this may silently go very wrong (as perl doesn't even warn you that you're using a pseudo-hash). In my case, this meant two hours hunting down a Out of memory! / Callback called exit error.

(I think Jarkko added a deprecation warning for pseudo-hashes in 5.8.1-to-be, but I'm not sure.)

-- Title of this journal entry by David King (Happy Apple)


yes, indeed

jhi on 2003-02-13T14:12:40


kosh:/tmp/jhi/maint ; /p/bin/perl -wle '$a=[{foo=>1,bar=>2},"FOO","BAR"];print $a->{foo}'
FOO
kosh:/tmp/jhi/maint ; ./perl -wle '$a=[{foo=>1,bar=>2},"FOO","BAR"];print $a->{foo}'
Pseudo-hashes are deprecated at -e line 1.
FOO
kosh:/tmp/jhi/maint ;


It's the dereferencing of pseudo-hashes that triggers the warning.


Our long national nightmare is over.

schwern on 2003-02-14T05:41:32

____________________________________________________________________________
[ 17725] By: hv                                    on 2002/08/17  00:51:19
        Log: Subject: [PATCH] Remove pseudo-hashes (complete)
             From: Michael G Schwern <schwern@pobox.com>
             Date: Tue, 6 Aug 2002 13:05:10 -0700 (21:05 BST)
             Message-id: <20020806200510.GC31473@ool-18b93024.dyn.optonline.net>
     Branch: perl
           ! av.c doop.c dump.c embed.fnc embed.h ext/B/B/Concise.pm
           ! global.sym lib/fields.pm lib/fields.t lib/overload.pm mg.c
           ! op.c op.h pod/perldiag.pod pod/perlfunc.pod pod/perlref.pod
           ! pp.c pp_hot.c proto.h t/op/avhv.t t/op/hashwarn.t
_______________________________________________________________ _____________
...
____________________________________________________________ ________________
[ 18143] By: jhi                                   on 2002/11/15  04:37:24
        Log: Add pseudo-hashes deprecation warning (at each pseudo-hash access).
     Branch: maint-5.8/perl
           ! av.c pod/perldelta.pod pod/perldiag.pod t/lib/warnings/av
_____________________________________________________________ _______________

Whackity whack!