http://www.perlmonks.org?node_id=140161

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

Hi everyone,
I'm trying to make first foray into DBI and since I currently don't have access to mySQL or SQL or Oracle or anything similar I need to make do with what I currently have on hand. I was wondering:

1. If it is possible to use DBI with AppleWorks (yes I use a Mac)?
2. If it IS possible... what driver should I specify or should I go the AnyDBM_file route?

I have searched CPAN (as well as Perl Monks) and the AppleWorks site and found no mention of drivers for AppleWorks at all or even what type it is. If anyone (esp. any other Mac fans/users - don't be ashamed, I know some of you must be) could point me in the right direction it would be a big help to this initiate.

TIA,
markmoon

Replies are listed 'Best First'.
Re: DBI and Appleworks?
by Coyote (Deacon) on Jan 20, 2002 at 08:06 UTC
    There aren't DBD drivers for any of the common Macintosh desktop databases such as AppleWorks or Filemaker Pro, however if you need to access data in AppleWorks, you can use Mac::Glue. Mac::Glue is a perlish interface to Apple Events. I used Mac::Glue in conjunction with DBD::Proxy and DBI::ProxyServer to move some data from Filemaker to MySQL a few years back for one of my professors. I was pretty happy with the results.

    ----
    Coyote

Re: DBI and Appleworks?
by blakem (Monsignor) on Jan 20, 2002 at 07:23 UTC
    If you're just interested in learning DBI, the backend isn't particularly important. For instance, without any database at all you can start playing around with DBI using DBD::CSV. It uses CSV files instead of a backend database..

    -Blake

Re: DBI and Appleworks?
by moof1138 (Curate) on Jan 20, 2002 at 08:09 UTC
    FileMaker, which the AppleWorks DB is loosely based on lets you acces it via ODBC, so if you have/can get a copy, you might want to look into that. Otherwise, as far as AppleWorks goes, I haven't ever seen a DBD for the native format, but you can save your database as 'ascii text.' If you do so it will be a tab-delimited file. You could swap the tabs to commas (tr them in the script or find and replace in AppleWorks) and use DBD::CSV. Keep in mind that it will use Mac linebreaks (\r) rather than Unix (\n), so you might need to convert those too. Overall, it might just be easier to make your own CSV file, if you want to go that route.
Re: DBI and Appleworks?
by dmmiller2k (Chaplain) on Jan 20, 2002 at 06:28 UTC

    The sort answer is: I don't know.

    However, if you can rise above the Mac interface and determine the format Appleworks databases use, you may be able to write your own DBD driver for files (perhaps I am being náve, not owning a Mac anymore). This may involve some low-level understanding of the file format if there are no available APIs

    dmm

      Yeah, there doesn't seem to be any DBD for appleworks. Your best bet is to try DBD::AnyDBD, and see if you can get that to work for you. Its written for dBs that don't have a corresponding DBD; it will require more work, but its your best chance.
Re: DBI and Appleworks?
by lalo (Initiate) on Mar 06, 2002 at 05:44 UTC