0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【学習】PerlとAmon2で環境構築(恐る恐る)vol1

Posted at

はじめに

つい先日、PerlのAmon2フレームワークを使用して開発をしてみました。参考記事と一緒に私が実践したことをお伝えできればと思います。

参考記事

開発環境

  • 言語: Perl
  • フレームワーク: Amon2
  • PCとか:Windows。VSCode

セットアップ手順

  1. ディレクトリ作成(ディレクトリ名は例)して移動

    $ mkdir -p ~/Projects/<ディレクトリ名>
    $ cd ~/Projects/<ディレクトリ名>
    

  2. Perlインストール

    ・Perlがインストールされているか確認
    $ perl -v
    
    ・なければインストール
    Ubuntu:$ sudo apt-get install perl
    Mac:$ brew install perl
    
    ・「cpanm」のインストール確認
    $ cpanm -v
    
    ・Perlのパッケージ管理ツールである「cpanm」をインストール。
    ・Amon2 やその他の必要なライブラリを簡単にインストールできるようにする
    $ curl -L https://cpanmin.us | perl - --sudo App::cpanminus
    
    

    👇こちらはスキップしても大丈夫です。

    ・「Task::Amon2」のインストール(Amon2 をインストール)
    ・(Amon2 を使うための「推奨パッケージセット」) 
    $ cpanm Task::Amon2
    
    ・Amon2 をプロジェクトに取り込む
    ・ここで<ディレクトリ>の下の階層?に<プロジェクト>が作成される
    $ amon2-setup.pl <取り込みたいプロジェクト名>
    
    ※私は上記すっきぷしてもいいコマンドを実行しました。
    ※実行後下記のようなメッセージがターミナルに表示されます
    ※「carton install」してね。というコマンド
    ※その次のコマンドはサーバーを起動するためのコマンドです
    --------------------------------------------------------------
    
    Setup script was done! You are ready to run the skelton.
    
    You need to install the dependencies by:
    
    > carton install
    
    And then, run your application server:
    
    > carton exec perl -Ilib script/<プロジェクト名>-server
    
    -------------------------------------------------------------- 
    

  3. Cartonをインストール
    ・Amon2などの依存関係を解決するためのコマンド。待ち時間が長い💦

    $ cpanm Carton
    

  4. プロジェクト内の依存モジュール(Amon2など)をインストール
    ・「carton」は、既にインストールされているパッケージについて自動的にスキップするので、「スキップしても大丈夫」のコマンドを仮に実行していたとしても問題ありません。
    carton install で依存モジュールをインストール

    $ cd <プロジェクト名>
    $ carton install
    

  5. サーバーを起動・終了する

    • 下記コマンド実行後表示されたURLにアクセスすることで閲覧することが可能です
    ・起動
    $ carton exec perl -Ilib script/<プロジェクト名>-server
    
    ・終了
    ctrl + cキー
    

まとめ

Windowsのひとはすくない(個人的主観)ので今回の私の構築がそのまま当てはまるかといえば若干不安点はあります💦
ごさんこうになればさいわいで

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?