You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by sl...@apache.org on 2002/02/06 19:59:21 UTC
cvs commit: httpd-2.0/docs/manual/mod mod_rewrite.html
slive 02/02/06 10:59:21
Modified: docs/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 +13 -7 httpd-2.0/docs/manual/mod/mod_rewrite.html
Index: mod_rewrite.html
===================================================================
RCS file: /home/cvs/httpd-2.0/docs/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 22 Sep 2001 19:36:01 -0000 1.60
+++ mod_rewrite.html 6 Feb 2002 18:59:20 -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>