[THALJEF - Wed Oct 12 03:08:25 2005]:
Show quoted text> The ExtUtils docs don't seems to explain this. Can you educate me a
> little, and tell me what this does and why it does it?
>
> I can certainly teach Perl::Critic to overlook this (probably by just
> removing it from the parse tree).
Sure.
This functionality is called "fixing the shebang line". It is performed
by both Makefile.PL (via fixin()) and Build.PL (via
process_script_files()) to tweak command-line programs to work with the
local Perl. For example, if my Perl is at /usr/local/bin instead of
/usr/bin, the start line becomes "#!/usr/local/bin/perl -w".
Additionally, some magic is added in case the program is run like "sh
prog.pl". The magic exec line is simultaneously valid shell script and
valid perl code. Under Perl, the "if 0" causes the line to be ignored,
but under sh or csh, it aborts execution and runs the program under perl
instead.
This magic code is added to all Makefile.PL "EXE_FILES" and all Build.PL
"script_files". It is ALWAYS the first code in the program after the
shebang line.
-- Chris