にゃむラボ

趣味の工作とか。備忘録とか。独り言とか。

月別: 3月 2011

Jcode.pm インストールメモ

公式サイト:
 http://openlab.ring.gr.jp/Jcode/index-j.html

1.Perlのバージョン確認

[root@localhost ~]# perl -v

This is perl, v5.8.8 built for x86_64-linux-thread-multi

2.CPANシェルを起動
今回初回起動なので、初期設定を行う。

[root@localhost ~]# perl -MCPAN -e shell

/usr/lib/perl5/5.8.8/CPAN/Config.pm initialized.


CPAN is the world-wide archive of perl resources. It consists of about
100 sites that all replicate the same contents all 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, you have to configure it properly.

If you do not want to enter a dialog now, you can answer 'no' to this
question and I'll try to autoconfigure. (Note: you can revisit this
dialog anytime later by typing 'o conf init' at the cpan prompt.)

Are you ready for manual configuration? [yes]


The following questions are intended to help you with the
configuration. The CPAN module needs a directory of its own to cache
important index files and maybe keep a temporary mirror of CPAN files.
This may be a site-wide directory or a personal directory.



First of all, I'd like to create this directory. Where?

CPAN build and cache directory? [/root/.cpan]


If you want, I can keep the source files after a build in the cpan
home directory. If you choose so then future builds will take the
files from there. If you don't want to keep them, answer 0 to the
next question.



How big should the disk cache be for keeping the build directories
with all the intermediate files?

Cache size for build directory (in MB)? [10]


By default, each time the CPAN module is started, cache scanning
is performed to keep the cache size in sync. To prevent from this,
disable the cache scanning with 'never'.

Perform cache scanning (atstart or never)? [atstart]


To considerably speed up the initial CPAN shell startup, it is
possible to use Storable to create a cache of metadata. If Storable
is not available, the normal index mechanism will be used.

Cache metadata (yes/no)? [yes]


The next option deals with the charset your terminal supports. In
general CPAN is English speaking territory, thus the charset does not
matter much, but some of the aliens out there who upload their
software to CPAN bear names that are outside the ASCII range. If your
terminal supports UTF-8, you say no to the next question, if it
supports ISO-8859-1 (also known as LATIN1) then you say yes, and if it
supports neither nor, your answer does not matter, you will not be
able to read the names of some authors anyway. If you answer no, names
will be output in UTF-8.

Your terminal expects ISO-8859-1 (yes/no)? [yes]


If you have one of the readline packages (Term::ReadLine::Perl,
Term::ReadLine::Gnu, possibly others) installed, the interactive CPAN
shell will have history support. The next two questions deal with the
filename of the history file and with its size. If you do not want to
set this variable, please hit SPACE RETURN to the following question.

File to save your history? [/root/.cpan/histfile]
Number of lines to save? [100]


The CPAN module can detect when a module that which you are trying to
build depends on prerequisites. If this happens, it can build the
prerequisites for you automatically ('follow'), ask you for
confirmation ('ask'), or just ignore them ('ignore'). Please set your
policy to one of the three values.

Policy on building prerequisites (follow, ask or ignore)? [ask]


The CPAN module will need a few external programs to work properly.
Please correct me, if I guess the wrong path for a program. Don't
panic if you do not have some of them, just press ENTER for those. To
disable the use of a download program, you can type a space followed
by ENTER.

Where is your gzip program? [/bin/gzip]
Where is your tar program? [/bin/tar]
Where is your unzip program? [/usr/bin/unzip]
Where is your make program? [/usr/bin/make]
Warning: links not found in PATH
Where is your links program? []
Where is your wget program? [/usr/bin/wget]
Warning: ncftpget not found in PATH
Where is your ncftpget program? []
Warning: ncftp not found in PATH
Where is your ncftp program? []
Where is your ftp program? [/usr/kerberos/bin/ftp]
Where is your gpg program? [/usr/bin/gpg]
What is your favorite pager program? [/usr/bin/less]
What is your favorite shell? [/bin/bash]


Every Makefile.PL is run by perl in a separate process. Likewise we
run 'make' and 'make install' in processes. If you have any
parameters (e.g. PREFIX, LIB, UNINST or the like) you want to pass
to the calls, please specify them here.

If you don't understand this question, just press ENTER.

Parameters for the 'perl Makefile.PL' command?
Typical frequently used settings:

    PREFIX=~/perl       non-root users (please see manual for more hints)

Your choice:  []
Parameters for the 'make' command?
Typical frequently used setting:

    -j3              dual processor system

Your choice:  []
Parameters for the 'make install' command?
Typical frequently used setting:

    UNINST=1         to always uninstall potentially conflicting files

Your choice:  [] UNINST=1


Sometimes you may wish to leave the processes run by CPAN alone
without caring about them. As sometimes the Makefile.PL contains
question you're expected to answer, you can set a timer that will
kill a 'perl Makefile.PL' process after the specified time in seconds.

If you set this value to 0, these processes will wait forever. This is
the default and recommended setting.

Timeout for inactivity during Makefile.PL? [0]


If you're accessing the net via proxies, you can specify them in the
CPAN configuration or via environment variables. The variable in
the $CPAN::Config takes precedence.

Your ftp_proxy?
Your http_proxy?
Your no_proxy?
You have no /root/.cpan/sources/MIRRORED.BY
  I'm trying to fetch one
LWP not available
CPAN: Net::FTP loaded ok
Fetching with Net::FTP:
  ftp://ftp.perl.org/pub/CPAN/MIRRORED.BY


Now we need to know where your favorite CPAN sites are located. Push
a few sites onto the array (just in case the first on the array won't
work). If you are mirroring CPAN to your local workstation, specify a
file: URL.

First, pick a nearby continent and country (you can pick several of
each, separated by spaces, or none if you just want to keep your
existing selections). Then, you will be presented with a list of URLs
of CPAN mirrors in the countries you selected, along with previously
selected URLs. Select some of those URLs, or just keep the old list.
Finally, you will be prompted for any extra URLs -- file:, ftp:, or
http: -- that host a CPAN mirror.

(1) Africa
(2) Asia
(3) Central America
(4) Europe
(5) North America
(6) Oceania
(7) South America
Select your continent (or several nearby continents) [] 2
Sorry! since you don't have any existing picks, you must make a
geographic selection.

(1) Bangladesh
(2) China
(3) Hong Kong
(4) India
(5) Indonesia
(6) Israel
(7) Japan
(8) Kazakhstan
(9) Pakistan
(10) Philippines
(11) Republic of Korea
(12) Russia
(13) Saudi Arabia
(14) Singapore
(15) Taiwan
(16) Thailand
1 more items, hit SPACE RETURN to show them
Select your country (or several nearby countries) [] 7
Sorry! since you don't have any existing picks, you must make a
geographic selection.

(1) ftp://ftp.dti.ad.jp/pub/lang/CPAN/
(2) ftp://ftp.jaist.ac.jp/pub/CPAN/
(3) ftp://ftp.kddilabs.jp/CPAN/
(4) ftp://ftp.nara.wide.ad.jp/pub/CPAN/
(5) ftp://ftp.riken.jp/lang/CPAN/
(6) ftp://ftp.ring.gr.jp/pub/lang/perl/CPAN/
(7) ftp://ftp.u-aizu.ac.jp/pub/CPAN/
(8) ftp://ftp.yz.yamagata-u.ac.jp/pub/lang/cpan/
Select as many URLs as you like (by number),
put them on one line, separated by blanks, e.g. '1 4 5' [] 4 3 2

Enter another URL or RETURN to quit: []
New set of picks:
  ftp://ftp.nara.wide.ad.jp/pub/CPAN/
  ftp://ftp.kddilabs.jp/CPAN/
  ftp://ftp.jaist.ac.jp/pub/CPAN/


commit: wrote /usr/lib/perl5/5.8.8/CPAN/Config.pm
Terminal does not support AddHistory.

