Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Can't retrieve last_record

by bv (Friar)
on Dec 08, 2009 at 23:00 UTC ( [id://811839]=note: print w/replies, xml ) Need Help??


in reply to Can't retrieve last_record

It looks like you might have a version of Xbase that is incompatible with your version of Perl. Get the latest version from CPAN and see if that works. Make sure you get the same Xbase, though. It looks like there are at least two by two different authors. It may create more errors and warnings, but they should be easier to deal with from the standpoint of your code.


@_=qw; Just another Perl hacker,; ;$_=q=print "@_"= and eval;

Replies are listed 'Best First'.
Re^2: Can't retrieve last_record
by AIM Systems (Initiate) on Dec 10, 2009 at 20:57 UTC

    Thanks for the advice.
    For the meantime, the prototype mismatch errors are proving to be non-fatal, though annoying.

    My intent is to look into rewriting the script in the new year using DBI drivers as I'm told that the Mysql module has been obsoleted

    ref: http://search.cpan.org/~capttofu/DBD-mysql-3.0008/lib/Mysql.pm#DESCRIPTION

    My concern is the inability to call the method "last_record" on 2 of 12 files.
    My understanding is that this method returns the zero-based number of the last record in the .dbf file. We use it to set the upper bound for looping through every record.
    As stated, only on 2 of 12 files can this method not be called.

    Can a structural abnormality in the FoxPro .dbf files be causing my grief?

      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...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://811839]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2024-04-23 21:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found