Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Confused by OO & tie

by iburrell (Chaplain)
on May 17, 2004 at 15:55 UTC ( #354012=note: print w/replies, xml ) Need Help??


in reply to Confused by OO & tie

Think of 'tie' as a way to have an object act like a hash. Perl calls those methods on the object to implement the hash functionality.
my $value = $hash{$key}; my $object = tied %hash; $value = $object->FETCH($key);
Most objects are blessed references to hashes; they are implemented as hashes internally. Perl does not have a mechanism for having named attributes (ie instance variables) of an object. People use hashes to store the internal state of the object.

It is quite possible to have a tied hash implemented using a hash reference object.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2023-03-27 22:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (66 votes). Check out past polls.

    Notices?