Click here to get back home

NDBM support

 HomeNewsGroups | Search | About
 comp.lang.perl.misc    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
NDBM support alex.turchin 06-30-2008
Posted by alex.turchin on June 30, 2008, 2:02 pm
Please log in for more thread options
I have an old and rather large (thousands of lines of code) piece of
perl software that utilizes (in numerous places) NDBM databases,
including dbmopen() etc. calls. This code has now been moved by the
website administrator to a different UNIX platform that does not
support NDBM.

Unfortunately I do not have the resources to completely rewirte the
code to utilize a different database. Even more importantly, all of
the data the software uses (unique to the software and took months of
work to enter) is in the NDBM format.

I am therefore looking for a way to obtain perl support for the NDBM
format and corresponding function calls (dbmopen, dbmclose) on a
system that does not natively support them. Any thoughts would be
greatly appreciated!

Alex

Posted by Mark Clements on June 30, 2008, 3:08 pm
Please log in for more thread options
alex.turchin@gmail.com wrote:
> I have an old and rather large (thousands of lines of code) piece of
> perl software that utilizes (in numerous places) NDBM databases,
> including dbmopen() etc. calls. This code has now been moved by the
> website administrator to a different UNIX platform that does not
> support NDBM.
>
> Unfortunately I do not have the resources to completely rewirte the
> code to utilize a different database. Even more importantly, all of
> the data the software uses (unique to the software and took months of
> work to enter) is in the NDBM format.
>
> I am therefore looking for a way to obtain perl support for the NDBM
> format and corresponding function calls (dbmopen, dbmclose) on a
> system that does not natively support them. Any thoughts would be
> greatly appreciated!

Hmmm.

http://perldoc.perl.org/functions/dbmopen.html

(quoted)
**
You can control which DBM library you use by loading that library before
you call dbmopen():

use DB_File;
dbmopen(%NS_Hist, "$ENV/.netscape/history.db")
        or die "Can't open netscape history file: $!";

**

Can you not install NDBM_File and add a

use NDBM_File;

to the script(s)?

http://search.cpan.org/~rgarcia/perl-5.10.0/ext/NDBM_File/NDBM_File.pm

Mark

Posted by alex.turchin on June 30, 2008, 5:15 pm
Please log in for more thread options
wrote:
> alex.turc...@gmail.com wrote:
> > I have an old and rather large (thousands of lines of code) piece of
> > perl software that utilizes (in numerous places) NDBM databases,
> > including dbmopen() etc. calls. This code has now been moved by the
> > website administrator to a different UNIX platform that does not
> > support NDBM.
>
> > Unfortunately I do not have the resources to completely rewirte the
> > code to utilize a different database. Even more importantly, all of
> > the data the software uses (unique to the software and took months of
> > work to enter) is in the NDBM format.
>
> > I am therefore looking for a way to obtain perl support for the NDBM
> > format and corresponding function calls (dbmopen, dbmclose) on a
> > system that does not natively support them. Any thoughts would be
> > greatly appreciated!
>
> Hmmm.
>
> http://perldoc.perl.org/functions/dbmopen.html
>
> (quoted)
> **
> You can control which DBM library you use by loading that library before
> you call dbmopen():
>
> =A0 =A0 =A0use DB_File;
> =A0 =A0 =A0dbmopen(%NS_Hist, "$ENV/.netscape/history.db")
> =A0 =A0 =A0 =A0 or die "Can't open netscape history file: $!";
>
> **
>
> Can you not install NDBM_File and add a
>
> use NDBM_File;
>
> to the script(s)?
>
> http://search.cpan.org/~rgarcia/perl-5.10.0/ext/NDBM_File/NDBM_File.pm
>
> Mark- Hide quoted text -
>
> - Show quoted text -

Unfortunately no longer have access to the old platform so can't dump
the files out :(

With respect to using NDBM_File - will that work in absence of ndbm
support on the underlying UNIX platform? I don't have admin privileges
to the system and have to beg the admin to install stuff like Perl
modules for me - would like to minimize trial & error if possible if
you know what I mean :)

Thanks!
Alex

Posted by smallpond on June 30, 2008, 5:40 pm
Please log in for more thread options
alex.turchin@gmail.com wrote:
> wrote:
>> alex.turc...@gmail.com wrote:
>>> I have an old and rather large (thousands of lines of code) piece of
>>> perl software that utilizes (in numerous places) NDBM databases,
>>> including dbmopen() etc. calls. This code has now been moved by the
>>> website administrator to a different UNIX platform that does not
>>> support NDBM.
>>> Unfortunately I do not have the resources to completely rewirte the
>>> code to utilize a different database. Even more importantly, all of
>>> the data the software uses (unique to the software and took months of
>>> work to enter) is in the NDBM format.
>>> I am therefore looking for a way to obtain perl support for the NDBM
>>> format and corresponding function calls (dbmopen, dbmclose) on a
>>> system that does not natively support them. Any thoughts would be
>>> greatly appreciated!
>> Hmmm.
>>
>> http://perldoc.perl.org/functions/dbmopen.html
>>
>> (quoted)
>> **
>> You can control which DBM library you use by loading that library before
>> you call dbmopen():
>>
>> use DB_File;
>> dbmopen(%NS_Hist, "$ENV/.netscape/history.db")
>> or die "Can't open netscape history file: $!";
>>
>> **
>>
>> Can you not install NDBM_File and add a
>>
>> use NDBM_File;
>>
>> to the script(s)?
>>
>> http://search.cpan.org/~rgarcia/perl-5.10.0/ext/NDBM_File/NDBM_File.pm
>>
>> Mark- Hide quoted text -
>>
>> - Show quoted text -
>
> Unfortunately no longer have access to the old platform so can't dump
> the files out :(
>
> With respect to using NDBM_File - will that work in absence of ndbm
> support on the underlying UNIX platform? I don't have admin privileges
> to the system and have to beg the admin to install stuff like Perl
> modules for me - would like to minimize trial & error if possible if
> you know what I mean :)
>
> Thanks!
> Alex


