amon2-setup.pl
でプロジェクト作成
carton install
する
heroku create --buildpack http://github.com/sugyan/heroku-buildpack-perl.git
git push
- template 編集 login
Amon2::Auth::Site::Github
cpanfile
に依存追記、carton install
- plugin 追加
- github app 作成
- config 設定
- form 作成
- DBI
$c->dbh->do(
'INSERT INTO entry (user_name, body, created_on) VALUES (?, ?, ?)',
undef,
$c->session->get('name'), $body, time(),
);
my $entries = $c->dbh->selectall_arrayref(
'SELECT * FROM entry ORDER BY created_on DESC',
{ Slice => {} },
);
TZ=Asia/Tokyo
DBD::Pg
追加
pg.sql
用意
heroku addons:add heroku-postgres
id SERIAL
use URI::Split qw(uri_split);
my ($scheme, $auth, $path, $query, $frag) = uri_split($ENV{HEROKU_POSTGRESQL_BLUE_URL});
my ($userpass, $hostport) = split '@', $auth;
my ($user, $pass) = split ':', $userpass;
my ($host, $port) = split ':', $hostport;
my $dbname = substr $path, 1;
WebService::YahooJapan::WebMA
app_id => '********************************************************************************',
$WebService::YahooJapan::WebMA::APIBase = 'http://jlp.yahooapis.jp/MAService/V1/parse';
my $api = WebService::YahooJapan::WebMA->new(
appid => $c->config->{Yahoo}{app_id},
);
my $result = $api->parse(sentence => $body) or die;
my $str = '';
for my $word (@{ $result->{ma_result}{word_list} }) {
if ($word->{pos} eq '動詞') {
$str .= '全裸で'
}
$str .= $word->{surface};
}