in reply to Re: Reading 60k lines in file
in thread Reading 60k lines in file

The elements are confirmed to return properly, it works for several thousand images.
It's always the same line, yes. I have 100 of these files, 33k -60k lines. each one works up to ~4120, breaks. then ~15k more work with no error, then break with error code

Replies are listed 'Best First'.
Re^3: Reading 60k lines in file
by jakobi (Pilgrim) on Oct 08, 2009 at 16:35 UTC
    The elements are confirmed to return properly

    Not in your provided code.

    it works for several thousand images

    That translates to 'infrequent error', and to 'can process some files successfully'. As do the statements about another 15K ... .

    It's always the same line, yes.

    Same line in the code, or hopefully and VERY helpful in debugging: always the same $line in the INPUT!? (Update: is it always the same image file or not? See Ikegamis comment below as well! A warn "input: $line\n" is a bit verbose but will pinpoint the file in question)

    Please check this and do add code to check the returns esp. from split and gd.


    Update: So you say, it's not the same file triggering the error. Not so nice. Ok. Try Ikegami's code or update your own suitably. If things still fail, then change

    my $gd = $image->resize(160, 120);
    my $gd; eval{$gd=$image->resize(160, 120)}; do{warn "processing error for file: $line - skipping\n"; next} if $@ o +r not ref $gd;

    Similar caution for the 2nd gd call. I'm assuming you've some error + sanity checking by now for the open, split and gd calls.

      NOT the same file. Same line. Thanks for all ur help so far.