in reply to Moose reading big file line by line
Now, what you really need to read a file line by line is an iterator, and Perl provides a very convenient file iterator, the readline function or the <$FH> operator.
If you really want to do it OO, you can create an open_file method, a next_line method that will just return the next line of input to the caller, and a close_file method, but that seems to me to be overkill: these three functions already exist in core Perl. Why would you want to wrap them into OO abstraction? I appreciate that you are trying to learn Moose, but, IMHO, using Moose just to read a file line by line is just plain over-engineering.
|
|---|