What is the recommended way to package perl scripts for CPAN (and CorporatePAN)?

I recently looked at the CPAN module that comes with the script installed, which made me think. What is the recommended way to include a script in a package that should be included in a public CPAN, and if there is any other recommendation for packages to be released on the internal CPAN server?

The script starts as follows:

#!/usr/bin/perl

eval 'exec /usr/bin/perl  -S $0 ${1+"$@"}'
  if 0; # not running under some shell

Two questions

Do I understand correctly that the eval part is not needed? This will be implemented by the CPAN client during installation, and it will be different when installing on Windows.

What is the recommended sh-bang line? Will it

#!/usr/bin/env perl

instead of the above?

+3
source share
2

#!/usr/bin/perl

(, , perl .)

:: Build MakeMaker script, #! perl, . "eval exec", Windows, .bat. ( CPAN .)

#!/usr/bin/env perl

, Perl script, #!.

+6

, perl #! perl ( $Config{startperl}). , . (: cjm, #! perl, env.)

eval perl, script sh scriptname. .

+3

Source: https://habr.com/ru/post/1781398/


All Articles