Config::Find::Where - Find locations in the native OS fashion
use Config::Find::Where; my $temp_dir=Config::Find::Where->temp_dir( name => 'my_app', scope => 'process', create => 1 ); my $path=Config::Find::Where->bin_dir( scope => 'app' ); system $path."/app_helper.exe";
Config::Find searches for locations using OS dependant heuristics.
After releasing Config::Find I found much of its code could be reused to also find other interesting things like temporary directories, the script location, etc.
This module adds a public API to all the hidden functionality.
As in Config::Find, all the methods in this package accept a common set of options:
name
name/more/names
specifies the primary application name used to generate the location paths or to search for them.
user
global
app
process
-
creates any unexistant directory in the path returned
All the methods in this package are class methods (you don't need an object to call them).
returns a directory path inside a system temporary location. i.e.:
Config::Find::Where->temp_dir( name =>'hello/world', scope => 'process', create => 1 )
returns something similar to
'/tmp/jacks/hello/974/world/'
on unix like systems and
'C:\Windows\Temp\jacks\hello\974\world'
on some Windows ones ('jacks' is supposed to be the current user name and '974' the process number).
The default scope for this method is user.
returns a place to find/place binary files. The default scope for this method is app.
i.e.
Config::Find::Where->bin_dir()
returns the path to the directory where binaries are located.
Note that this directory is not necessarily the same as the one containing the running script. See documentation for script_dir below.
script_dir
returns a place to find/place working files.
The default scope for this method is app.
returns a place to find/place library files.
For instance:
use lib => Config::Find::Where->lib_dir;
returns the application root directory.
returns the name of the running script without any path information
returns the name of the script as the absolute full path to it.
returns the name of the directory containing the current script
creates directory $dir and any needed parents
$dir
recursively creates all the non existant parent dirs for $file.
$file
None, this module has an OO interface.
Some Win32 OSs are not completely implemented and default to inferior modes, but hey, this is a work in progress!!!
Contributions, bug reports, feedback and any kind of comments are welcome.
Config::Find
Salvador Fandi�o Garc�a, <sfandino@yahoo.com>
Copyright 2003-2015 by Salvador Fandi�o Garc�a (sfandino@yahoo.com)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Config::Find, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::Find
CPAN shell
perl -MCPAN -e shell install Config::Find
For more information on module installation, please visit the detailed CPAN module installation guide.