[Wellington-pm] Roundup of Monday night's meeting
Peter Love
Peter.Love at netkno.com
Wed Dec 15 02:39:34 CST 2004
I new I'd used FindBin before -- but couldn't remember its name -- so in
the updated version I sent earlier today I used:
$slidedir = File::Basename::dirname($0);
which I think is okay.
I think the File::Spec isn't needed for unix and windows, but probably
for Mac (and what else?)?
> FYI - as far as the hard-coded pathname goes, there's a common Perl
> idiom for dealing with paths relative to the location of the script.
> One approach is to extract the path out of $0, or __FILE__, but a
> cleaner approach is to use the core module FindBin:
>
> use FindBin qw($Bin);
> my $slidedir = $Bin;
>
> I often use it for adding a lib directory to @INC:
>
> use FindBin qw($Bin);
> use lib "$Bin/lib";
>
> or more portably:
>
> use FindBin qw($Bin);
> use File::Spec;
> use lib File::Spec->catfile($Bin, 'lib');
More information about the Wellington-pm
mailing list