CPANのインストールからモジュールのインストールするまでの簡単な流れ

cpanでforce installしちゃって色々問題が起きた時の対処法 - 腹八分な記録も参考にしていただけると幸いです。

色々と遊んでいたらごちゃごちゃになってしまったので、vpsを初期化しました。
やはり何をやったかは記録は残しておかないとなぁ〜と痛感。
そうすれば後戻りしやすいですしね。
まぁでもある程度サーバーを一度初期化することはよくあることではありますね。
ありますよね?
今日はCPANを入れました。

CPANとは

CPAN(シーパン、Comprehensive Perl Archive Network)とは、Perlのライブラリ・モジュールやその他のPerlで書かれたソフトウェアを集めた巨大なアーカイブで、世界中のサーバにその内容がミラーリングされている。再利用性・汎用性の高いモジュールが登録されており、Perlプログラマができるだけ車輪の再発明をせずに済むための支援環境となっている。登録モジュールの検索システムも提供されているため、Perlプログラマは望む機能を持ったモジュールを容易に入手することができる。

http://ja.wikipedia.org/wiki/CPAN

CPANのインストール

# yum install perl-CPAN.x86_64

CPANの設定

初期設定

ほとんどオートマで出来ます。

# cpan

CPAN is the world-wide archive of perl resources. It consists of about
300 sites that all replicate the same contents around the globe. Many
countries have at least one CPAN site already. The resources found on
CPAN are easily accessible with the CPAN.pm module. If you want to use
CPAN.pm, lots of things have to be configured. Fortunately, most of
them can be determined automatically. If you prefer the automatic
configuration, answer 'yes' below.

If you prefer to enter a dialog instead, you can answer 'no' to this
question and I'll let you configure in small steps one thing after the
other. (Note: you can revisit this dialog anytime later by typing 'o
        conf init' at the cpan prompt.)
Would you like me to configure as much as possible automatically? [yes] yes
追加でやった設定

まずサーバURLの追加。
CPANを提供しているサーバのリストは見ていただけると良いかと思います。
日本のCPANミラーサイト - サンプルコードによるPerl入門

まぁ僕は母校をとりあえず入れます笑

# cpan
> o conf urllist push ftp://ftp.jaist.ac.jp/pub/CPAN/
> o conf urllist push http://ftp.riken.jp/lang/CPAN/
> o conf urllist 
urllist           
0 [ftp://ftp.jaist.ac.jp/pub/CPAN/]
1 [http://ftp.riken.jp/lang/CPAN/]
Type 'o conf' to view all configuration items
> o conf commit

やり方は
nlog(n): CPAN の URL リスト変更
を参考にしました。

モジュールのインストール中は

Shall I follow them and prepend them to the queue
of modules we are processing right now?[yes]

というようなダイアログが出ることがあります。
依存モジュール入れるよね?
ってことらしいです。(CPANメモ/楽)
デフォルトでyesと答えるようにしておきます。

> o conf prerequisites_policy follow
> o conf commit

モジュールのインストール

何より先にYAML

> install YAML

次にちょっとお遊びで使いたかったXML::Feedをインストール

> install XML::Feed

一部の依存モジュールのテストに失敗したので、forceでインストール(追記:これ、やらないほうがいいです。)

> force install XML::Feed

初めてのモジュールインストールだったので依存モジュールのインストールがたくさんあり、
結構時間がかかりました。こういうとき予めscreen立ち上げとくとsshのセッションが切れても安心なのですけど忘れていた(;;)

もうちょい楽にできないかなぁ。道具に使われている感じがします。
以下他に参考になったサイトです。
CPAN Error: make test had returned bad status, won’t install without force - Techie Corner
perl - How do I tell cpan to install all dependencies? - Stack Overflow