Phoenix.pm: Tied Variables

Beaves at aol.com Beaves at aol.com
Wed Jul 19 01:57:15 CDT 2000


Well, just to start a conversation...

I had to delve into tieing a HASH for my current project.  I had used a hash 
to store a users data, but when I decided to change to an object oriented 
system, I had to do something with all those HASH statements.

Tieing turned out to be a neat little tool so that I didn't have to worry if 
I missed a section of code that still used the hash statement.

Basically, that made the following statements equivalent.
$USER->get_uid  < same as > $USER{uid}
$USER->set_email('a at b.com') <same as > $USER{email} = 'a at b.com';

Perl has impressed me once again with its versatility...

I am no expert, but if anyone has a 'tie' question, let 'er rip...and I'll 
see what I can do.

Tieing does have limitations, but it is a neat tool to stash into your bag o' 
tricks.

Tim



More information about the Phoenix-pm mailing list