plenv freeze

plenv のplugin、plenv freezeを作った。 github.com

たとえばCPAN moduleを作っている人は、テストのため あるperlのinstallationを コアモジュール以外何もインストールしていない状態に保っていたいことがあるかもしれない。 plenv freezeは、あるperlのinstallationをread only(ファイルは0444, ディレクトリは0555)にすることで、これを助けてくれる。

僕は、このアイデアをgotandapmでのSongmuさんの発表で知った。 http://songmu.github.io/slides/gotandapm4/#6

もともとはmiyagawaさんのアイデアとのこと。

またokinawapmにてpapixさんもこの話をされていた。

ということで、自分含めて少しは需要がありそうなのでpluginとしてまとめてみた。

Install latest perl to Ubuntu on Windows

Have you tried Ubuntu on Windows? It looks great!

To use perl in Ubuntu on Windows, it seems that we should set dont_use_nlink true in at least File::Find. See https://github.com/Microsoft/BashOnWindows/issues/186 for details.

So here is how to install perl 5.24 to Ubuntu on Windows. Make sure dont_use_nlink defined.

# set LANG explicitly to avoid weird problems....
$ export LANG=en_US.UTF-8

# need cc and make to build perl...
$ apt-get install gcc make

# usual way
$ wget http://www.cpan.org/src/5.0/perl-5.24.0.tar.gz
$ tar xzf perl-5.24.0.tar.gz
$ cd perl-5.24.0

# define dont_use_nlink
$ echo "dont_use_nlink='define'" >> Policy.sh

# back to usual way (change prefix as you want)
$ ./Configure -des -Dprefix=/root/perl
$ make
$ make install

Easy.

Let's install some CPAN modules, say Plack.

$ export PATH=/root/perl/bin:$PATH
$ perl -v
This is perl 5, version 24, subversion 0 (v5.24.0) built for x86_64-linux

# install cpanminus
$ curl -sSL https://cpanmin.us | perl - -nq App::cpanminus

# install some CPAN modules, say Plack
$ cpanm -nq Plack

$ plackup -e 'sub {[200,[],["Hello world!"]]}'
HTTP::Server::PSGI: Accepting connections at http://0:5000/

You can access http://localhost:5000 from your browser in Windows.

No more emulation of fork(). Wow!

WEB+DB PRESSにPerl6の記事を書いた + Gotanda.pmでPerl6の話をした

6/24に発売されたWEB+DB PRESS Vol.93に「Perl6の歩き方」という記事を書かせてもらった。 gihyo.jp

内容としては

  • Perl6のインストール方法
  • 僕がPerl6をさわってまっさきに関数の書き方がたくさんあるなと感じたので、関数のこと
  • エコシステム(モジュールインストール方法、モジュールの書き方)

である。とりあえずPerl6さわってみるかという方に是非読んでもらいたい。

さて、もし上記の入門記事の読んだ方はPerl6は”実際”使えるのかと疑問に思うかもしれない。そこで試みとして6/29に行われたGotanda.pm#9で「Reactive Programming in Perl6」という話をさせてもらった。

speakerdeck.com

タイトル通り、Perl6でReactive Programmingできるかを考えたもので、結論としてはSupplyを使ってできそう、というものだ。僕自身のReactive Programming知らなさすぎな感が否めなかったので、ちゃんと勉強して再び追究したい。

結論

Perl6あつい!