Config...::Where(3pm)
π NAME π
Config::Find::Where β bestie, it finds you locations the way your OS actually wants them found. native OS fashion, no cap. β¨
π SYNOPSIS π
okay so here's the vibe, literally copy-paste:
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";
that's it. that's the whole thing. π
π¦ ABSTRACT π¦
Config::Find goes looking for locations using OS dependent heuristics. periodt.
πΈ DESCRIPTION πΈ
so after releasing Config::Find I was likeβ¦ wait. a LOT of that code could be reused to find other interesting things too?? like temporary directories, the script location, etc etc. π
and this module is that β it adds a public API to all the hidden functionality. the glow-up fr fr. π
β¨ OPTIONS β¨
same as in Config::Find, every single method in this package accepts one common set of options:
name => "name"or"name/more/names"β says the primary application name, the one used to generate the location paths or to go search for them. π·οΈscope => "user", "global", "app"or"process"β-create => 1β creates any nonexistent directory in the path returned. makes it exist. slay. πͺ
π METHODS π
all the methods in this package are class methods β you don't need an object to call them, just call them on the class. easy.
$path=Config::Find::Where->temp_dir(%opts)β 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. and yes bestie, 'jacks' is supposed to be the current user name and '974' is the process number. π
The default scope for this method is "user".
$path=Config::Find::Where->bin_dir(%opts)β 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. don't get caught out, okay??
$path=Config::Find::Where->var_dir(%opts)β returns a place to find/place working files.
The default scope for this method is "app".
$path = Config::Find::Where->lib_dir(%opts)β returns a place to find/place library files.
The default scope for this method is "app".
For instance:
use lib => Config::Find::Where->lib_dir;
$path = Config::Find::Where->application_dir(%opts)β returns the application root directory. the whole main character of directories. π$name=Config::Find::Where->script_name()β returns the name of the running script without any path information. just the name. no baggage. π«$path=Config::Find::Where->script_full_path()β returns the name of the script as the absolute full path to it.$path=Config::Find::Where->script_dir()β returns the name of the directory containing the current script.Config::Find::Where->create_dir($dir)β creates directory$dirand any needed parents. brings the whole family along. π«ΆConfig::Find::Where->create_parent_dir($file)β recursively creates all the nonexistent parent directories for$file. recursively!! it goes all the way up. πConfig::Find::Where->helper_path($file, %opts)β searches for a script, based on the directories given in%opts, which are the same asbin_dir()method.
π BUGS π
some Win32 operating systems 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. like genuinely, come through. π
π SEE ALSO π
Config::Find
π AUTHOR π
Salvador FandiΓ±o GarcΓa, <sfandino@yahoo.com>
π CONTRIBUTORS π
Barbie, <barbie@missbarbell.co.uk> (some bug fixes and documentation)
π COPYRIGHT AND LICENSE π
Copyright 2003-2015 by Salvador FandiΓ±o GarcΓa (sfandino@yahoo.com) Copyright 2015 by Barbie (barbie@missbarbell.co.uk)
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page bestie β perl v5.36.0, dated 2022-12-07, and you're reading Config...::Where(3pm). go find your directories. you ate. β¨ππ¦
π¦ where this page comes from
- debian bookworm: libconfig-find-perl 0.31-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libconfig-find-perl 0.31-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libconfig-find-perl 0.31-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libconfig-find-perl 0.31-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libconfig-find-perl 0.31-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms