![](https://perlbrew.pl/images/h1-beer.png) perlbrew, Seacan, pau, and other stuffs. Kang-min Liu / @gugod --- <a href="https://pbs.twimg.com/media/FM_4MTjaAAca320?format=jpg&name=medium"> <img src="https://pbs.twimg.com/media/FM_4MTjaAAca320?format=jpg&name=small"> </a> https://twitter.com/kaoru_nkchan/status/1499690097880748034/photo/1 ---- # /me - @gugod / Kang-min Liu / εŠ‰εΊ·ζ°‘ - https://gugod.org - https://dev.to/gugod - Mastodon: [@gugod@g0v.social](https://g0v.social/@gugod) - Perl, Kotlin, Javascript ---- # my recent works - [perlbrew](https://perlbrew.pl) - [Perl::Critic::TooMuchCode][] - [PerlX::ScopeFunction](https://metacpan.org/pod/PerlX::ScopeFunction) - [PerlX::SafeNav](https://metacpan.org/pod/PerlX::SafeNav) make `$o->{a}[42]->foo()` safe. - [Hijk](https://metacpan.org/pod/Hijk) minimal HTTP client - [LINE::Bot::API](https://metacpan.org/pod/LINE::Bot::API) LINE Chatbot SDK [Perl::Critic::TooMuchCode]: https://metacpan.org/pod/Perl::Critic::TooMuchCode --- # 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) [zipapp]: https://docs.python.org/3/library/zipapp.html ---- ## 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 - [x] 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
{"breaks":true,"title":"perlberw, Seacan, pau, and other stuffs.","slideOptions":"{}","contributors":"[{\"id\":\"dcce249b-7b0f-4093-b97b-479c7762dfba\",\"add\":13396,\"del\":13064}]"}
    222 views