There's more than one way to do things | |
PerlMonks |
Re^4: finding the absolute path to a module, from the module's, perspectiveby skazat (Chaplain) |
on Sep 12, 2004 at 05:00 UTC ( [id://390371]=note: print w/replies, xml ) | Need Help?? |
This is pretty weird, but I think I've figured it out; doing a, inside my module will return something like: /lib/Stuff/Template.pmFile::Spec has a method called, file_name_is_absolute(), which basically on Unix, looks for a '/' as the first character ->
File::Spec will consult this method before it tries to piece together a absolute path; thus, File::Spec isn't even attempting to make an absolute path from the information from __FILE__ The workaround I've done is simply to hack the first, '/' off. Changing my FOO.pm to something like: Will print: lib/FOO.pm /usr/home/user/www/cgi-bin/lib/FOO.pm So, it doesn't look like it's *really* File::Spec's fault, but what would cause Perl to put a '/' at the beginning of the path in my module? Hmm...
-justin simoni
In Section
Seekers of Perl Wisdom
|
|