toastbread has asked for the wisdom of the Perl Monks concerning the following question:
Just want to ask if there's a function or any other way I
can get the path of installed perl.exe to avoid typing the
hardcoded path in my perl source code?
Here is my current code(I've edited sample code in Perl Cookbook):
Win32::Process::Create($Win32::Process::Create::ProcessObj, 'C:/Perl/bin/perl.exe', #<--THIS LINE IS MY CONCERN 'perl xdos.pl', 0, # Don't inherit. DETACHED_PROCESS, # ".") or # current dir.
I'm trying to remove DOS Window from Perl Tk program which
I succesfully did but I couldn't find a built in funtion to
get the path of perl.exe to supply the 3rd parameter of
Win32::Process::Create().
My perl application will be used in different PC and Perl
was installed in different paths and drives in some PCs. So
I need to not use the hardcoded path.
I am planning to use the "ftype perl" in command line using
system() to get the perl.exe path but I think it is better
to use perl's way since "ftype" is not available in other
OS.
I'd tried to search functions and Environment variables but
I couldn't find what I want.
I hope there is a way other than "ftype perl".
Please lend me the wisdom for this problem.
-toastbread
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Avoiding Hardcoded path of Perl.exe in coding
by Corion (Patriarch) on Jan 06, 2010 at 20:13 UTC | |
Re: Avoiding Hardcoded path of Perl.exe in coding
by BrowserUk (Patriarch) on Jan 06, 2010 at 20:06 UTC | |
Re: Avoiding Hardcoded path of Perl.exe in coding
by thunders (Priest) on Jan 07, 2010 at 05:21 UTC | |
by Anonymous Monk on Jan 07, 2010 at 06:25 UTC | |
Re: Avoiding Hardcoded path of Perl.exe in coding
by MadraghRua (Vicar) on Jan 06, 2010 at 20:19 UTC | |
by toastbread (Novice) on Jan 06, 2010 at 21:51 UTC | |
by BrowserUk (Patriarch) on Jan 06, 2010 at 22:11 UTC |