Camel Book, page 851:

One solution for this is to use the standard FindBin module:

    use FindBin;
    use lib $FindBin::Bin;

This will do just what you want.  By the way, to anyone who will listen: 
Get the Camel Book, "Programming Perl 3rd ed." published by O'Reilly.  
If you are serious about Perl, get it and read it.  You'd be surprised 
how many of the questions raised here can be solved by a quick glance there.

Oh, and just to raise some hell: if you're new to Perl, you may also 
want to look at Python.  I don't know which language I would recomend 
more...

- Johnathan


Craig Moynes/Markham/IBM wrote:

> I cannot use a fixed library path as the script will be installed in
> different directories on different systems.
> 
> the idea is it will be executed as:
> /home/dbncc/perl/scripts/xxxx.pl
> 
> and the library will also be located in the same directory.
> 
> -----------------------------------------
> Craig Moynes
> Internship Student
> netCC Development
> IBM Global Services, Canada
> Tel: (905) 316-3486
> [EMAIL PROTECTED]
> 
> 
> 
>                                                                                      
>                              
>                     kimball@stsci.                                                   
>                              
>                     edu (Timothy         To:     [EMAIL PROTECTED]                  
>                              
>                     Kimball)             cc:                                         
>                              
>                                          Subject:     Re: Include directory as 
>location of perl script             
>                     04/27/01 04:22                                                   
>                              
>                     PM                                                               
>                              
>                     Please respond                                                   
>                              
>                     to kimball                                                       
>                              
>                                                                                      
>                              
>                                                                                      
>                              
> 
> 
> 
> 
> : but I am having trouble stripping $0 of the perl script name.
> 
> The standard File::Basename module has a dirname() function
> that will do that for you.
> 
> Alternatively, you can say something like this in your perl script:
> 
> use lib '/path/to/your/module/file.pm';
> 
> 
> -- tdk
> 
> 
> 
> 
> 

Reply via email to