in reply to Re: Distributing non-Perl script in a Perl distribution?
in thread Distributing non-Perl script in a Perl distribution?

Yup, I was talking about a CPAN distribution, and installing a shell script (or Python script, or some other non-Perl script) via MakeMaker. I'm wondering a quick-hack solution of adding Makefile parameters/targets like this:

SHELL_EXE_FILES = bin-sh/somescript
PYTHON_EXE_FILES = bin-py/somescript2

$(INST_SCRIPT)/somescript :: bin-sh/somescript ...
    $(NOECHO) $(RM_F) $(INST_SCRIPT)/somescript
    $(CP) bin-sh/somescript $(INST_SCRIPT)/somescript
    $(FIXIN) bin-sh/somescript $(INST_SCRIPT)/somescript
    -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_SCRIPT)/somescript

$(INST_SCRIPT)/somescript2 :: bin-py/somescript2 ...
    $(NOECHO) $(RM_F) $(INST_SCRIPT)/somescript2
    $(CP) bin-py/somescript2 $(INST_SCRIPT)/somescript2
    $(FIXIN) bin-py/somescript2 $(INST_SCRIPT)/somescript2
    -$(NOECHO) $(CHMOD) $(PERM_RWX) $(INST_SCRIPT)/somescript2

The non-Perl scripts will be installed like Perl scripts, except they won't get a manpage (or they could, if we put a POD either inside the script or somewhere else, inside the script if the language supports something equivalent to Perl's __END__), and in the fixin step the appropriate shebang will be chosen.

  • Comment on Re^2: Distributing non-Perl script in a Perl distribution?

Replies are listed 'Best First'.
Re^3: Distributing non-Perl script in a Perl distribution?
by Anonymous Monk on Aug 08, 2015 at 00:27 UTC

    See https://metacpan.org/pod/ExtUtils::MakeMaker#EXE_FILES and PL_FILES

    $ module-starter --module Goner --email email --author author --verbos +e --eumm Created Goner Created Goner\lib Created Goner\lib\Goner.pm Created Goner\t Created Goner\t\pod-coverage.t Created Goner\t\pod.t Created Goner\t\manifest.t Created Goner\t\boilerplate.t Created Goner\t\00-load.t Created Goner\ignore.txt Created Goner\Makefile.PL Created Goner\Changes Created Goner\README Added to MANIFEST: Changes Added to MANIFEST: ignore.txt Added to MANIFEST: lib/Goner.pm Added to MANIFEST: Makefile.PL Added to MANIFEST: MANIFEST Added to MANIFEST: README Added to MANIFEST: t/00-load.t Added to MANIFEST: t/boilerplate.t Added to MANIFEST: t/manifest.t Added to MANIFEST: t/pod-coverage.t Added to MANIFEST: t/pod.t Created Goner\MANIFEST Created starter directories and files $ cd Goner $ md bin $ echo #!/usr/bin/python -- > bin\py.py $ echo #!/usr/bin/bash -- > bin\ba.sh $ echo @echo off -- > bin\ba.bat $ perl -i.bak -pe " s{^(.*?NAME.*)}{$1 EXE_FILES => [glob q{bin/*}], } +;" Makefile.PL $ perl Makefile.PL INSTALL_BASE=thebase Checking if your kit is complete... Looks good Generating a dmake-style Makefile Writing Makefile for Goner Writing MYMETA.yml and MYMETA.json $ dmake install cp lib/Goner.pm blib\lib\Goner.pm "C:\citrusperl\bin\perl.exe" -MExtUtils::Command -e cp -- bin/py.py bl +ib\script\py.py pl2bat.bat blib\script\py.py "C:\citrusperl\bin\perl.exe" -MExtUtils::Command -e cp -- bin/ba.bat b +lib\script\ba.bat pl2bat.bat blib\script\ba.bat "C:\citrusperl\bin\perl.exe" -MExtUtils::Command -e cp -- bin/ba.sh bl +ib\script\ba.sh pl2bat.bat blib\script\ba.sh Installing thebase\lib\perl5\Goner.pm Installing thebase\bin\ba.bat Installing thebase\bin\ba.sh Installing thebase\bin\ba.sh.bat Installing thebase\bin\py.py Installing thebase\bin\py.py.bat Appending installation info to thebase\lib\perl5\MSWin32-x86-multi-thr +ead/perllocal.pod