I want to be able to search for a library that will be different on
all systems. Some places it will be libaest.so, others it will be
libaest.dylib. I cannot figure out how to do this though. I've tried
many different things and they've all resulted in failure. $search_for
contains the library I want to search for. Any pointers would be
awesome!
find_aes_library_directory();
sub find_aes_library_directory {
# possible matches: libaest.dylib, libaest.1.4.0.9.dylib,
# libaest.so, libaest.so.1.4.0.9
find_library_directory($search_for = "libaest.dylib");
}
sub find_library_directory {
my($lookup) = @_;
print "\nLocating directory containing $lookup...\n";
File::Find::find(\&want_directory_parent, @library_directories);
}
sub want_directory_parent {
my $dev = ( lstat )[ 0 ];
($File::Find::prune |= ($dev != $File::Find::topdev) ||
($File::Find::dir) =~ m!/\.! && return);
/^$search_for/ && push @directory_list, "$File::Find::dir";
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/