FAQ
Author: comdog
Date: Sat Mar 29 17:55:22 2008
New Revision: 11019

Modified:
perlfaq/trunk/perlfaq8.pod

Log:
* perlfaq8: How do I add the directory my program lives in to the module/library search path?
+ FindBin does not search PATH, so don't say that it does


Modified: perlfaq/trunk/perlfaq8.pod
==============================================================================
--- perlfaq/trunk/perlfaq8.pod (original)
+++ perlfaq/trunk/perlfaq8.pod Sat Mar 29 17:55:22 2008
@@ -1273,13 +1273,11 @@

use lib $directory;

-The C<FindBin> module, which comes with Perl, might work. It searches
-through C<$ENV{PATH}> (so your script has to be in one of those
-directories). You can then use that directory (in C<$FindBin::Bin>)
-to locate nearby directories you want to add:
+The C<FindBin> module, which comes with Perl, might work. It finds the
+directory of the currently running script and puts it in C<$Bin>, which
+you can then use to construct the right library path:

- use FindBin;
- use lib "$FindBin::Bin/../lib";
+ use FindBin qw($Bin);

=head2 How do I add a directory to my include path (@INC) at runtime?

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcvs-perlfaq @
categoriesperl
postedMar 30, '08 at 12:55a
activeMar 30, '08 at 12:55a
posts1
users1
websitelearn.perl.org...

1 user in discussion

Comdog: 1 post

People

Translate

site design / logo © 2019 Grokbase