Ark入れてみた

なんか以前入れようとしたけど,入ってなかったor失敗して放置してたので
再導入中.
http://gihyo.jp/dev/feature/01/perl_ark/0002

  • install編

$ wget http://cloud.github.com/downloads/typester/ark-perl/Ark-0.001000_001.tar.gz
$ tar zxvf Ark-0.001000_001.tar.gz
$ cd Ark-0.001000_001
$ cpan -t .


ってやったら以下のエラーが出た

# cpan -t .
CPAN: Storable loaded ok
Going to read /root/.cpan/Metadata
Database was generated on Tue, 27 Oct 2009 17:27:09 GMT
Warning: Cannot test ., don't know what it is.
Try the command

i /./

to find objects with matching identifiers.


なので直接makeすることに.

# perl Makefile.PL
Cannot determine author info from lib/Ark.pm

Module::AutoInstall version 1.03
Checking for Perl dependencies...

[Core Features]

  • Test::More ...loaded. (0.86)
  • HTTP::Engine ...loaded. (0.1.8 >= 0.001008)
  • Mouse ...loaded. (0.24 >= 0.21)
  • Path::Class ...loaded. (0.17 >= 0.16)
  • URI ...loaded. (1.38)
  • Text::SimpleTable ...missing.
  • Module::Pluggable::Object ...loaded. (3.9)
  • Data::Util ...missing.
  • Class::Data::Inheritable ...loaded. (0.08)
  • HTML::Entities ...loaded. (3.60)
  • Data::UUID ...missing.
  • Digest::SHA1 ...loaded. (2.12)
  • Devel::StackTrace ...missing.
  • Class::Method::Modifiers::Fast ...missing.
  • HTTP::Engine::Middleware ...missing. (would need 0.13)
  • MIME::Types ...loaded. (1.27)
  • MouseX::Types::Path::Class ...missing.
  • Module::Setup ...missing.
  • FindBin::libs ...loaded. (1.40)

