Based on the OP code, something like this would be one way to go:
It looks like you're on the right track with handling problems inside the page loop. Just tweak the layout of the warning messages to suit your taste -- that is, think about tailoring the warnings to make them easy to count, search, summarize, etc.#!/usr/bin/perl -w use strict; use CAM::PDF; use CAM::PDF::PageText; use File::Spec::Functions; use File::Find::Rule; ## ... steps 1 and 2 as per OP code ... my $outputDir = 'F:/project_italia/firm_text'; ( -d $outputDir and -w _ ) or die "Output directory $outputDir not found or not writable\n"; open(LIST, ">>", 'F:/project_italia/firmList_pdf.txt' ) or die "Can't open destination.fil $!"; foreach (@allDir) { ... foreach (@filings) { my $fileName=$_; my $pdf = CAM::PDF->new($_) or do { warn "PDF->new failed on $_\n"; next; }; ... # open output text file (NB: ">>" appends, creates if necessar +y) open(DEST, ">>", "$outputDir/$textName[4].txt" ) or do { warn "Unable to append to $outputDir/$textName[4].txt: $!\ +n "; next; }; ...
In reply to Re: Help with error handling
by graff
in thread Help with error handling
by eversuhoshin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |