Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: How to determine the path to the Perl binary that executed your program?

by rafl (Friar)
on Sep 28, 2006 at 19:37 UTC ( #575411=note: print w/ replies, xml ) Need Help??

Comment on Re: How to determine the path to the Perl binary that executed your program?
Re^2: How to determine the path to the Perl binary that executed your program?
by Anonymous Monk on Sep 28, 2006 at 19:40 UTC
    That gets its value from the config file. So that would fail for the same reasons given above for using Config.pm. After compilation, the Perl binary could be moved or renamed.

      Actually, it doesn't.

      $ perl -le'print $^X' /usr/bin/perl $ cp /usr/bin/perl ~/tmp/ $ ./tmp/perl -le'print $^X' /home/rafl/tmp/perl

      Cheers, Flo

        according to perldoc perlvar,
        Depending on the host operating system, the value of $^X may be a relative or absolute pathname of the perl program file, or may be the string used to invoke perl but not the pathname of the perl program file.
        and indeed,
        osx% perl -le'print $^X' perl
      No, $^X comes from C's argv[0]. If perl was in the path, then it may just be "perl", in which case File::Which should track down the correct version. Or it could be a relative path, which can be resolved to a full path.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://575411]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (14)
As of 2014-10-30 13:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls