The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.


Fstream - a class to encapsulate a filehandle as a stream;


    use Fstream;


Fstream wraps a filehandle and provides methods that make it easier to write a lexer. Why doesn't Perl have ungetc?

Class Methods

new($filehandle, $name) Creates an Fstream object from $filehandle (a filehandle glob reference). $name is a string which is stored for debugging purposes and may be accessed with &name.

Object Methods

getc Returns the next character in the stream, or the empty string if the stream has been exhausted.
ungetc Pushes the last character read back onto the stream, where it will be returned on the next call to getc. You may only push one character back on the stream.
lineno Returns the line-number of the stream (based on the number of newlines seen).
name Returns the name that was given in the constructor.