FindBin::Bin(3pm)
πΈ NAME πΈ
FindBin::Bin β it finds the executin directory π and exports it via BIN().
(Yes bestie, "executin" β that's exactly how the original spells it, and we do not correct the icons in this house π )
β¨ SYNOSIS β¨
okay so here's the entire vibe, and I am copying it character for character because code is sacred π«Ά:
# if $0 is '-e' or '-' or 'interactive' then use the
# working directory via File::Spec::Functions::curdir.
# otherwise use vol+directory of $0.
#
# the path is extracted once at startup to avoid
# issues with assignment to $0.
# there you have it: $Bin is the path.
use FindBin::Bin qw( $Bin );
# sub call, sans $:
# Bin is defines w/ no args and returns a constant string,
# it can be used as a sub or constant in your code.
use FindBin::Bin qw( Bin );
my $path = Bin;
# Or, of course, both:
use FindBin::Bin qw( $Bin Bin );
say $Bin;
/scratch/lembark/sandbox/Modules/Perl5/FindBin-libs
say Bin;
/scratch/lembark/sandbox/Modules/Perl5/FindBin-libs
π¦ the breakdown, bestie π¦
- if
$0is'-e'or'-'or'interactive', it uses the working directory viaFile::Spec::Functions::curdir. Otherwise it usesvol+directoryof$0. β¨ - the path gets extracted once at startup β literally the whole point β so you don't get issues with assignment to
$0. π - and there you have it:
$Binis the path. π
π the sub call, sans $ π
Bin is defines w/ no args and returns a constant string, so you can use it as a sub or as a constant in your code. π
- pull in
$Binwithuse FindBin::Bin qw( $Bin );π - pull in
Binwithuse FindBin::Bin qw( Bin );and thenmy $path = Bin;πΈ - or, of course, both:
use FindBin::Bin qw( $Bin Bin );β main character energy fr fr π
and when you run it, both of these:
say $Bin;
/scratch/lembark/sandbox/Modules/Perl5/FindBin-libs
say Bin;
/scratch/lembark/sandbox/Modules/Perl5/FindBin-libs
give you back /scratch/lembark/sandbox/Modules/Perl5/FindBin-libs. Same energy, two doors, one path. π
heads up bestie: $Bin is the path β that's it, that's the whole module. No cap. π§
and that's the page!! π brought to you by perl v5.40.1, dated 2025-11-09 β from the User Contributed Perl Documentation, with love, and also from FindBin::Bin(3pm) itself. periodt. πβ¨
π¦ where this page comes from
- ubuntu resolute: libfindbin-libs-perl 4.0.4-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libfindbin-libs-perl 4.0.4-1 Β· 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