more useful options | |
PerlMonks |
readline error behaviorby TheHobbit (Pilgrim) |
on Nov 03, 2003 at 14:33 UTC ( [id://304120]=perlquestion: print w/replies, xml ) | Need Help?? |
TheHobbit has asked for the wisdom of the Perl Monks concerning the following question:
Fellows monks, As stated in perlfunc, readline(*HANDLE) returns undef at the end of file. The same obviously is true for the IO::File getline method. I'm writing a class inheriting from IO::File which should read records from a formatted file. Obviously, the main thing to do, maybe the only one, is to redefine getline method. My getline method looks like this:
The problem is that I'm unable to decide what should my method do when the file is not actually at EOF but the current line is malformed. The options appears to be 'the same thing' as IO::File->getline(), but I can not found what this 'thing' is by reading the doc, or die-ing, which would oblige me to always wrap the calls to the method into a eval block. What I'm asking from your wisdom is then:
Thanks for helping. Leo TheHobbit update: corrected some typos
Back to
Seekers of Perl Wisdom
|
|