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?

More than 3 years have passed since last update.

perl cpan用 module 作成

Last updated at Posted at 2022-01-10

開発環境

mac
-virtual box
--vagrant
---centos7

事前準備

githubにアカウントを用意しておき鍵認証などでcommitできるようにしておく
https://qiita.com/shizuma/items/2b2f873a0034839e47ce

$ git config --global user.name "Your Name"
$ git config --global user.email you@example.com

install cpanm

perl moduleをインストールするためにcpanmを使います。
perl-App-cpanminusをインストールすることで入ります。

$ sudo yum -y install perl-App-cpanminus

install module-setup

Perlモジュールの雛形づくりに module-setup コマンドは強力な助けになります。 module-setup コマンドは Module::Setup をインストールすると付いてきます。

$ sudo yum install gcc
$ sudo cpanm Module::Setup --force

Module::Setup がインストールできたら、module-setup コマンドを初期化しておきます。 何も難しいことはなく、--init オプションをつけてコマンドを叩いたら、良しなに質問に答えていくだけです。

$ module-setup --init
Do you use SVN? [yN] [n] n
Do you use SVK? [yN] [n] n
Do you use Git? [yN] [n] y
You chose version control system: Git
Your name:  [Default Name] kawamurashingo
Your email:  [default {at} example.com] xxxxxxx@gmail.com
Dump config /home/vagrant/.module-setup/flavors/default/config.yaml

先にMyModuleでgitリポジトリを作っておく
https://github.com/new

$ module-setup MyModule
$ cd MyModule
$ git remote add origin git@github.com:kawamurashingo/MyModule.git
$ git push origin master

https://github.com/kawamurashingo/MyModule
無事雛形準備完了

test install

とりあえずなにも変更しなくてもインストール可能

$ perl Makefile.PL
$ make
$ make test
$ sudo make install
Installing /usr/local/share/perl5/MyModule.pm
Installing /usr/local/share/man/man3/MyModule.3pm
Appending installation info to /usr/lib64/perl5/perllocal.pod

$ perldoc -m MyModule

オリジナルモジュール作成してみる

参考
https://shin.hateblo.jp/entry/2013/09/24/020506

$ export PATH=$PATH:/home/vagrant/MyModule/lib/
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?