in reply to Re: Best way to handle readline errors?
in thread Best way to handle readline errors?

That won't tell me if I had an error or if I reached EOF. I want to distinguish those two cases.
  • Comment on Re^2: Best way to handle readline errors?

Replies are listed 'Best First'.
Re^3: Best way to handle readline errors?
by lin0 (Curate) on Nov 11, 2006 at 03:06 UTC

    Update

    I just want to withdraw my answer to the question. I want to apologize to the OP for not answering the question and adding noise in the process. On my defense, I wanted to help but I guess I was too tired to think clearly

    All the best

    lin0

    Hi jrw,

    maybe you are interested in something like this piece of code I found and adapted from the perldoc for readline

    for (;;) { undef $!; unless (defined( $data = <$fh> )) { die $! if $!; last; # reached EOF } # do what you need to do with your data # like: # chomp($data); # ... }

    I hope this helps

    lin0
      Did you actually read what he posted?

        Update

        Thanks to ikegami for the comment. I am not sure what I was thinking yesterday. Having read the original question today made me realize that I was answering something completely different


        yes. but I might have missed the whole point