diff options
author | lloyd <[email protected]> | 2006-09-04 09:24:35 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2006-09-04 09:24:35 +0000 |
commit | f94e67781e20bf68c1634a0ca8202762fb6ae9e0 (patch) | |
tree | 2f4e86d970709868379147912566a05abc54bc26 /configure.pl | |
parent | bf00a9bb5f74ffd33969d0344ac5adb95e60d9b0 (diff) |
Remove use of the DirHandle module
Diffstat (limited to 'configure.pl')
-rwxr-xr-x | configure.pl | 59 |
1 files changed, 17 insertions, 42 deletions
diff --git a/configure.pl b/configure.pl index 26ce21f53..e7cf75257 100755 --- a/configure.pl +++ b/configure.pl @@ -3,7 +3,6 @@ require 5.006; use strict; -use DirHandle; use Getopt::Long; use File::Spec; use File::Copy; @@ -300,6 +299,7 @@ sub make_reader { my $filename = $_[0]; open FILE, "<$filename" or die "Couldn't read from $filename ($!)\n"; + return sub { my $line = ''; while(1) @@ -316,7 +316,6 @@ sub make_reader { return $line if $line ne ''; } close FILE; - return undef; return undef; } } @@ -571,18 +570,21 @@ sub check_for_conflicts { } } -sub get_modules_list { - my $MOD_DIR = $_[0]; - my $dir = new DirHandle $MOD_DIR; - if(!defined $dir) { return (); } +sub dir_list { + my ($dir) = @_; + opendir(DIR, $dir) or die "Couldn't read directory $dir ($!)\n"; + my @listing = grep { $_ ne '.' and $_ ne '..' } readdir DIR; + closedir DIR; + return @listing; +} +sub get_modules_list { my %MODULES; - - while(defined($_ = $dir->read)) { - next if($_ eq '.' or $_ eq '..'); - my $MODULE = $_; - my %modinfo = get_module_info($MODULE, $MOD_DIR); - foreach (keys %modinfo) { $MODULES{$MODULE}{$_} = $modinfo{$_}; } + foreach my $mod (dir_list($_[0])) { + my %modinfo = get_module_info($mod, $MOD_DIR); + foreach (keys %modinfo) { + $MODULES{$mod}{$_} = $modinfo{$_}; + } } return %MODULES; } @@ -1727,15 +1729,7 @@ END_OF_FILE } sub set_arch_defines { - my $dir = new DirHandle $_[0]; - if(!defined $dir) { - die "Couldn't open directory $_[0] ($!)"; - } - - while(defined($_ = $dir->read)) { - next if($_ eq '.' or $_ eq '..'); - my $arch = $_; - + foreach my $arch (dir_list($_[0])) { my $reader = make_reader(File::Spec->catfile($_[0], $arch)); $ARCH{$arch} = $arch; @@ -1772,19 +1766,10 @@ sub set_arch_defines { } } } - undef $dir; } sub set_os_defines { - my $dir = new DirHandle $_[0]; - if(!defined $dir) { - die "Couldn't open directory $_[0] ($!)"; - } - - while(defined($_ = $dir->read)) { - next if($_ eq '.' or $_ eq '..'); - my $os = $_; - + foreach my $os (dir_list($_[0])) { my $reader = make_reader(File::Spec->catfile($_[0], $os)); $OS_SHARED_SUFFIX{$os} = ''; @@ -1835,19 +1820,10 @@ sub set_os_defines { } } } - undef $dir; } sub set_cc_defines { - my $dir = new DirHandle $_[0]; - if(!defined $dir) { - die "Couldn't open directory $_[0] ($!)"; - } - - while(defined($_ = $dir->read)) { - next if($_ eq '.' or $_ eq '..'); - my $cc = $_; - + foreach my $cc (dir_list($_[0])) { my $reader = make_reader(File::Spec->catfile($_[0], $cc)); # Default to empty values, so they don't have to be explicitly set @@ -1928,5 +1904,4 @@ sub set_cc_defines { } } } - undef $dir; } |