Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

RE: Re-post: hashes frustration

by Perlmage (Acolyte)
on Sep 14, 2000 at 18:23 UTC ( #32462=note: print w/replies, xml ) Need Help??

in reply to Re-post: hashes frustration
in thread hashes frustration

You're not putting an object in the hash, so you can't call a method on it later. What you're actually doing is calling a class method on the package that corresponds to whatever pack() returns.

The first form works because you are re-blessing the packed version into the class that contains the unpack_name() method. I'm not sure why the second form works at all without resulting in an error, actually.

There are modules on the CPAN that will let you tie() a hash to a database and then store and fetch references (including blessed ones) from them, or you could roll your own with Storable or FreezeThaw or the like.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://32462]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2023-12-11 19:12 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (41 votes). Check out past polls.