Skip to content

Instantly share code, notes, and snippets.

@sugyan
Last active December 15, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sugyan/5271852 to your computer and use it in GitHub Desktop.
Save sugyan/5271852 to your computer and use it in GitHub Desktop.
  • 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};
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment