On Apr 5, 7:20 am, [EMAIL PROTECTED] (John W. Krahn) wrote:
>
> WARNINGS
> If you run your program with the "-w" switch, or if you use the
> "warnings" pragma, File::Find will report warnings for several
> weird situations. You can disable these warnings by putting the
> statement
>
> no warnings 'File::Find';
>
> in the appropriate scope. See perllexwarn for more info about
> lexical warnings.
Here is the solution to my problem ... the use of the 'open' and
'close' functions:
#! /opt/local/bin/perl -w
eval 'exec /opt/local/bin/perl -S $0 ${1+"$@"}'
if 0; #$running_under_some_shell
use strict;
use File::Find ();
# for the convenience of &wanted calls, including -eval statements:
use vars qw/*name *dir *prune/;
*name = *File::Find::name;
*dir = *File::Find::dir;
*prune = *File::Find::prune;
sub wanted;
my @libdir = ( "/usr/lib", "/usr/lib64", "/usr/local/lib", "/opt", "/
lib", "/lib64",);
open(OLDERR, ">&STDERR");
open(STDERR, ">/dev/null") or die "Can't redirect stderr: $!";
# Traverse desired filesystems
File::Find::find({wanted => \&wanted}, @libdir);
exit;
close(STDERR) or die "Can't close STDERR: $!";
open( STDERR, ">&OLDERR") or die "Can't restore stderr: $!";
close(OLDERR) or die "Can't close OLRDERR: $!";
sub wanted {
/^libaest\.dylib\z/s &&
print("$name\n");
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/