Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Distributing non-Perl script in a Perl distribution?

by sundialsvc4 (Abbot)
on Aug 06, 2015 at 01:35 UTC ( #1137603=note: print w/replies, xml ) Need Help??


in reply to Distributing non-Perl script in a Perl distribution?

It would be helpful if you could explicitly state what you mean by “a Perl distribution.”   To whom are you “distributing” ... exactly what ... exactly how?   Are you speaking of “building a new CPAN contribution?”   Do you need to consider the possibility of this “distribution” being installed on a Windows system?   A mainframe?

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

Replies are listed 'Best First'.
Re^2: Distributing non-Perl script in a Perl distribution?
by perlancar (Pilgrim) on Aug 07, 2015 at 22:52 UTC

    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.

      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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1137603]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (10)
As of 2019-10-14 20:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?