cpan shell -- CPAN exploration and modules installation (v1.7602)
ReadLine support available (try 'install Bundle::CPAN')

cpan>

ミラーサイトの選択については、ここの回線環境に依ると思いますので、
近い箇所サイトを選んでみるといいと思います。
当サーバでは、ホップ数・応答時間を鑑みて、上記3サイトを選択しています。

[root@localhost ~]# traceroute ftp.nara.wide.ad.jp
・・・・
 8  ftp.nara.wide.ad.jp (203.178.137.175)  1.600 ms  1.482 ms  1.534 ms

[root@localhost ~]# traceroute ftp.kddilabs.jp
・・・・
 9  ftp.kddlabs.co.jp (192.26.91.193)  9.000 ms  9.041 ms  8.969 ms

[root@localhost ~]# traceroute ftp.jaist.ac.jp
・・・・
 9  ftp.jaist.ac.jp (150.65.7.130)  13.503 ms  13.188 ms  13.665 ms

3.Jcodeのインストール

cpan> install Jcode
CPAN: Storable loaded ok
LWP not available
Fetching with Net::FTP:
  ftp://ftp.nara.wide.ad.jp/pub/CPAN/authors/01mailrc.txt.gz
Going to read /root/.cpan/sources/authors/01mailrc.txt.gz
LWP not available
Fetching with Net::FTP:
  ftp://ftp.nara.wide.ad.jp/pub/CPAN/modules/02packages.details.txt.gz
Going to read /root/.cpan/sources/modules/02packages.details.txt.gz
  Database was generated on Sun, 20 Mar 2011 22:27:32 GMT
  HTTP::Date not available

  There's a new CPAN.pm version (v1.9600) available!
  [Current version is v1.7602]
  You might want to try
    install Bundle::CPAN
    reload cpan
  without quitting the current session. It should be a seamless upgrade
  while we are running...

LWP not available
Fetching with Net::FTP:
  ftp://ftp.nara.wide.ad.jp/pub/CPAN/modules/03modlist.data.gz
Going to read /root/.cpan/sources/modules/03modlist.data.gz
Going to write /root/.cpan/Metadata
Running install for module Jcode
Running make for D/DA/DANKOGAI/Jcode-2.07.tar.gz
LWP not available
Fetching with Net::FTP:
  ftp://ftp.nara.wide.ad.jp/pub/CPAN/authors/id/D/DA/DANKOGAI/Jcode-2.07.tar.gz
CPAN: Digest::MD5 loaded ok
LWP not available
Fetching with Net::FTP:
  ftp://ftp.nara.wide.ad.jp/pub/CPAN/authors/id/D/DA/DANKOGAI/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/D/DA/DANKOGAI/Jcode-2.07.tar.gz ok
