Advent Calendar 1日目、2日目
環境構築
- perlbrew のインストール
$ curl -LO http://xrl.us/perlbrew $ chmod +x perlbrew $ ./perlbrew init $ mv ~/perl5/perlbrew/etc/bashrc mv ~/perl5/perlbrew/etc/zshrc $ echo 'source ~/perl5/perlbrew/etc/bashrc' >> ~/.zshrc $ source ~/.zshrc
- perl 5.14.2 cpanm のインストール
$ perlbrew install perl-5.14.2 --as 5.14.2 $ perlbrew install-cpanm $ capnm --self-upgrade
plackをインストール
$ cpanm install Plack
#えっw そこからっていうw
Ark モジュールのインストール
$ cpanm Module::Install::TestBase Module::Install::Repository Module::Install::AuthorTests $ cpanm https://github.com/typester/Path-AttrRouter/tarball/master $ cpanm https://github.com/typester/ark-perl/tarball/master
githubからのがインストールできないのでローカルにもってきて展開した
$ wget --no-check-certificate https://github.com/typester/Path-AttrRouter/tarball/master $ mv master master.tar.gz $ cpanm master.tar.gz $ wget --no-check-certificate https://github.com/typester/ark-perl/tarball/master $ cpanm master ark.tar.gz
Moduleのセットアップ
スケルトン(雛形)作成用
$ cpanm Module::Setup $サンプルではこれを使うらしい $cpanm https://github.com/Songmu/p5-Module-Setup-Flavor-ArkDBIC/tarball/master
これもgithubから上手くインストールできなかったのでさっきと同様に
$ wget --no-check-certificate https://github.com/Songmu/p5-Module-Setup-Flavor-ArkDBIC/tarball/master $ mv master flovar.tar.gz $ cpanm flovar.tar.gz module-setup >|shell| $ module-setup --init --flavor-class=Ark ark
このコマンド後に名前やアドレスが聞かれる。
アプリケーション
ここまでくるのに長かった...
$ module-setup Jobeet [1]: default [2]: ark Select flavor: [1]
きちんとインストールされているとこのような画面になるはず。
今回はarkでのアプリケーション作りなので 2 を選択
実行
&plackup -r dev.psgi Watching ./lib dev.psgi for file updates. [debug] Loaded Path actions: .--------------------------------------+---------------------------------------. | Path | Private | +--------------------------------------+---------------------------------------+ | / | /index | | /... | /default | '--------------------------------------+---------------------------------------' [debug] Setup finished HTTP::Server::PSGI: Accepting connections at http://0:5000/
- r はデバッグ用のオプションで色々と便利らしい。
ただ、CPUを浪費するらしく 以下のXS(エクステンション)モジュールをインストール
$ cpanm Mac::FSEvents
とりあえず、ここまで。