Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

perlbrew, Seacan, pau, and other stuffs.

Kang-min Liu / @gugod


https://twitter.com/kaoru_nkchan/status/1499690097880748034/photo/1


/me


my recent works


perlbrew

Perl environment manager.

https://perlbrew.pl/


perlbrew install perl-5.38.0
perlbrew use perl-5.38.0

perlbrew install perl-5.18.4
perlbrew use perl-5.18.4

Why perlbrew

  • try newer perls, new operators, new features
  • leave vendor perl alone
  • run tests against multiple perl versions

Big Thanks to Travis CI for choosing perlbrew


can
perlbrew
do more ?


$tagline[0] = "perl environment manager.";
$tagline[1] = await thinking();

# perlbrew switch 5.36
# cpanm App::Ack App::Uni

# uni JOY | ack CAT
😹 - U+1F639 - CAT FACE WITH TEARS OF JOY

% perlbrew use 5.18
% uni WEARY | ack FACE
zsh: uni: command not found...
zsh: ack: command not found...

😩 🙀


Shipping
software

📦 📦 📦


xsawyerx> Riak distribution is awesome. You download a tarball, exract it, then run bin/riak. Everything works from there.

xsawyerx> Can we do the same for perl apps ?

gugod> ok


Seacan

https://metacpan.org/dist/App-Seacan

(proof of concept)-ish


The Seacan approach

Seeacan is a directory containing

  • full perl installation
  • app code
  • app dependencies
  • shebang adjustments

Shipment of Seacan = rsync -ar the entire directory


Pakket

https://github.com/bookingcom/pakket

Basically a solution to a bigger problem.


meanwhile

how do we distribute
pre-packaged software ?


fatpack (perl)

  • "concatenate" all modules in one program
  • very lightweight
  • used by cpanm, cpm, perlbrew etc

PAR (perl)

  • perl modules + XS modules
  • perl itself
  • all sorts of static file
  • self-extracting zip file

static linking (golang)

  • requires no golang libraries to be present on the same system

contianerization (docker)

  • depends on a container runtime (docker, podman)
  • can make non-relocatable app relocatable

macOS .app

  • A app directory contains everything required by the main program
  • dynamic libs, images, videos, text translations

Linux AppImage

  • An archived version of app directory
  • app can be in all programming languages
  • require app to be relocatable

zipapp (python)

  • self-executable zip file
  • (yes, same as PAR)

pipx

Install and run python applications
in isolated environments.

https://pypa.github.io/pipx/


The pipx approach

  • requires /usr/bin/python
  • ~/.local/pipx/venvs/$APP/
  • ~/.local/bin/$APP -> ~/.local/pipx/venvs/$APP/bin/$APP

pau

Isolated installation for a single perl app.

https://github.com/gugod/pau


The pau approach

  • requires /usr/bin/perl, or whatever in $PATH
  • ~/.local/pau/apps/$APP/
  • ~/.local/pau/shims/$APP a shell wrapper, in which PERL5LIB is tweakd
  • ~/.local/bin/$APP -> ~/.locl/pau/shims/$APP

pau

pau install uni -M App::Uni
pau install ack -M App::Ack

pau install cpanoc -M Pod::Cpandoc

* Installs App::ccdiff
pau instll ccdiff

pau |> PAR::Packer

pau install ack -M App::Ack
 
pau pp ack

pau's props

  • Isolated: upgrade A can never break B
  • Uninstlling becomes trivial
  • If app A requires certain version of its dependencies it's OK.
  • Make it easier to invoke pp

perlbrew make-shim

perlbrew use 5.38
cpanm App::Uni App::Ack

perlbrew make-shim uni
perlbrew make-shim ack

cp ./uni ./ack ~/.local/bin

export PATH=~/.local/bin:$PATH

# uni cat grinning

😸 - U+1F638 - GRINNING CAT FACE WITH SMILING EYES

AppImage


packaging perl itself with AppImage

perl.AppDir
├── app
│   └── perl-5.38  # relocatableinc
│       ...
├── AppRun -> ./app/perl-5.38/bin/perl
├── perl.desktop
└── perl.png
appimagetool-x86_64.AppImage perl.AppDir

#=> perl-x86_64.AppImage

# ./perl-x86_64.AppImage -E 'say "Hello from $^V"'

Hello from v5.38.0

packaging uni with AppImage

uni.AppDir
├── app
│   ├── perl-5.38
│   └── uni
├── AppRun
├── uni.desktop
└── uni.png

uni.Appdir/app/uni/

## uni.AppDir
# ./app/perl-5.38/bin/perl =cpanm -L ./app/uni --notest -q App::Uni
...
Successfully installed App-Uni-9.006

AppRun

#!/bin/sh
export PATH=$APPDIR/app/perl-5.38/bin:$APPDIR/app/uni/bin:$PATH
export PERL5LIB=$APPDIR/app/uni/lib/perl5
exec perl $APPDIR/app/uni/bin/uni "$@"

# ./uni-x86_64.AppImage cat grinning
😸 - U+1F638 - GRINNING CAT FACE WITH SMILING EYES

I
know
what we
can make
perlbrew do


New perlbrew commands

  • make-shim
  • make-pp
  • make-fatpack
  • make-appimage
  • make-flatpak

perlbrew

  • env. manager
  • app packaging helper

more?

  • perlbrew 1.00 (the 91st release since 0.10)
  • skaji/relocatable-perl (binary. macOS + linux)
    • use/switch already worked
  • perl-1.0
    • (any volunteers?)
  • perl-[234].0 ?
    • (any volunteers?)
  • more non-p5p perl releases

END

Thanks for
Listening

Select a repo