Generally, when a Perl module in开发者_如何转开发stalls an executable script, it somehow changes the #!/usr/bin/perl
line to point to the appropriate Perl path. For example, if I used the perl installed at /usr/local/bin/perl
to install the module, then the shebang line will be changed to #!/usr/local/bin/perl
, so that the installed script will always use the version of perl that installed it.
What does this, and how can I do it in my own modules that install scripts?
Edit
Note that I am specifically talking about executable perl scripts that are distributed as part of a Perl module. Since a module is installed to a specific version of Perl, any scripts installed by that module must use that same version, so is wrong.#!/usr/bin/env perl
From http://metacpan.org/pod/ExtUtils::MakeMaker
EXE_FILES
Ref to array of executable files. The files will be copied to the INST_SCRIPT directory. Make realclean will delete them from there again.
If your executables start with something like #!perl or #!/usr/bin/perl MakeMaker will change this to the path of the perl 'Makefile.PL' was invoked with so the programs will be sure to run properly even if perl is not in /usr/bin/perl.
精彩评论