I have created a Perl library that I want to use with my programs (via 
require). However the Perl library should be placed at a sub-folder of the 
working directory (the place where the program runs).

For example:

/my/custom/path/ is the location of the program.
/my/custom/path/libraries/ is the location where I want to place my Perl 
libraries in.

How can I implement this considering that my Perl program will run on different 
platforms with different ways of writing paths ?

Would it work to use require "./libraries/mylib.pl" on all platforms (*nix, 
Windows, Mac, something else) ? I don't think so. Not sure if paths can be used 
overall with require (not tried it yet).

My idea would be to use the standard module File::Spec to add the path to my 
libraries to @INC. For example:

my $mylibpath = File::Spec->rel2abs("libraries/");
unshift(@INC,$mylibpath);

Is this a cross-platform compatible way ? Or is there a better solution ?

Tobias.


      __________________________________________________________
Gesendet von Yahoo! Mail.
Dem pfiffigeren Posteingang.
http://de.overview.mail.yahoo.com

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to