Go Back   Velocity Reviews > Newsgroups > PERL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

PERL - Re: Finding directory my perl program was loaded from

 
Thread Tools Search this Thread
Old 10-13-2009, 05:12 AM   #1
Default Re: Finding directory my perl program was loaded from


[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


Jürgen Exner
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
The Microsoft Windows 7 Upgrade Program Admin Front Page News 0 02-10-2009 05:21 PM
This is incredible! jc_ice DVD Video 1 08-13-2006 10:47 AM
make lots O money fast an easy migeul A+ Certification 0 03-06-2004 01:45 AM
Been around for a while but very effective Paul A+ Certification 0 02-29-2004 12:14 PM
Re: free email addresses finding program (files included) Leonardo A+ Certification 1 12-05-2003 03:51 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

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