On 6/27/07, Gary Stainburn <[EMAIL PROTECTED]> wrote:

It looks like Tie::Handle::CSV just dies when there are no records left.

I've looked at the perldoc for the module and I can't see any
reference to why it should do this, or how to stop it.

I can't say either, although it seems like odd behavior. Shouldn't it
return undef, as reading from a filehandle generally does at
end-of-file? It's probably worth asking the module's author to add
something to the documentation, if it is the desired behavior.

But you can almost certainly trap the error with an eval block. Maybe
as simply as this?

 while (my $csv_line = eval { readline $csv_fh }) {

Good luck with it!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to