[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] lib and referances



On Mon, Dec 06, 1999 at 10:18:40PM -0800, Nicholas G. Thornton wrote:
> I'm messing arround with writing some modules. For this one I'm 
> working on I'd like to access a file in the same folder as the module. 
> (i.e. a hard relative path from the 'lib' folder). But I cannot gat it 
> to work reliably 
> 
> open FILE, "<:lib:Fenrir:beginning.txt" or die 
> 
> works some of the time but not all the time. Should it matter (and I 
> assume it will) I'm programming this on a Mac, and it will be used as 
> well on a WinNT and *nix box. 
> 
> Basically what I'm looking for is something like the initial '/' in 
> html referances that takes you back to the root. In this case the root 
> being 'lib' 

How about:

use Basename;
$dir = dirname($INC{'Module.pm'});


Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org