develooper Front page | perl.perl5.porters | Postings from June 2015

Re: Batch file generation for installed scripts on Windows

Thread Previous | Thread Next
From:
kmx
Date:
June 3, 2015 05:49
Subject:
Re: Batch file generation for installed scripts on Windows
Message ID:
556E9561.8030808@atlas.cz
On 2.6.2015 17:40, Leon Timmermans wrote:
> On Tue, Jun 2, 2015 at 2:17 PM, A. Sinan Unur <sinan@unur.com 
> <mailto:sinan@unur.com>> wrote:
>
>     As far as I can tell, all this requires is to use $^X instead of perl
>     in win32\bin\pl2bat.bat.
>
>     Are there any pitfalls I am not seeing?
>
>
> Actually, there is one pitfall: relocatable perls (such as Strawberry 
> Portable). In that case it probably should use PATH instead of a 
> hard-coded value.

Strawberry Perl Portable uses a hack like this:

IF EXIST "%~dp0perl.exe" (
"%~dp0perl.exe" -x -S %0 %*
) ELSE IF EXIST "%~dp0..\..\bin\perl.exe" (
"%~dp0..\..\bin\perl.exe" -x -S %0 %*
) ELSE (
perl -x -S %0 %*
)

It assumes that *.bat file is in one of the following dirs:
<perl_root>\bin
<perl_root>\site\bin
<perl_root>\vendor\bin
with fallback to pure "perl" somewhere in the PATH.

--
kmx

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About