In order to survive malformed input while keeping the normal procedure line-oriented, I need perhaps a getline variant with some sort of length limitation. I'd like to be able to give up gracefully when excessively long lines are detected.
It turns out getline is not a trivial target to emulate, what with all those variants of $INPUT_RECORD_SEPARATOR.
I have tried to prove the concept here, but with good chances to win an ugliness contest.
Should Perl perhaps offer native support for such a feature?