in reply to How to make distribution for simple script with CPAN dependencies?

Hi, welcome to Perl, the One True Religion.

See App::FatPacker ("pack your dependencies onto your script file").

Hope this helps


The way forward always starts with a minimal test.
  • Comment on Re: How to make distribution for simple script with CPAN dependencies?

Replies are listed 'Best First'.
Re^2: How to make distribution for simple script with CPAN dependencies?
by peteyboy (Novice) on Mar 08, 2024 at 23:59 UTC
    That seemed like a great idea, and I tried Fatpacker, but it causes a weird issue when it runs; I use Curses::UI and on a exit(), the program dumps a portion of turkish language __DATA__ to the screen (from Curses::UI::Languages?) and requires a ctl-c to exit? Ugh. This doesn't happen normally. And I tried to install PP and am getting errors :(

      "And I tried to install PP and am getting errors :(

      Which errors?

        Two things: 1) There's been a bug reported on Curses::UI and the way it does its language phrase replacement which is apparently incompatible with fatpacker: https://rt.cpan.org/Public/Bug/Display.html?id=85231 Sadly, this bug is from 2013 and maybe beyond my ken to fix.

        And 2nd, trying to install pp instead and maybe see if the PARs work better, these are the errors I got trying to install pp (this in my local lib, I'm on SDF.org):

        "/usr/bin/perl" par_pl2c.pl my_par_pl < ../script/par.pl > my_par_pl.c x86_64-linux-gnu-gcc -c -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv -f +no-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_ +FILE_OFFSET_BITS=64 -I/usr/lib/x86_64-linux-gnu/perl/5.36/CORE -DLD +>x86_64-linux-gnu-gcc -c -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fwrapv +-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE - +D_FILE_OFFSET_BITS=64 -I/usr/lib/x86_64-linux-gnu/perl/5.36/CORE -D +LD>x86_64-linux-gnu-gcc main.o sha1.o -s -Wl,-E -fstack-protector-s +trong -L/usr/local/lib -L/usr/lib/x86_64-linux-gnu/perl/5.36/CORE -l +perl -ldl -lm -lpthread -lc -lcrypt -o ./par /usr/bin/ld: cannot find -lperl: No such file or directory collect2: error: ld returned 1 exit status make[1]: *** [Makefile:885: par] Error 1 make[1]: Leaving directory '/meta/p/peteyboy/.cpanm/work/1710133941.11 +99273/PAR-Packer-1.062/myldr' make: *** [Makefile:577: subdirs] Error 2 -> FAIL Installing pp failed. See /meta/p/peteyboy/.cpanm/work/1710133 +941.1199273/build.log for details. Retry with --force to force instal +l it.

      Oh my goodness, I found this bug; https://rt.cpan.org/Public/Bug/Display.html?id=26728

      It is my exact issue, and I copied the lines in the "fix" directly into my local library to change Curses/UI/Language.pm, and I *think* it's working. I made a fatpack of my single-file perlscript and it doesn't break when it runs, but now I need to run it in an environment without my local lib in it.

      *fingers crossed

      Thks for the pointers! How would I get this patch into Curses::UI, or how can I set up patches like this so I don't lose them if I reinstall or something?

        How would I get this patch into Curses::UI ...

        I'd start by looking at section VI of the CPAN FAQ. In this case, the lack of updates since 2011 suggests that you or someone else would probably need to volunteer to take over maintenance of the distribution.

        ... or how can I set up patches like this so I don't lose them if I reinstall or something?

        I don't know how others would do it, but I prefer to keep the installation of packages pretty manual. I create a build script for each module/version that I install, mostly auto-generated by a local script based on the URL of the download package, and then tweak and comment for any idiosyncracies noted when building. So for example I have /src/perl/build/Devel-Debug-DBGp-0.22, which applies the patch from issue #6:

        cd /src/perl wget -P archive https://cpan.metacpan.org/authors/id/M/MB/MBARBON/Deve +l-Debug-DBGp-0.22.tar.gz # requires: # ... cd /src/perl zcat archive/Devel-Debug-DBGp-0.22.tar.gz | tar xf - cd /src/perl/Devel-Debug-DBGp-0.22 patch -p0 </src/perl/build/Devel-Debug-DBGp-PUSHMARK.patch cd /src/perl/Devel-Debug-DBGp-0.22 ${PERL} Makefile.PL make all test install cd /src/perl rm -rf Devel-Debug-DBGp-0.22

        I usually build things by pasting relevant paragraphs from the build script into a terminal window, but it's easy to stitch these together to recreate a full build.