Just thought that you (hopefully your teacher is already)should be aware there are some subtle bugs with the tie implementation.
Tie's FETCH called twice?
warning: tied vars may evaluate twice in logical expressions
warning: bug with tie (5.6.1)
But you ask why anyone would want to write a Tie? Well, outside of the many ties on CPAN and their usefullnes I would say the answer would in general be one of two reasons:
A) A programmer has a class whose behaviour conceptually is equivelent (or a superset) of the behaviour of a base type. So they decide to provide a Tie interface so that their users can stay within a familiar paradigm. Tie::IniFile
B) A programmer wants to intercept accesses to a base type to add some kind of extra processing. Tie::Refhash
C) The programmer wants to do something funky and unexpected Tie::Cycle
Yves / DeMerphq
---
Writing a good benchmark isnt as easy as it might look.
In reply to Re: Real world uses of the tie function.
by demerphq
in thread Real world uses of the tie function.
by Popcorn Dave
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |