-
-
04 Feb 2007 00:01:42 UTC
- Distribution: FindBin-Real
- Module version: 1.05
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (2508 / 2 / 0)
- Kwalitee
Bus factor: 1- 60.59% Coverage
- License: perl_5
- Activity
24 month- Tools
- Download (4.42KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors-
Serguei Trouchelle
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
FindBin::Real - Locate directory of original perl script
SYNOPSIS
use FindBin::Real; use lib FindBin::Real::Bin() . '/../lib'; or use FindBin::Real qw(Bin); use lib Bin() . '/../lib'; or # Run from /usr/bin/www/some/path/ or /usr/bin/www/some/other/path or any use FindBin::Real qw(BinDepth); use lib BinDepth(3) . '/lib'; # And always got /usr/bin/www/lib !
DESCRIPTION
Locates the full path to the script bin directory to allow the use of paths relative to the bin directory.
This allows a user to setup a directory tree for some software with directories <root>/bin and <root>/lib and then the above example will allow the use of modules in the lib directory without knowing where the software tree is installed.
If perl is invoked using the -e option or the perl script is read from
STDIN
then FindBin sets bothBin()
andRealBin()
return values to the current directory.EXPORTABLE FUNCTIONS
Bin
- path to bin directory from where script was invoked
Script
- basename of script from which perl was invoked
RealBin
- Bin() with all links resolved
RealScript
- Script() with all links resolved
BinDepth(n)
- path to n-level parent directory
Dir()
- the same as Bin()
RealDir()
- the same as RealBin()
KNOWN ISSUES
If there are two modules using
FindBin::Real
from different directories under the same interpreter, this WOULD work. SinceFindBin::Real
uses functions instead ofBEGIN
block inFindBin
, it'll be executed on every script, and all callers will get it right. This module can be used under mod_perl and other persistent Perl environments, where you shouldn't useFindBin
.KNOWN BUGS
If perl is invoked as
perl filename
and filename does not have executable rights and a program called filename exists in the users
$ENV{PATH}
which satisfies both -x and -T then FindBin assumes that it was invoked via the$ENV{PATH}
.Workaround is to invoke perl as
perl ./filename
AUTHORS
Serguei Trouchelle <stro@railways.dp.ua>
FindBin::Real uses code from FindBin module, which was written by
Graham Barr <gbarr@pobox.com> Nick Ing-Simmons <nik@tiuk.ti.com>
COPYRIGHT
Copyright (c) 1995 Graham Barr & Nick Ing-Simmons. All rights reserved. Copyright (c) 2003-2005 Serguei Trouchelle. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Module Install Instructions
To install FindBin::Real, copy and paste the appropriate command in to your terminal.
cpanm FindBin::Real
perl -MCPAN -e shell install FindBin::Real
For more information on module installation, please visit the detailed CPAN module installation guide.