in reply to Re^2: Can't retrieve last_record
in thread Can't retrieve last_record
My concern is the inability to call the method "last_record" on 2 of 12 files.
As the error message says ("Can't call method "last_record" on an undefined value"), the method can't be called because what you expect to be an object ($database) is undefined:
my $database = new XBase $database_file; my $records = $database->last_record() + 1;
This is most likely because the .dbf file could not be opened/read/parsed, so the constructor fails and returns undef instead of an object to indicate the error.
In other words, check for this case ($database being undefined), and only continue with the rest of the routine if things are ok.
And in case you can't simply skip those 2 files, I'm afraid there's more trouble ahead, i.e. figuring out the underlying problem of why the XBase constructor is failing...
|
|---|