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

Re: [MacPerl] Emulating AS-like properties in Perl



On Wed, May 24, 2000 at 01:39:18AM +0000, Bart Lateur wrote:
> Oh, I forgot.
> 
> On Wed, 24 May 2000 18:23:15 +0200, Peter Hartmann wrote:
> 
> >(Can a script/droplet know the path to itself?)
> 
> Well, usually, when a script/droplet starts up on a Mac, the current
> directory is set to the path to that script. I've not ever witnessed an
> exception to that rule. So, if you create a file with a bare filename,
> it will apear in the same folder as the script itself.
> 
> The real challenge, however, is when you want to know the path to a
> library file.

Fortunately, that's not too hard to solve either:


#!perl

use File::Basename;

print dirname($INC{'File/Basename.pm'}), "\n";

# includes the directory File, which contains the file Basename.pm

__END__


Ronald


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