I found the following a very easy way to include libs not on the default
path.

# Set the lib path for our own libs
use FindBin;
use lib "$FindBin::Bin/lib";

This way if you want to have for instance: Net::Sendmail as a module all you
need to do is create a directory: Net in the lib directory and put the
module Sendmail.pm in that Net directory ending you up with something like
this.

/yourScript.pl
/lib/Net/Sendmail.pm

Then in your script you do as you always do to include a module.
use Net::Sendmail;

This also helps for portability, your script will pick the
Sendmail.pmmodule that it finds on the path first, so if you are not
sure when moving
your application from one machine to the next if the required module is
already installed this is a handy trick to use.

Regards,

Rob


On 10/23/07, Sayed, Irfan (Irfan) <[EMAIL PROTECTED]> wrote:
>
> Hi All,
>
> How to refer Perl module in Perl script which is not there in the @INC
> path. I don't have permission to add this module in the @INC path
>
> I need to use the SendMail.pm module , but that is not there in the
> default @INC path.
>
> Can I refer the path of this module in my actual Perl script?? If yes
> how to do that
>
> Please help
>
> Regards
> Irfan.
>
>
>
> Irfan Sayed |SCM Engineer RDPS SCM Services - GCS Avaya India Pvt. Ltd.|
> Wing 'A', Level -2, Tower-1, Cybercity, Magarpatta City, Hadapsar |
> Pune, 411028|India
>
> Voice +91 20 3041 2588 | Fax +91 20 3041 2970|Email - [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>
>
> For all support requests, please visit http://itss.avaya.com
> <http://itss.avaya.com/>  Submit a request for IT assistance ->
> Applications->Themis Suite and select the appropriate sub-section to
> open tickets,
>
> *
>        For example:
> *
>        Build Factory: Build and release Management
> *
>        Workitem: Defect Management
> *
>        Source control: Source Code Control Management (Clearcase)
>
>
>

Reply via email to