From 7a836119031588b0cef69d5e819334d7e4cf9a02 Mon Sep 17 00:00:00 2001 From: Piotr Strzelczyk Date: Fri, 4 Jun 2010 00:03:13 +0000 Subject: support for Perl scripts starting with eval-exec-perl git-svn-id: svn://tug.org/texlive/trunk@18711 c570f23f-e606-0410-a88d-b1316a301751 --- Master/bin/win32/runscript.tlu | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Master') diff --git a/Master/bin/win32/runscript.tlu b/Master/bin/win32/runscript.tlu index 396f81a1da6..64496ca11ab 100644 --- a/Master/bin/win32/runscript.tlu +++ b/Master/bin/win32/runscript.tlu @@ -201,6 +201,9 @@ local docstr = [[ - more doc tweaks 2010/05/30 - Windows XP or newer required to run TeXworks + 2010/06/04 + - added support for Perl scripts starting with eval-exec-perl + construct in place of she-bang (#!) ]] -- HELPER SUBROUTINES -- @@ -263,7 +266,11 @@ local function shebang_to_argv(progfullname) if not fid then return nil, errmsg end local fstln = fid:read('*line') fid:close() - if (string.sub(fstln, 1, 2) ~= '#!') then + if string.find(fstln, "eval.*exit.*exec.*perl") then + -- special case of Perl's time-honoured "totally devious construct": + -- eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' && eval 'exec perl -S $0 $argv:q' + return {"perl"} + elseif (string.sub(fstln, 1, 2) ~= '#!') then return nil, "don't know how to execute script: "..progfullname end local argv = string.explode( string.sub(fstln, 3) ) -- split on spaces -- cgit v1.2.3