NDBM_File is standard with perl 5.10 and is not available for earlier
versions of perl. I believe perl uses gdbm. You'll need to try it to
see if it will read your file formats.

perl --version

This is perl, v5.10.0 built for i686-linux

perl -e 'use NDBM_File; dbmopen(%h, "foo", 0666)'

Creates two files: foo.dir and foo.pag
file foo.dir
foo.dir: GNU dbm 1.x or ndbm database, little endian





** Posted from http://www.teranews.com **

Posted by szr on June 30, 2008, 6:37 pm
Please log in for more thread options
smallpond wrote:
> alex.turchin@gmail.com wrote:
>> On Jun 30, 3:08 pm, Mark Clements
>>> alex.turc...@gmail.com wrote:
>>>> I have an old and rather large (thousands of lines of code) piece
>>>> of perl software that utilizes (in numerous places) NDBM databases,
>>>> including dbmopen() etc. calls. This code has now been moved by the
>>>> website administrator to a different UNIX platform that does not
>>>> support NDBM.
>>>> Unfortunately I do not have the resources to completely rewirte the
>>>> code to utilize a different database. Even more importantly, all of
>>>> the data the software uses (unique to the software and took months
>>>> of work to enter) is in the NDBM format.
>>>> I am therefore looking for a way to obtain perl support for the
>>>> NDBM format and corresponding function calls (dbmopen, dbmclose)
>>>> on a system that does not natively support them. Any thoughts
>>>> would be greatly appreciated!
>>> Hmmm.
>>>
>>> http://perldoc.perl.org/functions/dbmopen.html
>>>
>>> (quoted)
>>> **
>>> You can control which DBM library you use by loading that library
>>> before you call dbmopen():
>>>
>>> use DB_File;
>>> dbmopen(%NS_Hist, "$ENV/.netscape/history.db")
>>> or die "Can't open netscape history file: $!";
>>>
>>> **
>>>
>>> Can you not install NDBM_File and add a
>>>
>>> use NDBM_File;
>>>
>>> to the script(s)?
>>>
>>> http://search.cpan.org/~rgarcia/perl-5.10.0/ext/NDBM_File/NDBM_File.pm
>>>
>>> Mark- Hide quoted text -
>>>
>>> - Show quoted text -
>>
>> Unfortunately no longer have access to the old platform so can't dump
>> the files out :(
>>
>> With respect to using NDBM_File - will that work in absence of ndbm
>> support on the underlying UNIX platform? I don't have admin
>> privileges to the system and have to beg the admin to install stuff
>> like Perl modules for me - would like to minimize trial & error if
>> possible if you know what I mean :)
>>
>> Thanks!
>> Alex
>
>
> NDBM_File is standard with perl 5.10 and is not available for earlier
> versions of perl.

Not true, it works in both 5.8.8 and 5.10.0 for me (see below.)

> perl --version
>
> This is perl, v5.10.0 built for i686-linux
>
> perl -e 'use NDBM_File; dbmopen(%h, "foo", 0666)'
>
> Creates two files: foo.dir and foo.pag
> file foo.dir
> foo.dir: GNU dbm 1.x or ndbm database, little endian

That works for 5.8.8 as well:

$ perl5.8.8 -e 'use NDBM_File; dbmopen(%h, "foo5.8.8", 0666)'

$ perl5.10.0 -e 'use NDBM_File; dbmopen(%h, "foo5.10.0", 0666)'


They both create the two files you mentioned:

-rw-r--r-- 2 root root 12288 Jun 30 15:36 foo5.8.8.dir
-rw-r--r-- 2 root root 12288 Jun 30 15:36 foo5.8.8.pag
-rw-r--r-- 2 root root 12288 Jun 30 15:36 foo5.10.0.dir
-rw-r--r-- 2 root root 12288 Jun 30 15:36 foo5.10.0.pag


--
szr



Similar ThreadsPosted
NDBM module for ActiveState/Winxx? September 19, 2004, 1:51 pm
unicode support January 9, 2005, 1:28 am
ftp nmap support in Net::FTP March 25, 2005, 4:35 am
No XS support for activeStatePerl? March 29, 2006, 2:22 am
BWWHOIS in OS/2 and Perl support August 20, 2004, 2:46 pm
Re: BWWHOIS in OS/2 and Perl support August 20, 2004, 8:05 pm
FAQ 2.1: What machines support Perl? Where do I get it? November 4, 2004, 12:03 pm
FAQ 2.1: What machines support Perl? Where do I get it? December 1, 2004, 6:03 pm
FAQ 2.1: What machines support Perl? Where do I get it? December 29, 2004, 6:03 am
FAQ 2.1 What machines support Perl? Where do I get it? January 14, 2005, 12:03 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap