DRY

Web関連の技術の事、食事/お酒の事、旅行の事など

dotcloudでperlも試しておく

ついでなので、perl環境も試しておこう。

環境は変わらずWindows7 + Cygwinです。


とりあえず、perlのframeworkはdancerというのを使っているらしい。
すみません。。。よく知らないのでおいおい勉強しておきます。

当然Plack/PSGIなんだねって事で。とりあえずdancer入れずに試してみる。

dotcloudのperlのドキュメントを読んでみると
Makefile.PLで依存関係を記載しておき、app.psgiがキックされるらしい。
staticディレクトリは。。。今はいいでしょ。


ディレクトリ構成は
/home/dotcloud/perl

_Makefile.PL
_app.psgi
_static/

と言った形にしました。


Makefile.PL

PREREQ_PM => {
'Test::More' => 0,
'YAML' => 0,
'Plack' => 0.9974,
},


■app.psgi


use strict;
use warnings;

return sub {
my $env = shift;
return [200, [ 'Content-Type' => 'text/html' ], ["Hello perl on dotcloud"],]
};

で先日のnode.jsもあるのでアプリ「remen」の中にサービス「node」と「perl」を作るイメージです。


user@machine /home/dotcloud/perl
$ dotcloud deploy -t perl remen.perl

perlの下をpush


user@machine /home/dotcloud/perl
$ dotcloud push remen.perl .

でURL見てみると、まったく問題なし。

それで、dancer使ってみようと他のサイト調べると、みんなdancerをcpanmしてるんだよね。
ローカルに入れないとダメなの???

わからないので、実施してみる。
Makefile.PL


PREREQ_PM => {
'Test::More' => 0,
'YAML' => 0,
'Dancer' => 1.3030,
'Plack' => 0.9974,
},


■app.psgi


use strict;
use warnings;
use Dancer;

get '/' => sub
{
"Hello perl on dotcloud /w dancer"
}

dance;

でpush
Reloading nginx configuration: nginx.
uwsgi: ERROR (abnormal termination)

あれ?ERRORだ。やっぱダメなのかな?


user@machine /home/dotcloud/perl
$ dotcloud logs remen.perl
でログを確認してみる。


Operational MODE: single process ***

Can't locate Dancer.pm in @INC (@INC contains: /home/dotcloud/perl5/lib/perl5 /o
pt/perl5//perls/perl-5.12.3/lib/site_perl/5.12.3/x86_64-linux-thread-multi /opt/
perl5//perls/perl-5.12.3/lib/site_perl/5.12.3 /opt/perl5//perls/perl-5.12.3/lib/
5.12.3/x86_64-linux-thread-multi /opt/perl5//perls/perl-5.12.3/lib/5.12.3 .) at
(eval 3) line 4.
BEGIN failed--compilation aborted at (eval 3) line 4.

だそうな。やっぱローカル見てるんだね。

じゃあDancer入れましょうかって事で。


perl -MCPAN -e shell
install Dancer

                                                                                                    • -

Failed 44/213 test programs. 204/1495 subtests failed.
make: *** [test_dynamic] Error 255
SUKRIA/Dancer-1.3051.tar.gz
make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports SUKRIA/Dancer-1.3051.tar.gz
Running make install
make test had returned bad status, won't install without force
Failed during this command:
SUKRIA/Dancer-1.3051.tar.gz : make_test NO

だと言うので、Dancerのreportを見てみると

[FAIL 5.10.1 Windows (Cygwin) 1.7.5(0.22553) i686-cygwin-thread-multi-64int]
ってなってるよ。。。あれ?どうしよう。出来ないんでは

間違ってないよね???



う〜ん、、、ちょっとMacCPAN入れて試してみよう。



ちなみに余談ですがCygwinでやっていると
cpan > install MODULE
すると
C:\cygwin\bin\perl.exe: *** fatal error - unable to remapみたいなエラーが出まくって、こいつを解決するためには都度Windowsコマンドプロンプト

C:\cygwin\bin>ash rebaseall -v
再起動

しなきゃいけないみたいなので、ちょっとメンドクサイな〜っと。。。




そう言えば、いつかtatsumakiは動くのかな?