Scanning cache /root/.cpan/build for sizes
Jcode-2.07/
Jcode-2.07/Changes
Jcode-2.07/Changes.ver0X
Jcode-2.07/Jcode/
Jcode-2.07/Jcode/_Classic.pm
Jcode-2.07/Jcode/Constants.pm
Jcode-2.07/Jcode/H2Z.pm
Jcode-2.07/Jcode/Nihongo.pod
Jcode-2.07/Jcode/Tr.pm
Jcode-2.07/Jcode/Unicode/
Jcode-2.07/Jcode/Unicode/Constants.pm
Jcode-2.07/Jcode/Unicode/NoXS.pm
Jcode-2.07/Jcode.pm
Jcode-2.07/Makefile.PL
Jcode-2.07/MANIFEST
Jcode-2.07/META.yml
Jcode-2.07/README
Jcode-2.07/t/
Jcode-2.07/t/_test_unicode.pl
Jcode-2.07/t/ambiguous.pl
Jcode-2.07/t/append.t
Jcode-2.07/t/benchmark.pl
Jcode-2.07/t/convert.t
Jcode-2.07/t/fun.pl
Jcode-2.07/t/getcode.t
Jcode-2.07/t/h2z.t
Jcode-2.07/t/hankaku.euc
Jcode-2.07/t/hiragana.euc
Jcode-2.07/t/jfold.t
Jcode-2.07/t/length.t
Jcode-2.07/t/mime.t
Jcode-2.07/t/new.t
Jcode-2.07/t/perl581.t
Jcode-2.07/t/regex.t
Jcode-2.07/t/stripped.euc
Jcode-2.07/t/table.euc
Jcode-2.07/t/table.jis
Jcode-2.07/t/table.sjis
Jcode-2.07/t/table.ucs2
Jcode-2.07/t/table.utf8
Jcode-2.07/t/tr.t
Jcode-2.07/t/unibench.pl
Jcode-2.07/t/x0212.euc
Jcode-2.07/t/x0212.jis
Jcode-2.07/t/x0212.ucs2
Jcode-2.07/t/x0212.utf8
Jcode-2.07/t/zenkaku.euc
Jcode-2.07/Unicode/
Jcode-2.07/Unicode/euc2uni.h
Jcode-2.07/Unicode/Makefile.PL
Jcode-2.07/Unicode/uni.c
Jcode-2.07/Unicode/uni2euc.h
Jcode-2.07/Unicode/Unicode.pm
Jcode-2.07/Unicode/Unicode.xs

  CPAN.pm: Going to build D/DA/DANKOGAI/Jcode-2.07.tar.gz

Checking if your kit is complete...
Looks good
Writing Makefile for Jcode
cp Jcode/Nihongo.pod blib/lib/Jcode/Nihongo.pod
cp Jcode.pm blib/lib/Jcode.pm
Manifying blib/man3/Jcode::Nihongo.3pm
Jcode/Nihongo.pod:1: Unknown command paragraph "=encoding euc-jp"
Manifying blib/man3/Jcode.3pm
  /usr/bin/make  -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/append.....ok
t/convert....ok
t/getcode....ok
t/h2z........ok
t/jfold......ok
t/length.....ok
t/mime.......ok
t/new........ok
t/perl581....ok
t/regex......ok
t/tr.........ok
All tests successful.
Files=11, Tests=244,  2 wallclock secs ( 1.07 cusr +  0.11 csys =  1.18 CPU)
  /usr/bin/make test -- OK
Running make install
Jcode/Nihongo.pod:1: Unknown command paragraph "=encoding euc-jp"
Manifying blib/man3/Jcode::Nihongo.3pm
Manifying blib/man3/Jcode.3pm
Installing /usr/lib/perl5/site_perl/5.8.8/Jcode.pm
Installing /usr/lib/perl5/site_perl/5.8.8/Jcode/Nihongo.pod
Installing /usr/share/man/man3/Jcode::Nihongo.3pm
Installing /usr/share/man/man3/Jcode.3pm
Writing /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/Jcode/.packlist
Appending installation info to /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
  /usr/bin/make install UNINST=1 -- OK

cpan>

4.おまけ
CPANの環境設定をやり直したい場合は以下のファイルを削除すればいいです。

Config.pmの場所を確認

cpan> o conf
CPAN::Config options from /usr/lib/perl5/5.8.8/CPAN/Config.pm:

ファイルを削除

[root@localhost ~]# rm -f /usr/lib/perl5/5.8.8/CPAN/Config.pm
[root@localhost ~]# rm -Rf /root/.cpan/

Google Public DNS

最近、GoogleのDNSが早いと聞くので
早速うちのPCも参照先に設定してみました。

公式サイト
 http://code.google.com/intl/ja/speed/public-dns/

8.8.8.8 と 8.8.4.4 が公開されているようです。

世界規模でキャッシュするようですので、
よくアクセスされるサイトは名前引きが早くなるのかも?
アクセスログ解析の際の名前引きが早くなるかも?

設定は以下の通り。

1. /etc/resolv.conf を編集

# vi /etc/resolv.conf

2. nameserverを記述する。

nameserver 8.8.8.8
nameserver 8.8.4.4

Powered by WordPress & テーマの著者 Anders Norén