FATPACK(1p)

πŸ“¦
version 0.010008 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– fatpack β€” the command line frontend for App::FatPacker πŸ’–

okay bestie, listen. fatpack is literally the glow-up your Perl script has been waiting for. it's the command line frontend for App::FatPacker, and it's gonna take your script plus all its lil module dependencies and squish them into one single packed file. no cap. let's get into it 🫢


✨ COMMANDS ✨

πŸŽ€ pack

$ fatpack pack myscript.pl > myscript.packed.pl

this is the one-shot slay β€” a shortcut that does all the work for you: tracing, collecting packlists, extracting modules in fatlib, and then concatenating everything into a packed script. one command, whole job done, periodt.

but if you need more detailed controls for additional modules, don't stress β€” just use the following commands separately (peep "RECIPES" below, iykyk).

πŸ¦‹ trace

$ fatpack trace [--to=trace-file|--to-stderr] [--use=MODULE]
    myscript.pl

this one compiles myscript.pl (literally like perl -c does) and writes out a trace file containing every module require()d during the compilation. the receipts, basically. πŸ’…

  • the trace file is called fatpacker.trace by default β€” but the --to option overrides that.
  • if you pass --to-stderr, fatpack writes the trace to STDERR instead.
  • you cannot pass both --to and --to-stderr. pick a lane, babe. πŸ™ˆ
  • if the --use option specifies a module (or modules, if used multiple times) those modules will be additionally included in the trace output. sneaky extra credit, love that for them.

🌸 packlists-for

$ fatpack packlists-for Module1 Module2 Module3

this cutie searches your perl's @INC for .packlist files containing the .pm files for the modules you requested, then emits a list of unique packlist files to STDOUT.

these packlists will, in a pure cpan-installation environment, be all non-core distributions required for those modules. so like, the full dependency roster.

😭 unfortunately most vendors strip the .packlist files, so if you installed modules via e.g. apt-get you may be missing those modules. the preferred workaround is installing your dependencies into a local::lib first. do that, bestie, trust.

🌈 tree

$ fatpack tree fatlib packlist1 packlist2 packlist3

takes a list of packlist files and copies their contents into a tree at the requested location. planting your little module garden. 🌱

this tree should be sufficient to use lib to make available all modules provided by the distributions whose packlists were specified. iconic behavior tbh.

πŸ‘‘

$ fatpack file

wait the heading got eaten β€” it's the file command, obviously πŸ’…

this one recurses into the lib and fatlib directories and bundles all .pm files found into a BEGIN block which adds a virtual @INC entry to load these files from the bundled code rather than disk. main character energy: it stops reading from disk and reads from itself.


πŸ“ RECIPES πŸ“

current basic recipe for packing:

$ fatpack trace myscript.pl
$ fatpack packlists-for `cat fatpacker.trace` >packlists
$ fatpack tree `cat packlists`
$ fatpack file myscript.pl >myscript.packed.pl

four steps, one glow-up, absolute serve. ✨


see the corresponding sections in App::FatPacker. (not gatekeeping, just pointing you to the source fr fr 🫢)


and that's the whole vibe check, bestie. this page came to you courtesy of perl v5.36.0, dated 2022-11-20 β€” go pack something iconic. mwah. πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from