You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@httpd.apache.org by sl...@apache.org on 2002/02/06 19:57:45 UTC
cvs commit: httpd-docs-1.3/htdocs/manual/mod mod_rewrite.html
slive 02/02/06 10:57:45
Modified: htdocs/manual/mod mod_rewrite.html
Log:
Improve example perl script.
I'm no perl expert, so additional reviewing eyes may be needed.
PR: 9686
Submitted by: rodrigo campos <ca...@uol.com.br>, Patrik Grip-Jansson <pa...@gnulix.org>
Revision Changes Path
1.61 +12 -6 httpd-docs-1.3/htdocs/manual/mod/mod_rewrite.html
Index: mod_rewrite.html
===================================================================
RCS file: /home/cvs/httpd-docs-1.3/htdocs/manual/mod/mod_rewrite.html,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -b -u -r1.60 -r1.61
--- mod_rewrite.html 10 Nov 2001 02:24:41 -0000 1.60
+++ mod_rewrite.html 6 Feb 2002 18:57:44 -0000 1.61
@@ -731,15 +731,21 @@
## txt2dbm -- convert txt map to dbm format
##
+use NDBM_File;
+use Fcntl;
+
($txtmap, $dbmmap) = @ARGV;
-open(TXT, "<$txtmap");
-dbmopen(%DB, $dbmmap, 0644);
+
+open(TXT, "<$txtmap") or die "Couldn't open $txtmap!\n";
+tie (%DB, 'NDBM_File', $dbmmap,O_RDWR|O_TRUNC|O_CREAT, 0644) or die "Couldn't create $dbmmap!\n";
+
while (<TXT>) {
- next if (m|^s*#.*| or m|^s*$|);
- $DB{$1} = $2 if (m|^\s*(\S+)\s+(\S+)$|);
+ next if (/^\s*#/ or /^\s*$/);
+ $DB{$1} = $2 if (/^\s*(\S+)\s+(\S+)/);
}
-dbmclose(%DB);
-close(TXT)
+
+untie %DB;
+close(TXT);
</pre>
</td>
</tr>
---------------------------------------------------------------------
To unsubscribe, e-mail: docs-unsubscribe@httpd.apache.org
For additional commands, e-mail: docs-help@httpd.apache.org