Amon2、plack挑戦 →ダメでした

    • まずはインストール…いきなりエラー発生
$ cpanm Amon2 Amon2::DBI
Fetching http://search.cpan.org/CPAN/authors/id/M/MA/MARKSTOS/SQL-Interp-1.20.tar.gz ... OK
Configuring SQL-Interp-1.20 ... OK
Building and testing SQL-Interp-1.20 ... FAIL
! Installing SQL::Interp failed. See /home/ymko/.cpanm/build.log for details.
! Bailing out the installation for Amon2-DBI-0.08. Retry with --prompt or --force.
    • ログ見てもわからんので手動ビルドテスト
$ wget http://search.cpan.org/CPAN/authors/id/M/MA/MARKSTOS/SQL-Interp-1.20.tar.gz
$ tar xzvf SQL-Interp-1.20.tar.gz
$ cd SQL-Interp-1.20
$ perl Makefile.pl && make && make test
Test Summary Report
-------------------
t/dist.t       (Wstat: 256 Tests: 1 Failed: 1)
  Failed test:  1
  Non-zero exit status: 1
Files=5, Tests=159,  1 wallclock secs ( 0.09 usr  0.02 sys +  0.28 cusr  0.05 csys =  0.44 CPU)
Result: FAIL
Failed 1/5 test programs. 1/159 subtests failed.
make: *** [test_dynamic] エラー 255
$ cat SQL-Interp-1.20/t/dist.t
my @modules = (
    'SQL::Interp',
    'DBIx::Interp'
);

my %version_exist;
for my $module (@modules) {
    eval "require $module";
    my $version = $module->VERSION;
    $version_exist{$version} = 1;
    warn "$module = $version"; # 追加
                               # SQL::Interp = 1.20 at t/dist.t line 17.
                               # DBIx::Interp = 1.11 at t/dist.t line 17.
}
ok(keys %version_exist == 1, 'module versions match'); # ここでエラー
    • SQL::Interpの旧バージョン入れる→これでok
$ cpanm http://search.cpan.org/CPAN/authors/id/M/MA/MARKSTOS/SQL-Interp-1.10.tar.gz
$ Amon2 Amon2::DBI
    • 今度こそ... モジュールが無い.. Amon2::Lite が必要らしい
$ amon2-setup.pl --flavor=Lite TinyURL
Cannot load Amon2::Setup::Flavor::Lite: Can't locate Amon2/Setup/Flavor/Lite.pm in @INC
$ cpanm Amon2::Lite
    • 三度目の正直!うまくいった!
$ amon2-setup.pl --flavor=Lite TinyURL
-- Running flavor: Lite --
[Flavor::Lite] writing app.psgi
[Flavor::Lite] writing Makefile.PL
[Flavor::Lite] writing t/Util.pm
[Flavor::Lite] writing t/01_root.t
[Flavor::Lite] writing xt/03_pod.t
[Flavor::Lite] writing .gitignore
There is no git command.
$ cd TinyURL/
$ plackup app.psgi
    • DB作成
$ mkdir sql
$ cat > sql/sqlite3.sql
create table tinyurl (
    key varchar(20) primary key,
    url text
);
$ sqlite3 development.db < sql/sqlite3.sql
    • とここまでやってソース写経。/createに対してpostしても応答が無い・・・
    • typoかなととりあえず丸コピペしても変わらず。。
    • 断念。
    • 他になんか良さげなサンプルは無いものか。。
    • あとplackupの引数仕様がなんか変。順番違うとダメとか。。
$  plackup -R --port 8080 app.psgi
Error while loading 8080.pm: そのようなファイルやディレクトリはありません at (eval 14) line 4.
Watching --port ./lib 8080 for file updates.
$  plackup --port 8080 -R app.psgi
Watching app.psgi ./lib app.psgi for file updates.
HTTP::Server::PSGI: Accepting connections at http://0:8080/
    • エラーしたところがhtmlで出力されるのは良い
    • ただしエラーの原因がソース以外だと解決するのに経験が無いと無理そう。。