You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@httpd.apache.org by Rich Bowen <rb...@rcbowen.com> on 2005/06/26 20:51:44 UTC

RewriteMap dbm:

I'm having difficulty with the script in the mod_rewrite docs for
generating dbm files. In particular, Perl seems to want to force me to
upgrade to Perl 5.8.7 in order to install NDBM_File. That doesn't appear
to be something that I actually want to do.

I found the script below (slightly modified from the original) which
gives me what I want, and the resulting files (named whatever.pag and
whatever.dir) make Apache happy and willing to rewrite.

=========================================
#!/usr/bin/perl
#converts a source txt-DB to the SDBM-formatted DB
use SDBM_File;
open(SFILE, $ARGV[0]) || die "\n Cannot open file: $!\n";
dbmopen(%s,$ARGV[0],0666);
while (<SFILE>) {
  chop;
  ($key,@name)=split(' ',$_);
  $s{$key} = join(' ',@name);
  print " $key [ @name ] \n";
}
close(SFILE);
dbmclose(%s);
===========================================

I guess the question I'm asking is whether there's any particular reason
to use one dbm Perl module over another, and if it's reasonable to alter
the script to use a version of the module that doesn't reqiure
reinstalling all of Perl, or if I should list both versions of the
script with associated disclaimers and explanations.

I, for one, was glad just to get something working without having to
install a new (development) Perl, which seems like a *stupid*
requirement for a module this simple.

Thoughts?

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org


Re: RewriteMap dbm:

Posted by Rich Bowen <rb...@rcbowen.com>.
Mads Toftum wrote:
> On Sun, Jun 26, 2005 at 02:51:44PM -0400, Rich Bowen wrote:
> 
>>I'm having difficulty with the script in the mod_rewrite docs for
>>generating dbm files. In particular, Perl seems to want to force me to
>>upgrade to Perl 5.8.7 in order to install NDBM_File. That doesn't appear
>>to be something that I actually want to do.
>>
> 
> It is all a question of what type of dbm mod_rewrite uses - just
> choosing the one you find most convenient isn't going to work.

Well, obviously (I hope!) I tested with the output of that script, and
it did indeed rewrite. It appears that either mod_rewrite, or the
underlying libraries, is smart enough to know what type of dbm it is and
Do The Right Thing.

--Rich

---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org


Re: RewriteMap dbm:

Posted by Mads Toftum <ma...@toftum.dk>.
On Sun, Jun 26, 2005 at 02:51:44PM -0400, Rich Bowen wrote:
> I'm having difficulty with the script in the mod_rewrite docs for
> generating dbm files. In particular, Perl seems to want to force me to
> upgrade to Perl 5.8.7 in order to install NDBM_File. That doesn't appear
> to be something that I actually want to do.
> 
It is all a question of what type of dbm mod_rewrite uses - just
choosing the one you find most convenient isn't going to work.

vh

Mads Toftum
-- 
`Darn it, who spiked my coffee with water?!' - lwall


---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org