Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Answer: How do I find what dir the perl script is running from?

( #47038=categorized answer: print w/ replies, xml ) Need Help??

Q&A > GUI Programming > How do I find what directory the perl script is running from? contributed by merlyn

No. There are partial answers based on examining $0 and $ENV{PATH}, with algorithms rolled up into File::FindBin, but nothing will ever be completely unspoofable or accurate.

Comment on Answer: How do I find what dir the perl script is running from?
Replies are listed 'Best First'.
(tye)Re: Answer: How do I find what dir the perl script is running from?
by tye (Cardinal) on Dec 19, 2000 at 01:58 UTC

    See FindBin is broken (RE: How do I get the full path to the script executing?) for why this is completely wrong. (:

    Update: Just FYI, I interpret the original question as wanting to know about getcwd() and use Cwd, rather than wanting the full path to the script (which is what File::FindBin tries to find in a very perverse way). But it is hard to say for sure.

            - tye (but my friends call me "Tye")
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (6)
As of 2015-07-08 06:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (96 votes), past polls