SPUG: finding full path to itself
Rick Croote
rick.croote at philips.com
Tue May 30 17:07:04 PDT 2006
The best way I've found to do this has been FindBin. We often use it to
find where the custom libs are relative to the application, such as the
following code:
use FindBin;
use lib "$FindBin::Bin/../../libs/perl";
or to obtain the location:
use FindBin;
my $appPath = $FindBin::Bin;
---
Rick Croote
Software Engineer
Environment and Tools Team
Philips Medical Systems
Bothell, WA
Rick.Croote at Philips.com
Phone: 425-487-7834
Colin Meyer <cmeyer at helvella.org>
Sent by:
spug-list-bounces+rick.croote=philips.com at pm.org
2006-05-30 04:21 PM
To
jlb <jlb at io.com>
cc
spug-list at pm.org
Subject
Re: SPUG: finding full path to itself
Classification
On Tue, May 30, 2006 at 05:40:05PM -0500, jlb wrote:
> Cwd.pm provides some portable, safe methods to determine your current
> working directory.
Or see FindBin.pm, if you want to know where the script itself is
located (e.g. to be able to read a config file from the same dir).
-Colin.
>
> On Tue, 30 May 2006, Satish Gupta wrote:
>
> > When I a stand-alone script is running, how can this script determine
it's own absolute path in a portable manner?
> >
> > I notice that $0 works differently on different OS's. On some it
gives full path and not on others.
> >
> > Thanks
> >
> >
> > ---------------------------------
> > Be a chatter box. Enjoy free PC-to-PC calls with Yahoo! Messenger
with Voice.
> _____________________________________________________________
> Seattle Perl Users Group Mailing List
> POST TO: spug-list at pm.org
> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
> MEETINGS: 3rd Tuesdays
> WEB PAGE: http://seattleperl.org/
_____________________________________________________________
Seattle Perl Users Group Mailing List
POST TO: spug-list at pm.org
SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list
MEETINGS: 3rd Tuesdays
WEB PAGE: http://seattleperl.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/spug-list/attachments/20060530/c54d3948/attachment.html
More information about the spug-list
mailing list