Tobias Eichner wrote:
I wrote the following script that fits my needs; maybe someone finds it useful, maybe someone finds an error in it (if so, let me know - I tested it on OS X and Win XP):

use File::Spec;
my ($volume,$softwaredir,$librarydir);

($volume,$softwaredir) = File::Spec->splitpath(__FILE__);
$librarydir = File::Spec->catpath($volume,$softwaredir,'libraries');

unshift (@INC,$librarydir);

That code is executed at runtime, and hence lets you require() modules at runtime. If you want to use() a module instead, you need to make the code be executed at compile time. You can do that by putting the code in a BEGIN block.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

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


Reply via email to