On Monday 08 April 2002 11:46 am, bob ackerman wrote:
> On Monday, April 8, 2002, at 11:21  AM, Michael D. Risser wrote:
> > I have an array that contains some filenames that I wish to check for,
> > however
> > I don't seem to be checking the array, at least not in the manner I
> > expect ;-) Here's the relevant offending code:
> >
> > my @lsLib = ("libListTree.a",
> >                "libXpm.a",
> >                "libfalk.a",
> >                "libmysqlclient.a",
> >                "libdxclass.so.6.0",
> >                "libxg.a");
> >
> > sub checkLib() {
> >     # Pass the directory to check in, and an array containing the
> > filenames
> >     # to check for
> >     &check($libDir, @lsLib);
> > }
> >
> > sub check() {
> >     my ($dir,@toCheck) = @_;
> >     my $last = @toCheck;
> >     my $i;
> >     my $valid;
> >
> >     # Go to the directory we need to check
> >     print "\nEntering $dir\nChecking for $last files\n";
> >     chdir($dir) or die "Unable to change to $dir: $!\n";
> >     opendir(DIR, $dir) or die "Unable to open $dir: $!\n";
> >
> >     # Loop throught the directory we were passed
> >     while(my $file = readdir(DIR)) {
> >             # First gid rid of those pesky . and .. things
> >             if($file eq "." || $file eq "..") {
> >                     next;
> >             }
> >
> >             $valid = 0;
> >             # Now loop through the array of filenames we were passed
> >             for($i = 0; $i < $last && !$valid; $i++) {
> >                     # Make sure the file exists
> >                     if ($file eq $toCheck[$i]) {
> >                             print "\t\- $file.....OK\n";
> >                             $valid = 1;
> >                     }
> >             }
> >
> >             ##
> >             # $i not valid
> >             #
> >             if (!$valid) {
> >                     #if($file ne "." || $file ne "..") {
> >                             # If its FUBAR add it to the array, and let us know
> >                             print "\t\- $file.....ERROR\n";
> >                             push(@missingFiles,"$dir/$file");
> >                     #}
> >             }
> >     }
> >
> >     # Be nice and close our directory handle
> >     closedir DIR;
> > }
> >
> > Here's the kicker, it works for aother arrays that I pass, but not the
> > one shown above. The entire script can be found at
> > http://www.visionpro.com/~michael/build-checker.pl
>
> and just what problem are you seeing?
Everything appears as <fileName>.....ERROR even though thay are all present

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to