@node FindBin, Font/AFM, Filter/tee, Module List
@unnumbered Locate directory of original perl script


@unnumberedsec NAME

FindBin - Locate directory of original perl script

@unnumberedsec SYNOPSIS

@example
use FindBin;
use lib "$FindBin::Bin/../lib";
@end example

@example
or 
@end example

@example
use FindBin qw($Bin);
use lib "$Bin/../lib";
@end example

@unnumberedsec 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
@code{STDIN} then FindBin sets both @code{$Bin} and @code{$RealBin} to the current
directory.

@unnumberedsec EXPORTABLE VARIABLES

@example
$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
@end example

@unnumberedsec KNOWN BUGS

if perl is invoked as

@example
perl filename
@end example

and @emph{filename} does not have executable rights and a program called @emph{filename}
exists in the users @code{$ENV@{PATH@}} which satisfies both -x and -T then FindBin
assumes that it was invoked via the @code{$ENV@{PATH@}}.

Workaround is to invoke perl as

@example
perl ./filename
@end example

@unnumberedsec AUTHORS

Graham Barr <@file{bodg@@tiuk.ti.com}>
Nick Ing-Simmons <@file{nik@@tiuk.ti.com}>

@unnumberedsec COPYRIGHT

Copyright (c) 1995 Graham Barr & Nick Ing-Simmons. All rights reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

@unnumberedsec REVISION

$Revision: 1.4 $

