peteyboy has asked for the wisdom of the Perl Monks concerning the following question:

Hi, learning perl. Wrote a cool little script that's a TUI smolnet browser. It uses a few cpan modules. I can't figure out how to package it for others to use! I tried using App:ModuleBuildTiny but am stuck. I used mbtiny and made a dummy module for my 'app' and I ended up with a bunch of install files and a useful META.json file. I use 'mbtiny dist' and it builds a tar.gz with all the MANIFEST files and everything.The build/install steps leading from Build.PL don't pull down any dependencies. Running the perl program after "install" still doesn't work.

If the installing user separately downloads cpanm and run it with ' --installdeps . ', THEN it will work. Is there no distribution installation tool that just installs the program in user space so it will work?

I feel like I am doing all this stuff, making a dummy Perl Module so the build will work, generating all these files, hiding my perl script in a script/ folder, where it isn't even made executable by the build process...

If a user were to simply unzip the dist that I built, and run cpan against the MYMETA.json (or yaml, do I even need both?), then put the pl file I made anywhere in their user space and made it executable, then it would just work, right? All my perl script needs is a MYMETA.yml generated for it and a script to run cpanm for local lib, it seems like. Running Build and Build Install don't seem do much for a single perl script 'app.

Is there a simpler tooling that just does that? Is there a way to tell mbtiny to do that? Do I need to figure out the even more complicated DistZilla?

I'm lost here, thanks for any advice.

I made this .pm file in "App::" which has the same "use" statements as my perl script.

package App::Connex; use FindBin qw($Bin); use lib "$Bin/../lib"; use Curses::UI; use Net::Telnet; use URI::Split qw(uri_split uri_join); use URI (); our $VERSION = '0.9'; # VERSION 1; # ABSTRACT: A Curses TUI Browser for Nightfall Express NEX:// protocol __END__ =pod =encoding UTF-8 =head1 NAME App::Connex - Curses UI NEX:// browser ...
  • Comment on How to make distribution for simple script with CPAN dependencies?
  • Download Code

Replies are listed 'Best First'.
Re: How to make distribution for simple script with CPAN dependencies?
by 1nickt (Canon) on Mar 08, 2024 at 20:41 UTC

    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.
      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?

        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?

Re: How to make distribution for simple script with CPAN dependencies?
by Bod (Parson) on Mar 09, 2024 at 00:05 UTC
Re: How to make distribution for simple script with CPAN dependencies?
by kcott (Archbishop) on Mar 09, 2024 at 06:47 UTC

    G'day peteyboy,

    Welcome to the Monastery.

    I would suggest looking at how others have done this in the past and adapting their efforts to your needs.

    The first one that immediately came to mind was Regexp::Debugger. I've been using this for over a decade and have installed it (without problems) with every new version of Perl I've installed.

    This alone may be sufficient for your needs; however, there would be many other distributions which also include scripts.

    For creating your distribution, you might look at Module::Starter whose installation includes the script module-starter. Its installation only uses ExtUtils::MakeMaker (Makefile.PL); however, the distributions you create with module-starter can use other (or even multiple) builders.

    — Ken

Re: How to make distribution for simple script with CPAN dependencies?
by eyepopslikeamosquito (Archbishop) on Mar 09, 2024 at 02:59 UTC

    Hi, learning perl.

    G'day peteyboy and welcome to the monastery!

    The most glaring thing I noticed in your first post is the lack of:

    use strict; use warnings;
    This topic, along with many others, is discussed in many of the links here: Learning Perl Links

    Good luck on your learning Perl journey and please feel free to ask us further questions.

    👁️🍾👍🦟
      Oh, thanks, forgot to put that in the dummy pm file. I will do it!