Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Avoiding Hardcoded path of Perl.exe in coding

by thunders (Priest)
on Jan 07, 2010 at 05:21 UTC ( #816030=note: print w/ replies, xml ) Need Help??


in reply to Avoiding Hardcoded path of Perl.exe in coding

On Mac OS X v10.6 $^X does not give an absolute path, Instead I just get "perl". On linux I get "/usr/bin/perl" for $^X, on windows I get "C:\Perl\bin\perl.exe" for $^X.

If you happen to need the full path, and you want it to work cross platform, this should always give a full path, regardless of platform:

use Config; print $Config{perlpath}


Comment on Re: Avoiding Hardcoded path of Perl.exe in coding
Download Code
Replies are listed 'Best First'.
Re^2: Avoiding Hardcoded path of Perl.exe in coding
by Anonymous Monk on Jan 07, 2010 at 06:25 UTC
    From perlvar
    use Config; $secure_perl_path = $Config{perlpath}; if ($^O ne 'VMS') {$secure_perl_path .= $Config{_exe} unless $secure_perl_path =~ m/$Config{_exe}$/i;}

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (13)
As of 2015-07-29 16:49 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 (265 votes), past polls