On Apr 6, 12:07 pm, [EMAIL PROTECTED] (John W. Krahn) wrote: > "Your program" was actually generated by the 'find2perl' program and as > such has a lot of stuff in there that you don't need. It could be > simplified to: > > #!/opt/local/bin/perl > use warnings; > use strict; > use File::Find; > > no warnings 'File::Find'; > > find sub { > print "$File::Find::name\n" if $_ eq 'libaest.dylib'; > }, qw{ /usr/lib /usr/lib64 /usr/local/lib /opt /lib /lib64 }; > > __END__
Hi John, Thanks for the tip. It works as you described: #!/opt/local/bin/perl5.10.0 use strict; use warnings; use File::Find; no warnings 'File::Find'; my @libdir = ( "/usr/lib", "/usr/lib64", "/usr/local/lib", "/opt", "/ lib", "/lib64",); find sub { print "$File::Find::name\n" if $_ eq 'libaest.dylib'; }, @libdir; Unfortunately I'm not sure if I can use it this way (I'm new to Perl). What I'm doing is building a string that contains a command that will end up running a set of Java binaries. This works but it is a lot more code than your example. #!/opt/local/bin/perl5.10.0 use File::Find (); use strict; use warnings; no warnings 'File::Find'; my $javaLibPath; sub libaestPath; # for the convenience of &libaestPath calls, including -eval statements: use vars qw/*name *dir/; *name = *File::Find::name; *dir = *File::Find::dir; my @libdir = ( "/usr/lib", "/usr/lib64", "/usr/local/lib", "/opt", "/ lib", "/lib64",); # Traverse desired filesystems File::Find::find(\&libaestPath, @libdir); print "debug java path:\n"; print "java -Djava.library.path=$javaLibPath -cp <path_to_jar:path_to_tests>/bin com.foo.foo.java_test\n"; sub libaestPath { if(/^libaest\.(a|so|dylib)\z/s && -f) { $javaLibPath = $dir; } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/