[comp.lang.perl] perl 4.0 with dbz and news history files

bms@mitisft.Convergent.COM (Bruce Schlobohm) (06/15/91)

I recently switched over to running Bnews 2.11.19 with dbm history file,
(from the non-dbm method).  I chose to use the dbz library instead of
dbm for it's space savings.  However, soon thereafter I had the need
to write a perl script which would parse a list of messageids, and look
up the files in the spool directory.  I started with Tom Christiansen's
xpost program, but couldn't get it to work... kept getting "no article".

I recompiled the news programs with the real dbm (consequently now have 
a large history.pag file), and xpost works just fine.  I was then able
to get my perl script to work and all is well.

I like the smallness of the dbz files however.

Is there a way that I can use perl (compiled with ndbm) on dbz files,
and still use the dbmopen() and associative array?
What am I missing?

If it matters this is on an SVR3.2 derivitive on a Convergent box.

-- 
Bruce Schlobohm
bms@Convergent.COM -or- {pyramid,sri-unix,pacbell}!ctnews!bms

eastick@me.utoronto.ca (Doug Eastick) (06/19/91)

bms@mitisft.Convergent.COM (Bruce Schlobohm) writes:

>Is there a way that I can use perl (compiled with ndbm) on dbz files,
>and still use the dbmopen() and associative array?
>What am I missing?

Havent tried it yet but try relinking perl without -lndbm and *with*
dbz.o from the c-news distribution.  Call the executable  "perlz" or
somthing like that.

The nntp dist. with dbz does something to that effect.

rbj@uunet.uu.net (Root Boy Jim) (06/20/91)

bms@mitisft.Convergent.COM (Bruce Schlobohm) writes:
?I recently switched over to running Bnews 2.11.19 with dbm history file,
?(from the non-dbm method).  I chose to use the dbz library instead of
?dbm for it's space savings.  However, soon thereafter I had the need
?to write a perl script which would parse a list of messageids, and look
?up the files in the spool directory.  I started with Tom Christiansen's
?xpost program, but couldn't get it to work... kept getting "no article".

Watch out for duplicate articles!

?I recompiled the news programs with the real dbm (consequently now have 
?a large history.pag file), and xpost works just fine.  I was then able
?to get my perl script to work and all is well.

What do you call large? Our history file itself is 15 Megs.
The .pag (dbz) file is only 1.7 Meg. However, the old dbm
was 45 Megs!

?I like the smallness of the dbz files however.

Don't we all!

?Is there a way that I can use perl (compiled with ndbm) on dbz files,
?and still use the dbmopen() and associative array?

No. The format is different. What you want is a separate process
that looks up entries for you. In fact, the dbz program itself
has just the option (-x, possibly with -i) you want.

?What am I missing?

One thing is that the "data" that is returned is actually
a four byte lseek pointer into the flat file. You have to
look it up yourself.
-- 
		[rbj@uunet 1] stty sane
		unknown mode: sane