HRForecastのセットアップ

本ドキュメントは、HRForecastのセットアップ手順書です。

ソースコード:
https://github.com/kazeburo/HRForecast

## 環境
### OS

実行

```shell-session
$ cat /etc/redhat-release 
```

実行結果

```
CentOS release 6.2 (Final)
```

#### Perl

実行

````shell-session
$ perl -v
```

実行結果

```shell-session
This is perl, v5.10.1 (*) built for x86_64-linux-thread-multi

Copyright 1987-2009, Larry Wall

Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.

Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl".  If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
```

## セットアップ

### Install cpanm

+ ソースコードダウンロード

```shell-session
$ git clone git://github.com/miyagawa/cpanminus.git
$ cd cpanminus
```

+ Make

```shell-session
$ perl Makefile.PL
```

実行結果

```shell-session
Generating bin/cpanm from cpanm
Writing Makefile for App::cpanminus
Writing MYMETA.yml and MYMETA.json
```

+ Install

```shell-session
$ sudo make install
```

実行結果

```shell-session
Generating bin
cp lib/App/cpanminus/ParsePM.pm blib/lib/App/cpanminus/ParsePM.pm
cp lib/App/cpanminus/CPANVersion.pm blib/lib/App/cpanminus/CPANVersion.pm
cp lib/App/cpanminus/Dependency.pm blib/lib/App/cpanminus/Dependency.pm
cp lib/App/cpanminus/script.pm blib/lib/App/cpanminus/script.pm
cp lib/App/cpanminus.pm blib/lib/App/cpanminus.pm
cp bin/cpanm blib/script/cpanm
/usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/cpanm
Manifying blib/man1/cpanm.1
Manifying blib/man3/App::cpanminus.3pm
Installing /usr/local/share/perl5/App/cpanminus.pm
Installing /usr/local/share/perl5/App/cpanminus/ParsePM.pm
Installing /usr/local/share/perl5/App/cpanminus/Dependency.pm
Installing /usr/local/share/perl5/App/cpanminus/CPANVersion.pm
Installing /usr/local/share/perl5/App/cpanminus/script.pm
Installing /usr/local/share/man/man1/cpanm.1
Installing /usr/local/share/man/man3/App::cpanminus.3pm
Installing /usr/local/bin/cpanm
Appending installation info to /usr/lib64/perl5/perllocal.pod
```

### Install HRForecast

+ ソースコードダウンロード

```shell-session
$ git clone https://github.com/kazeburo/HRForecast
$ cd HRForecast
```

+ インストール

```shell-session
$ sudo /usr/local/bin/cpanm --installdeps .
```

実行結果

```shell-session
--> Working on .
Configuring HRForecast-0.01 ... OK
==> Found dependencies: Time::Piece::MySQL, DBD::mysql, Plack::Middleware::Header, Kossy
--> Working on Time::Piece::MySQL
Fetching http://www.cpan.org/authors/id/K/KA/KASEI/Time-Piece-MySQL-0.06.tar.gz ... OK
Configuring Time-Piece-MySQL-0.06 ... OK
Building and testing Time-Piece-MySQL-0.06 ... OK
Successfully installed Time-Piece-MySQL-0.06
--> Working on DBD::mysql
Fetching http://www.cpan.org/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.024.tar.gz ... OK
Configuring DBD-mysql-4.024 ... OK
Building and testing DBD-mysql-4.024 ... OK
Successfully installed DBD-mysql-4.024 (upgraded from 4.013)
--> Working on Plack::Middleware::Header
Fetching http://www.cpan.org/authors/id/C/CH/CHIBA/Plack-Middleware-Header-0.04.tar.gz ... OK
Configuring Plack-Middleware-Header-0.04 ... OK
Building and testing Plack-Middleware-Header-0.04 ... OK
Successfully installed Plack-Middleware-Header-0.04
--> Working on Kossy
Fetching http://www.cpan.org/authors/id/K/KA/KAZEBURO/Kossy-0.22.tar.gz ... OK
Configuring Kossy-0.22 ... OK
==> Found dependencies: HTML::FillInForm::Lite, Kossy::Validator, Text::Xslate, Router::Boom
--> Working on HTML::FillInForm::Lite
Fetching http://www.cpan.org/authors/id/G/GF/GFUJI/HTML-FillInForm-Lite-1.13.tar.gz ... OK
Configuring HTML-FillInForm-Lite-1.13 ... OK
Building and testing HTML-FillInForm-Lite-1.13 ... OK
Successfully installed HTML-FillInForm-Lite-1.13 (upgraded from 1.10)
--> Working on Kossy::Validator
Fetching http://www.cpan.org/authors/id/K/KA/KAZEBURO/Kossy-Validator-0.01.tar.gz ... OK
Configuring Kossy-Validator-0.01 ... OK
Building and testing Kossy-Validator-0.01 ... OK
Successfully installed Kossy-Validator-0.01
--> Working on Text::Xslate
Fetching http://www.cpan.org/authors/id/G/GF/GFUJI/Text-Xslate-3.0.0.tar.gz ... OK
Configuring Text-Xslate-3.0.0 ... OK
Building and testing Text-Xslate-3.0.0 ... OK
Successfully installed Text-Xslate-3.0.0 (upgraded from 1.5025)
--> Working on Router::Boom
Fetching http://www.cpan.org/authors/id/T/TO/TOKUHIROM/Router-Boom-0.07.tar.gz ... OK
Configuring Router-Boom-0.07 ... OK
Building and testing Router-Boom-0.07 ... OK
Successfully installed Router-Boom-0.07
Building and testing Kossy-0.22 ... OK
Successfully installed Kossy-0.22 (upgraded from 0.12)
<== Installed dependencies for .. Finishing.
8 distributions installed
```

### サーバー設定
環境に合わせて設定する。
https://github.com/kazeburo/HRForecast/blob/master/config.pl

```shell-session
$ vi ./config.pl
```

### データベース設定

データベースの作成

```shell-session
$ mysql -uroot
mysql> CREATE DATABASE hrforecast;
```

テーブルの作成

```shell-session
$ mysql -uroot hrforecast < ./schema.sql 
```

### 起動

```shellscript
$ perl hrforecast.pl --config ./config.pl
```

起動しても出力なし


## 閲覧

### ブラウザ
http://127.0.0.1:5127/