pgsi+starmanで簡易サーバ

概要

PlackとStarmanをcpanmでインストールして簡易サーバを用意


手順

パッケージをインストール

[root@localhost ~]# cpanm Plack
なんかいろいろでます…
[root@localhost ~]# cpanm Starman
なんかいろいろでます…
 

サンプルソースを作成

[root@localhost ~]# cd
[root@localhost ~]# pwd
/root
[root@localhost ~]# vim app.psgi
 

app.psgi
use strict;
use warnings;
 
sub app {
    my $env = shift;
 
    return [
      200,
      [ "Content-Type" => "text/plain"],
      [ "HelloWorld" ]
    ];
}
\&app;
 

起動してアクセス

[root@localhost ~]# starman app.psgi
2013/10/05-11:28:35 Starman::Server (type Net::Server::PreFork) starting! pid(11883)
Resolved [*]:5000 to [0.0.0.0]:5000, IPv4
Binding to TCP port 5000 on host 0.0.0.0 with IPv4
Setting gid to "0 0 0"
 

結果



最終更新:2013年10月05日 11:38