Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

When will "Using a hash as a reference is deprecated" be enforced?

by cdarke (Prior)
on Mar 22, 2007 at 22:41 UTC ( [id://606114]=perlquestion: print w/replies, xml ) Need Help??

cdarke has asked for the wisdom of the Perl Monks concerning the following question:

I have a client with some major systems giving: "Using a hash as a reference is deprecated". We know why this is, and that the code will have to be corrected, but does anyone know which release will remove the feature altogether?
  • Comment on When will "Using a hash as a reference is deprecated" be enforced?

Replies are listed 'Best First'.
Re: When will "Using a hash as a reference is deprecated" be enforced?
by grinder (Bishop) on Mar 23, 2007 at 08:22 UTC
    % ./perl -Mwarnings -Mstrict -e'my %a = ( a => 1); print %a->{a}' Using a hash as a reference is deprecated at -e line 1

    Well, it still works in bleadperl, which is what will become 5.10. So you're safe for a number of years yet. Rafaël announced a code freeze some time back, so a major change that would force this syntax to be retired is unlikely to happen this round.

    Still, it would be a good idea to go through the code base and clean that up.

    • another intruder with the mooring in the heart of the Perl

Re: When will "Using a hash as a reference is deprecated" be enforced?
by cdarke (Prior) on Mar 23, 2007 at 00:31 UTC
    Thanks for the comments - I thought I was the only person who had never seen it before. Someone asked me to take a look at some code, and I admit I did a double-take when I saw: %hash->{thing} I did some research and apparently it used to be all the rage, although any advantages of this syntax escape me. The code is riddled with this stuff. Its removal has been discussed in perl-porters but I could not find any conclusion.
Re: When will "Using a hash as a reference is deprecated" be enforced?
by shmem (Chancellor) on Mar 22, 2007 at 23:06 UTC
    "Using a hash as a reference is deprecated"

    I guess I don't get what you mean from what you write. Could you provide a code example on how that's done?

    I know of hashes, and anonymous hashes, and taking references to a named hash, and passing around hash references (i.e. scalars). But "using a hash as a reference" sounds to me like some not-yet-heard-of magic of evaluating a hash (in scalar context?) and getting a reference to a hash thereof. Hmm.

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
        Wow. I wonder how much thought and discussion went into this dwimmery now deprecated? What more of the like is in perl that I don't know?

        I'm unable to interprete the shudders runinng down my back after knowing this right now. Pleasure? Fright? Have to work that out...

        --shmem

        _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                      /\_¯/(q    /
        ----------------------------  \__(m.====·.(_("always off the crowd"))."·
        ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://606114]
Approved by Joost
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2024-04-19 16:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found