PiEquals3 has asked for the wisdom of the Perl Monks concerning the following question:

I would like to use a Perl script to append records to a Dbase file. I am having a frustrating time finding any information on how to do this. Am I crazy for wanting to? Is this doable?

I feel very clueless about this, so I only ask that some wise kind soul point me to a module or a 'perl database interface' tutorial of some kind. 'Twould be most fervently appreciated. The databases I need to understand are Dbase III, Dbase IV, or FoxPro *.dbf files. Any of these will do.

Upon reflection, something else that would be less immediately useful, but endlessly more fascinating, is information about how a Dbase file is structured.. you know, so that I could read the file in directly and manipulate individual bytes.

--
Can an atheist be insured against acts of God?

Replies are listed 'Best First'.
Re: Can Perl write to Dbase?
by MrCromeDome (Deacon) on Jun 02, 2001 at 01:23 UTC
    What platform are you developing with? If you are programming in a Windoze environment, chances are your PC has ODBC drivers to access *.dbf files. All you need are to get the DBI and DBD::ODBC modules.

    There are some excellent resources to get you started on using these modules:

    DBI Reference
    DBD::ODBC Reference

    And for more general DBI programming help (this is how I got started):

    Short guide to DBI (The Perl Database Interface Module

    Hope this helps!
    MrCromeDome

Re: Can Perl write to Dbase?
by mr.nick (Chaplain) on Jun 02, 2001 at 00:56 UTC
    Dbase III/IV use a format called XBase. Search cpan for it.

    You can also check out the comp.lang.perl FAQ and search for Dbase. You might find what you need.

    And, if you are into hacking, check out this for some BASIC code that accesses a DBase III file.

Re: Can Perl write to Dbase?
by LD2 (Curate) on Jun 02, 2001 at 00:53 UTC
    First things first.. good place to check for modules is: CPAN.org. Check out CodeBase.
Re: Can Perl write to Dbase?
by tigervamp (Friar) on Jun 02, 2001 at 01:27 UTC
    I was once looking for the same thing you are, I never found anything adequate, there are a couple of things on CPAN, but I think they we either very limited, or required you to purchase proprietary libraries.

    Don't fret yet, You can find the file format for dbase files (and just about anything else) at www.wotsit.org, this is a GREAT site. I planned on writing a module to manipulate dbase III dbs but have never had the time, so I still have to use FoxPro w/ Perl (yuck). I really do not think that it would be difficult to write a good module to do this, and I am surprised that there is not one already (If someone finds/makes one, I would love to hear about it). It would just take a bit of time and testing.

    tigervamp