[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] MacPerl & Databases



At 05.14 -0500 1999.01.02, Matt Henderson wrote:
>I have no idea why this happened, so I thought I'd ask the list.

If you could actually provide a self-contained test script (including a
datafile to read from, maybe reading from DATA or something), it might be
easier to examine.


>Database Size
>=============
>My script uses AnyDBM_File, and the resulting DBM file given a 78k source
>text file turned out to be 28k. When I switched to DB_File, MacPerl
>crashed with 'out-of-memory' errors. I then performed a small (10 record)
>test using the two database implementations and the DB_File required
>*megabytes* while AnyDBM_File required only a few kilobytes.
>
>Is this normal, or is it likely I've done something wrong?

1.  What version of MacPerl?
2.  What machine do you have?
3.  What size hard drive and filesystem (HFS or HFS+), and if you know,
what size blocks on the hard drive?  You can possibly determine this by
making a text file with one character in it, and seeing how big it is.


>Locking & Portablility
>======================
>While I'm presently testing my Perl scripts locally on a Mac (running
>Quid Pro Quo) I'd eventually like to host the script on my Unix server.
>Is there a portable way to implement database file locking to prevent
>contention problems?

flock() does not work with MacPerl.  One method that can work is with a
separate lock file: create a file called "file.lock" and have your other
programs fail while "file.lock" exists.  That approach is flawed in some
ways (if your program dies, then everything is locked out until you fix it
manually or something), but it is an alternative.

flock() may be implemented in MacPerl in the future, but don't count on it.

--
Chris Nandor          mailto:pudge@pobox.com         http://pudge.net/
%PGPKey = ('B76E72AD', [1024, '0824090B CE73CA10  1FF77F13 8180B6B6'])

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch