coppit has asked for the wisdom of the Perl Monks concerning the following question:
- needs to be compatible with FileHandle
- needs to work if the file handle is a pipe (I use open('-|') to decompress data from STDIN using an external decompression program)
- needs to work if I happen to accidentally read eof (I've found that FreeBSD won't let me ungetc if I already read past EOF)
- takes an already opened handle
I'll obviously need to store the previously read (and unget'd) bytes. Should I tie a filehandle? Or should I implement a wrapper class for FileHandle? Or IO::Handle? As I understand it, I can't inherit from FileHandle because it doesn't really inherit from IO::*...
Lastly, if some kind soul wouldn't mind sharing an initial implementation with me, I would appreciate it.
Thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Best way to implement ungetstring?
by Abigail-II (Bishop) on Aug 19, 2003 at 20:50 UTC | |
|
Re: Best way to implement ungetstring?
by thor (Priest) on Aug 19, 2003 at 21:08 UTC | |
|
Re: Best way to implement ungetstring?
by waswas-fng (Curate) on Aug 19, 2003 at 22:03 UTC | |
by Anonymous Monk on Aug 19, 2003 at 23:37 UTC |