From: Tobias Eichner <[EMAIL PROTECTED]>
> @Gunnar Hjalmarsson:
>
> > use File::Spec;
> > my ($vol, $progdir);
> > BEGIN { ($vol, $progdir) = File::Spec->splitpath( __FILE__ ) }
> > use lib File::Spec->catpath( $vol, $progdir, 'libraries' );
>
> At http://perldoc.perl.org/perldata.html it is stated that __FILE__
> contains the current filename... can it be assumed that this includes
> the entire path at all platforms as well ? (I checked it under WinXP,
> which gives me the absolute path as required).
No. I just tried it with Perl v5.8.5 built for i386-linux-thread-
multi and if I call the script as
perl zk.pl
__FILE__ is just 'zk.pl' and if I call it as
perl ./zk.pl
it is './zk.pl'. Bummer.
> Since I'm not sure about the meaning of "use lib...", could I also
> write this one (I'm currently not on a computer with Perl available):
>
> unshift(@INC,File::Spec->catpath($vol,$progdir,'mylib_directory')
You'd have to put it all in a begin block. Plus the "use lib ..."
will make sure the directory is not listed several times.
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/