Hello.
I am using the File::Find module from Cpan to travers some filesystems to,
well, find a file.
Here is my small snippet of code. Basically what is happening is that the
sub is returning a 0 instead of the file name. What am I doing wrong?
#!/usr/bin/perl -w
use strict;
use File::Find;
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find::prune;
print "You havn't defined an \$CONF file. Please do so: ";
$Conf = <STDIN>;
chomp($Conf);
while($Conf eq "") {
print "You havn't defined an \$CONF file. Please do so: ";
chomp($Conf = <STDIN>);
}
if(not -f $Conf) {
print "Sorry, that file does not exist, at all!\n\n\n";
print "I am now going to traverse the file system and look for:
\"base.conf\"\n";
my $newConf = File::Find::find({wanted => \&wanted}, '/');
print "I found this file $newConf. Would you like to use it? [y]\n";
chomp(my $answer = <STDIN>);
if($answer =~ /y|Y/) {
$Conf = $newConf;
}
else{
print "Okiee, dokiee!\n";
}
sub wanted {
/^base\\.conf\z/s &&
return("$name");
}
Thanks for help in advance!
-James
James Kelty
Sr. Unix Systems Administrator
The Ashland Agency
[EMAIL PROTECTED]
541.488.0801
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]