<br><font size=2 face="sans-serif">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:</font>
<br>
<br><font size=2 face="sans-serif">use FindBin;</font>
<br><font size=2 face="sans-serif">use lib "$FindBin::Bin/../../libs/perl";</font>
<br>
<br><font size=2 face="sans-serif">or to obtain the location:</font>
<br>
<br><font size=2 face="sans-serif">use FindBin;</font>
<br><font size=2 face="sans-serif">my $appPath = $FindBin::Bin;</font>
<br>
<br><font size=2 face="sans-serif"><br>
---<br>
Rick Croote<br>
Software Engineer<br>
Environment and Tools Team<br>
Philips Medical Systems<br>
Bothell, WA<br>
Rick.Croote@Philips.com<br>
Phone: 425-487-7834<br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=33%>
<br>
<br>
<br>
<br>
<br><font size=1 face="sans-serif"><b>Colin Meyer <cmeyer@helvella.org></b>
</font>
<p><font size=1 face="sans-serif">Sent by:</font>
<br><font size=1 face="sans-serif">spug-list-bounces+rick.croote=philips.com@pm.org</font>
<p><font size=1 face="sans-serif">2006-05-30 04:21 PM</font>
<td width=66%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">jlb <jlb@io.com></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td><font size=1 face="sans-serif">spug-list@pm.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">Re: SPUG: finding full path to itself</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Classification</font></div>
<td></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<div align=right>
<br></div></table>
<br>
<br>
<br><font size=2><tt>On Tue, May 30, 2006 at 05:40:05PM -0500, jlb wrote:<br>
> Cwd.pm provides some portable, safe methods to determine your current
<br>
> working directory.<br>
<br>
Or see FindBin.pm, if you want to know where the script itself is<br>
located (e.g. to be able to read a config file from the same dir).<br>
<br>
-Colin.<br>
<br>
> <br>
> On Tue, 30 May 2006, Satish Gupta wrote:<br>
> <br>
> > When I a stand-alone script is running, how can this script determine
it's own absolute path in a portable manner?<br>
> ><br>
> > I notice that $0 works differently on different OS's. On
some it gives full path and not on others.<br>
> ><br>
> > Thanks<br>
> ><br>
> ><br>
> > ---------------------------------<br>
> > Be a chatter box. Enjoy free PC-to-PC calls with Yahoo!
Messenger with Voice.<br>
> _____________________________________________________________<br>
> Seattle Perl Users Group Mailing List <br>
> POST TO: spug-list@pm.org<br>
> SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list<br>
> MEETINGS: 3rd Tuesdays<br>
> WEB PAGE: http://seattleperl.org/<br>
_____________________________________________________________<br>
Seattle Perl Users Group Mailing List <br>
POST TO: spug-list@pm.org<br>
SUBSCRIPTION: http://mail.pm.org/mailman/listinfo/spug-list<br>
MEETINGS: 3rd Tuesdays<br>
WEB PAGE: http://seattleperl.org/<br>
</tt></font>
<br>