homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam

The Geek Culture Forums


Post New Topic  New Poll  Post A Reply
my profile | directory login | | search | faq | forum home
  next oldest topic   next newest topic
» The Geek Culture Forums   » Other Geeky Stuff   » Ask a Geek!   » Perl ... where is GDBM_File?

 - UBBFriend: Email this page to someone!    
Author Topic: Perl ... where is GDBM_File?
magefile
Highlie
Member # 2918

Member Rated:
5
Icon 1 posted March 26, 2006 19:39      Profile for magefile     Send New Private Message       Edit/Delete Post   Reply With Quote 
Kind of a weird perl question - I know several folks here are Perl types, so here goes:

I've done my preliminary research and found that GDBM_File comes with an out-of-box install of perl (at least, as of 5.8.6, which is the version that comes with Mac OS X). Unfortunately, perl can't seem to find it. I have libgdbm installed (via Fink), but that didn't do anything. I suspect this has to do with the idiocy of separating out all the usual *nix paths (/etc, /var, etc) from the rest of the OS ... is there a symlink I should put in somewhere? Alternatively, is it safe to remove perl and install it from source?

--------------------
Let them be stupid - the market will sort it out.

Posts: 743 | From: Massachusetts | Registered: Aug 2004  |  IP: Logged
drunkennewfiemidget
BlabberMouth, a Blabber Odyssey
Member # 2814

Member Rated:
4
Icon 1 posted March 26, 2006 20:47      Profile for drunkennewfiemidget     Send New Private Message       Edit/Delete Post   Reply With Quote 
I think MacOSX includes a 'locate' utility. Locate a file called 'GDBM_File.pm'

When you get its directory (ie, on my system, its in /usr/lib/perl/5.8.7/.

Before using GDBM_File, just add this to your script:

use lib '/path/to/where/your/GDBM_File.pm/file/is/located'.

So my perl script would begin with:

use lib '/usr/lib/perl/5.8.7';

And then use GDBM_File; should work. If it is on your system, but hasn't been working, then I'm baffled as to why perl doesn't have its path in its @INC already.

Posts: 4897 | From: Cambridge, ON, Canada | Registered: Jun 2004  |  IP: Logged
dragonman97

SuperFan!
Member # 780

Member Rated:
4
Icon 1 posted March 26, 2006 21:01      Profile for dragonman97   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
I'm similarly confused...but I've not had terribly much luck testing on my system.

If you get /really/ stumped, run this from the same dir as your code:
curl -O http://search.cpan.org/src/NWCLARK/perl-5.8.8/ext/GDBM_File/GDBM_File.pm

It is *supposed* to be included by default. Also, evil as it may be, I found there is a Python test on my system that creates a sample file...and works. This leads me to believe that GDBM is installed...but Perl is just not being friendly about it.

code:
#!/usr/bin/perl -w
use GDBM_File;
tie %hash, 'GDBM_File', '/tmp/gdbm-file', &GDBM_WRCREAT, 0640;
# Use the %hash array.
untie %hash ;

(from: http://search.cpan.org/~nwclark/perl-5.8.8/ext/GDBM_File/GDBM_File.pm , using the file created by test_gdbm.py)

You /might/ want to take a look at /sw/src/gdbm-1.8.3.tar.gz (or similar) - not sure if it'd be worth recompiling into a local dir.

P.S. Still no good answer, but better query terms turned this up:
http://perldoc.perl.org/perlmacosx.html

--------------------
There are three things you can be sure of in life: Death, taxes, and reading about fake illnesses online...

Posts: 9331 | From: Westchester County, New York | Registered: May 2001  |  IP: Logged
chromatic
Geek
Member # 164

Member Rated:
5
Icon 4 posted March 27, 2006 10:22      Profile for chromatic   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
quote:
Originally posted by magefile:
Alternatively, is it safe to remove perl and install it from source?

Nope. If you need to compile your own Perl, install it to a different path. Replacing a system installation tends to break things badly.
Posts: 223 | From: Squeaky First Geek House | Registered: Jan 2000  |  IP: Logged
magefile
Highlie
Member # 2918

Member Rated:
5
Icon 1 posted March 27, 2006 14:27      Profile for magefile     Send New Private Message       Edit/Delete Post   Reply With Quote 
Well, "find / GDBM_File[.pm]" didn't find anything. And putting the linked GDBM_File.pm in the same directory didn't do anything either. I'll keep poking around and let y'all know if I come up with anything ... but I really don't understand why this is happening. It's not like I've fiddled with perl much in the past.

--------------------
Let them be stupid - the market will sort it out.

Posts: 743 | From: Massachusetts | Registered: Aug 2004  |  IP: Logged
Metasquares
Highlie
Member # 4441

Member Rated:
5
Icon 1 posted March 27, 2006 19:31      Profile for Metasquares   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
quote:
Originally posted by chromatic:
quote:
Originally posted by magefile:
Alternatively, is it safe to remove perl and install it from source?

Nope. If you need to compile your own Perl, install it to a different path. Replacing a system installation tends to break things badly.
I've done that tons of times and haven't had any problems.

Then again, I use Gentoo, so I guess the whole system is kind of designed to be replaced from source [Smile]

Mac OS X might be different.

Posts: 664 | From: Morganville, NJ | Registered: Oct 2005  |  IP: Logged
dragonman97

SuperFan!
Member # 780

Member Rated:
4
Icon 1 posted March 27, 2006 19:34      Profile for dragonman97   Author's Homepage     Send New Private Message       Edit/Delete Post   Reply With Quote 
chromatic is a master of Perl...I'd not ignore his sage words.

--------------------
There are three things you can be sure of in life: Death, taxes, and reading about fake illnesses online...

Posts: 9331 | From: Westchester County, New York | Registered: May 2001  |  IP: Logged
jfw
Solid Nitrozanium SuperFan!
Member # 1923

Member Rated:
5
Icon 1 posted March 28, 2006 07:15      Profile for jfw     Send New Private Message       Edit/Delete Post   Reply With Quote 
quote:
Originally posted by magefile:
Well, "find / GDBM_File[.pm]" didn't find anything. And putting the linked GDBM_File.pm in the same directory didn't do anything either.

If that is exactly what you typed, including the brackets, what you told find to do was to search the root directory, and then the file(s) or directory/ies named ("GDBM_File" followed by any of a period, a 'p', or an 'm'.)

What you wanted to type was
code:
find / -name GDBM_File.pm

with no brackets. That said, it isn't anywhere on my system, either, and perl complains if I try to use it. I think someone at Apple biffed the installation...

You might be able to use "cpan" to fetch and install GDBM_File, but be warned that it will do so by downloading and installing perl-5.8.8...

Posts: 20 | From: Boxboro Massachusetts | Registered: Jan 2003  |  IP: Logged


All times are Eastern Time  
Post New Topic  New Poll  Post A Reply Close Topic    Move Topic    Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:

Contact Us | Geek Culture Home Page

2015 Geek Culture

Powered by Infopop Corporation
UBB.classicTM 6.4.0



homeGeek CultureWebstoreeCards!Forums!Joy of Tech!AY2K!webcam