MacPorts を利用して WWW::Mechanize をインストールする

面倒くさいので、MacPortsPerl をインストールしてしまい、WWW::Mechanize もインストールする。

% sudo port install perl5.8
% ls -l /opt/local/bin/perl                               
-rwxr-xr-x  2 root  admin  1186584  1 11 18:21 /opt/local/bin/perl
% ls -l /opt/local/bin/cpan
-rwxr-xr-x  2 root  admin  11851  1 11 18:21 /opt/local/bin/cpan
% sudo port install p5-www-mechanize

注意

WWW::Mechanize を port でインストールする前に、手動で他の CPAN モジュールをインストールした。それが原因なのかわからないが、port 側で解決できない依存性の問題が発生してしまった。
原因を調査してみたが、有効な解決方法が見つからなかったため(最終的には port でインストールした perl 5.8 をアンインストールできなくなった)、MacPorts を再インストールして、WWW::Mechanize をインストールすることになった。
まずは、

% sudo mv /opt /opt.bak

を行い、既存の MacPortsディレクトリを別名にして、MacPorts の再インストールを行った。

MacPorts を新規にインストールしても WWW::Mechanize をインストールできなかった

そして、再度 Perl 5.8 と WWW::Mechanize を port でインストールを試みたら、同様のエラーが発生した。

--->  Attempting to fetch ExtUtils-ParseXS-2.19.tar.gz from ftp://ftp.cpan.org/pub/CPAN/modules/by-module/ExtUtils
--->  Verifying checksum(s) for p5-extutils-parsexs
--->  Extracting p5-extutils-parsexs
--->  Configuring p5-extutils-parsexs
--->  Building p5-extutils-parsexs
--->  Staging p5-extutils-parsexs into destroot
--->  Installing p5-extutils-parsexs @2.19_0
--->  Activating p5-extutils-parsexs @2.19_0
Error: Target org.macports.activate returned: Image error: /opt/local/share/man/man3/ExtUtils::ParseXS.3pm.gz is being used by the active perl5.8 port.  Please deactivate this port first, or use the -f flag to force the activation.
Error: The following dependencies failed to build: p5-test-warn p5-array-compare p5-module-build p5-extutils-parsexs p5-module-signature gnupg bzip2 gettext expat libiconv gperf ncurses ncursesw readline zlib p5-digest-sha p5-version p5-yaml p5-sub-uplevel p5-test-exception p5-test-simple p5-tree-dag_node
Error: Status 1 encountered during processing.

頭にきたので

Perl 5.8 をインストールする前に、最初から WWW::Mechanize を port でインストールする。

% sudo port -d selfupdate
% sudo port -d sync
% sudo port deps p5-www-mechanize
p5-www-mechanize has library dependencies on:
	perl5
	p5-libwww-perl
	p5-html-parser
	p5-http-response-encoding
	p5-http-server-simple
	p5-test-warn
	p5-uri
% sudo port install p5-www-mechanize

しかし、結果は変わらなかった。
原因を調べてみたら、p5-test-warn が原因のようである。

% sudo port install p5-test-warn         
--->  Activating p5-extutils-parsexs @2.19_0
Error: Target org.macports.activate returned: Image error: /opt/local/share/man/man3/ExtUtils::ParseXS.3pm.gz is being used by the active perl5.8 port.  Please deactivate this port first, or use the -f flag to force the activation.
Error: The following dependencies failed to build: p5-array-compare p5-module-build p5-extutils-parsexs p5-module-signature gnupg bzip2 gettext expat libiconv gperf ncurses ncursesw readline zlib p5-digest-sha p5-version p5-yaml p5-sub-uplevel p5-test-exception p5-test-simple p5-tree-dag_node
Error: Status 1 encountered during processing.

しばらく様子を見て、修正されるのを待つしかないか。