Author: jfs
Date: Tue Jul  3 22:35:24 2012
New Revision: 9240

URL: http://svn.debian.org/wsvn/?sc=1&rev=9240
Log:
Use a directory filehandle

Modified:
    man-cgi/extractor/manpage-extractor.pl

Modified: man-cgi/extractor/manpage-extractor.pl
URL: 
http://svn.debian.org/wsvn/man-cgi/extractor/manpage-extractor.pl?rev=9240&op=diff
==============================================================================
--- man-cgi/extractor/manpage-extractor.pl (original)
+++ man-cgi/extractor/manpage-extractor.pl Tue Jul  3 22:35:24 2012
@@ -3,7 +3,7 @@
 # Scan a Debian pool archive and extract the manpages
 # of all binary packages.
 #
-# (c) 2006-2011 Javier Fernandez-Sanguino
+# (c) 2006-2012 Javier Fernandez-Sanguino
 #
 #  This program is free software; you can redistribute it and/or modify
 #  it under the terms of the GNU General Public License as published by
@@ -95,10 +95,11 @@
 sub scan_directory  {
        my ($dir) =@_;
        print "DEBUG: Scanning dir $dir\n" if $opt_d;
-       local *DIR;
-       opendir DIR, $dir;
-       while ( my $entry = readdir(DIR) ) {
-               next if $entry =~ /^\./ ;
+        my $DIRFH;
+
+        opendir $DIRFH, $dir || warn ("Cannot open directory $dir: $!");
+       while ( my $entry = readdir($DIRFH) ) {
+               next if $entry =~ /^\./ ;  # Skip hidden files and directories
                my $fullname = $dir."/".$entry;
                if ( -d $fullname ) {
                        scan_directory($fullname);
@@ -107,7 +108,7 @@
                        extract_package($fullname);
                }
        }
-       closedir DIR;
+       closedir $DIRFH;
 }
 
 sub extract_package {


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/[email protected]

Reply via email to