|
NAMEFile::SearchPath - Search for a file in an environment variable pathSYNOPSISuse File::SearchPath qw/ searchpath /; $file = searchpath( 'libperl.a', env => 'LD_LIBRARY_PATH' ); $file = searchpath( 'my.cfg', env => 'CFG_DIR', subdir => 'ME' ); $path = searchpath( $file, env => 'PATH', exe => 1 ); $path = searchpath( $file, env => 'PATH', dir => 1 ); $file = searchpath( 'ls', $ENV{PATH} ); $exe = searchpath( 'ls' ); DESCRIPTIONThis module provides the ability to search a path-like environment variable for a file (that does not necessarily have to be an executable).FUNCTIONSThe following functions can be exported by this module.
In scalar context the first match is returned. In list context all matches are returned in the order corresponding to the directories listed in the environment variable. Returns undef (or empty list) if no match could be found. If an absolute file name is provided, that filename is returned if it exists and is readable, else undef is returned. HISTORY"File::SearchPath" used to exist on CPAN (now on backpan) and was written by Robert Spier. This version is completely new but retains an interface that is compatible with Robert's version. Thanks to Robert for allowing me to reuse this module name.NOTESIf "Env::Path" module is installed it will be used. This allows for more flexibility than simply assuming colon-separated paths.SEE ALSOEnv::Path, File::Which, File::Find, File::Find::Run, File::Where.AUTHORTim Jenness <tjenness@cpan.org>Copyright (C) 2005,2006, 2008 Particle Physics and Astronomy Research Council. Copyright (C) 2009-2010 Science and Technology Facilities Council. Copyright (C) 2015 Tim Jenness All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place,Suite 330, Boston, MA 02111-1307, USA
Visit the GSP FreeBSD Man Page Interface. |