in reply to Local tied methods refering to others

I was hooked on playing with tie for awhile a year or so ago, and implemented a few tied filehandle classes to see what I could make of it all. There is some good information in perltie, where it states: "A class implementing a tied filehandle should define the following methods: TIEHANDLE, at least one of PRINT, PRINTF, WRITE, READLINE, GETC, READ, and possibly CLOSE, UNTIE and DESTROY."

Also, a generic tied-handle class from which you can learn as well as derive your own tied handle classes comes with the standard Perl distribution as Tie::Handle (and Tie::StdHandle). It's documented here: Tie::Handle. I found it helpful to read through its framework to gather tips on how to write my own tied filehandle class. But it's also useful to know that Tie::Handle defines all of the necessary methods for a tied handle class. The idea is that you can make your own handle class a subclass of Tie::Handle, and then only go the work of overriding those methods that you wish to customize for your own purposes.


Dave

  • Comment on Re: Local tied methods refering to others