CatalystのテストサーバをLighttpdで立ててくれるヘルパースクリプト。
Catalyst::Helper::Lighty にリスタート機能つけた – masaki@catalyst – Catalystグループ
http://catalyst.g.hatena.ne.jp/ikasam_a/20080318/1205778147
ヘルパーがあるおかげで操作は簡単。
// 事前にLighttpdとFastCGIをインストールしておく必要がある
// アプリを作成
$ catalyst.pl MyApp
// ヘルパーを実行
$ cd MyApp/script
$ ./myapp_create.pl Lighty
// テストサーバを起動......アレ?
$ ./myapp_lighty.pl
Type of arg 1 to Parallel::SubFork::sub_fork must be block or sub {} (not null operation) at ./myapp_lighty.pl line 75, near "&spawn_fastcgi )"
Execution of ./myapp_lighty.pl aborted due to compilation errors.
と言うわけでちょっとバグがある。ヘルパーモジュールLighty.pmを次のように編集する。
$ diff Lighty.pm.old Lighty.pm
139c139
< my $task = sub_fork( $opt{restart} ? \&restarter : \&spawn_fastcgi );
---
> my $task = $opt{restart} ? sub_fork( \&restarter ) : sub_fork( \&spawn_fastcgi );
これで完成。もう一度実行してみる。
// 元のやつを削除して $ rm myapp_lighty.pl // ヘルパーを実行 $ ./myapp_create.pl Lighty // テストサーバを起動! $ ./myapp_lighty.pl [debug] Debug messages enabled [debug] Statistics enabled [debug] Loaded plugins: .----------------------------------------------------------------------------. | Catalyst::Plugin::ConfigLoader 0.27 | '----------------------------------------------------------------------------' 〜中略〜 [info] MyApp powered by Catalyst 5.80007 FastCGI: manager (pid 50333): initialized FastCGI: manager (pid 50333): server (pid 50335) started FastCGI: server (pid 50335): initialized
やっとうまくいった。
