Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^3: What's the right way to write a method which returns one line at a time from a file?

by bliako (Monsignor)
on Nov 22, 2020 at 09:48 UTC ( [id://11124012]=note: print w/replies, xml ) Need Help??


in reply to Re^2: What's the right way to write a method which returns one line at a time from a file?
in thread What's the right way to write a method which returns one line at a time from a file?

$self->{file_handle} = $self->get_filehandle( $self->{file} );

You can't reload or open a new file using the above. Additionally, you can end up having a discrepancy whereas $self->{file} points to one file and $self->{file_handle} to another. If you want that functionality, then I would set file_handle inside get_filehandle() with appropriate logic.

Replies are listed 'Best First'.
Re^4: What's the right way to write a method which returns one line at a time from a file?
by Cody Fendant (Hermit) on Nov 28, 2020 at 03:18 UTC

    I always run this code on one unique file name at a time, but thanks for the contribution, I appreciate it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11124012]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-03-28 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found