Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Re: Finding directory my perl program was loaded from

Reply
Thread Tools

Re: Finding directory my perl program was loaded from

 
 
Jürgen Exner
Guest
Posts: n/a
 
      10-13-2009
[comp.lang.perl has been rm-grouped some 15 years ago. If your ISP still
carries this instead of comp.lang.perl.* you should wonder what else you
are missing.]
[x-post and f'up to comp.lang.perl.misc]

Joe Green <> wrote:
>I will put my template file in the same directory that my perl program was loaded from. Is there a reasonable way to determine this directory?


See the second and following parts of "perldoc -q directory":
"How do I add the directory my program lives in"

>Then internally I will (if I get a little help) access "fullPath...template.txt". Until I find out how to do this that line from my patch file will read like . . .
>
>Perl "fullPath...xlate.pl" "fullPath...translate.txt" user.asm >temp.asm


If you don't call the perl interpreter explicitely but just use
"fullPath...xlate.pl ..." then you should find the full path in $0.
Extracting the directory from $0 is trivial using functions from
File::Basename

>I would prefer to not use path environment settings.


Well, $ENV{PATH} does play a major role in deciding which executables to
use, so you cannot just ignore it.

jue
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to list all loaded modules of a perl program Fei Liu Perl Misc 2 03-28-2007 11:08 AM
how to list all loaded modules of a perl program Fei Liu Perl Misc 2 03-27-2007 08:18 PM
Finding a program's directory at runtime Jay C++ 5 12-22-2005 03:28 PM
java -verbose doesn't show "loaded from" for classes loaded from custom jars in the classpath Udo Corban Java 0 01-23-2004 09:32 AM
Re: how to programatically give assembly loaded from network the same trust as those loaded from local host? Marcelo Birnbach [MS] ASP .Net 0 06-27-2003 11:51 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57