==> Auto-install the 8 mandatory module(s) from CPAN? [y


なんか色々でとる.
んでとりあえずy連打したり色々やってたら完了した!


  • 試してみる編

さっそく試す


げ,エラー

$ ark.pl newapp ArkSample
"GetOptionsFromArray" is not exported by the Getopt::Long module
Can't continue after import errors at /usr/lib/perl5/site_perl/5.8.8/Ark/Command.pm line 5
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Ark/Command.pm line 5.
Compilation failed in require at /usr/bin/ark.pl line 7.
BEGIN failed--compilation aborted at /usr/bin/ark.pl line 7.


ググる
他の人も同じ問題が出ている様子(http://pixiv.cc/mix3/archives/51272425.html)
Getopt::Longを入れる.

# cpan install Getopt::Long
Manifying blib/man3/Getopt::Long.3pm
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/gol-basic......ok 1/9Can't use an undefined value as an ARRAY reference at /usr/lib/perl5/5.8.8/Test/Harness.pm line 373.
make: *** [test_dynamic] エラー 255
/usr/bin/make test -- NOT OK
Running make install
make test had returned bad status, won't install without force


Test::Harnessでコケる
そういえば最近これでコケてforce installしてばっかりだったので,
ついでなのでググったらTest::Harnessのバージョンがアレっぽいので入れなおした

# cpan install Test::Harness
~
Result: PASS
/usr/bin/make test -- OK
Running make install
Installing /usr/lib/perl5/5.8.8/Test/Harness.pm
Installing /usr/bin/prove
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
/usr/bin/make install UNINST=1 -- OK


入れなおす

# cpan install Getopt::Long
~
Result: PASS
/usr/bin/make test -- OK
Running make install
Manifying blib/man3/Getopt::Long.3pm
Installing /usr/lib/perl5/5.8.8/newgetopt.pl
Installing /usr/lib/perl5/5.8.8/Getopt/Long.pm
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
/usr/bin/make install UNINST=1 -- OK


で,サンプル作り直し

$ ark.pl newapp ArkSample
no such command: newapp
Usage:
ark.pl [command] [command_args...]

Commands:
newapp - create new application
controller - create controller
view - create view
model - create model

"ark.pl [command] --help" for command specific usage.


なにこれ怖い
Let's Debug!
/usr/lib/perl5/site_perl/5.8.8/Ark/Command.pm line 36
を変更($@の内容をみてみる)

  • $self->show_usage(2, "no such command: $command")
  1. $self->show_usage(2, "no such command: $command, $@")


結果

Could not load class (Ark::Command::Plugin) because : Could not load class (Module::Setup::Plugin) because : Can't locate Module/Setup/Plugin.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/lib/perl5/site_perl/5.8.8/Mouse.pm line 191.
at /usr/lib/perl5/site_perl/5.8.8/Mouse.pm line 192
Mouse::load_class('Module::Setup::Plugin') called at /usr/lib/perl5/site_perl/5.8.8/Mouse/Meta/Class.pm line 63
Mouse::Meta::Class::superclasses('Mouse::Meta::Class=HASH(0x18808050)', 'Mouse::Object', 'Module::Setup::Plugin') called at /usr/lib/perl5/site_perl/5.8.8/Mouse.pm line 20
Mouse::extends('Mouse::Object', 'Module::Setup::Plugin') called at /usr/lib/perl5/site_perl/5.8.8/Ark/Command/Plugin.pm line 4
require Ark/Command/Plugin.pm called at /usr/lib/perl5/site_perl/5.8.8/Mouse.pm line 191
eval {...} called at /usr/lib/perl5/site_perl/5.8.8/Mouse.pm line 191
Mouse::load_class('Ark::Command::Plugin') called at /usr/lib/perl5/site_perl/5.8.8/Mouse/Meta/Class.pm line 63
Mouse::Meta::Class::superclasses('Mouse::Meta::Class=HASH(0x186470b0)', 'Ark::Command::Plugin') called at /usr/lib/perl5/site_perl/5.8.8/Mouse.pm line 20
Mouse::extends('Ark::Command::Plugin') called at /usr/lib/perl5/site_perl/5.8.8/Ark/Command/Newapp.pm line 4
require Ark/Command/Newapp.pm called at (eval 8) line 2
Ark::Command::BEGIN() called at /usr/lib/perl5/site_perl/5.8.8/Ark/Command/Plugin.pm line 0
eval {...} called at /usr/lib/perl5/site_perl/5.8.8/Ark/Command/Plugin.pm line 0
eval 'use Ark::Command::Newapp
;' called at /usr/lib/perl5/site_perl/5.8.8/Ark/Command.pm line 34
Ark::Command::run('Ark::Command=HASH(0x18378ce0)') called at /usr/bin/ark.pl line 9
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Mouse.pm line 191.
at /usr/lib/perl5/site_perl/5.8.8/Mouse.pm line 192
Mouse::load_class('Ark::Command::Plugin') called at /usr/lib/perl5/site_perl/5.8.8/Mouse/Meta/Class.pm line 63
Mouse::Meta::Class::superclasses('Mouse::Meta::Class=HASH(0x186470b0)', 'Ark::Command::Plugin') called at /usr/lib/perl5/site_perl/5.8.8/Mouse.pm line 20
Mouse::extends('Ark::Command::Plugin') called at /usr/lib/perl5/site_perl/5.8.8/Ark/Command/Newapp.pm line 4
require Ark/Command/Newapp.pm called at (eval 8) line 2
Ark::Command::BEGIN() called at /usr/lib/perl5/site_perl/5.8.8/Ark/Command/Newapp.pm line 0
eval {...} called at /usr/lib/perl5/site_perl/5.8.8/Ark/Command/Newapp.pm line 0
eval 'use Ark::Command::Newapp
;' called at /usr/lib/perl5/site_perl/5.8.8/Ark/Command.pm line 34
Ark::Command::run('Ark::Command=HASH(0x18378ce0)') called at /usr/bin/ark.pl line 9
Compilation failed in require at (eval 8) line 2.
BEGIN failed--compilation aborted at (eval 8) line 2.


Module::Setup::Pluginが入ってない!
ので入れれう

# cpan install Module::Setup::Plugin


で,もう一度実行

$ ark.pl newapp ArkSample
Creating directory ArkSample
Creating ArkSample/Makefile.PL
Creating ArkSample/t/00_compile.t
Creating ArkSample/lib/ArkSample.pm
Creating ArkSample/lib/ArkSample/Controller/Root.pm
Creating directory ArkSample/root
Creating directory ArkSample/tmp


できたできた.
次はサーバ起動

$ ark.pl server
Can't locate HTTP/Engine/Middleware.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/site_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.7/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.6/x86_64-linux-thread-multi /usr/lib64/perl5/vendor_perl/5.8.5/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/lib/perl5/site_perl/5.8.8/Ark/Command/Server.pm line 10.
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Ark/Command/Server.pm line 10.
Compilation failed in require at (eval 8) line 2.
BEGIN failed--compilation aborted at (eval 8) line 2.


あれ,もしかして依存関係全部ダメだったんじゃ
とか思いつつ入れなおし

# cpan install HTTP::Engine::Middleware


起動しなおし

$ ark.pl server -p 8080
HTTP::Engine::Interface::ServerSimple : You can connect to your server at http://0.0.0.0:8080/


できたできた

  • aでaddressの指定も出来るみたい.

$ ark.pl server -p 8080 -a 192.168.100.2
HTTP::Engine::Interface::ServerSimple : You can connect to your server at http://192.168.100.2:8080/