・ Web系SE募集 (技術開発部開発系エンジニア・Java/Tomcat 420万円~750万円)
   ・ 社内SE募集 (業務系システムの開発・社内イントラ)

shellの最近のブログ記事

root権限ではなく、ユーザー権限で、make test したい場合があります。
その時は、CPANシェルをユーザー権限で実行します。
そのための設定です。

mod_perlをインストールする時は、root権限での make test がうまくいきません。そういう時はユーザー権限でインストールします。

初めてcpanシェルを起動した時のセットアップ。

$ sudo su -
Password:
[root@localhost ~]# 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]

(省略)

Autoconfigured everything but 'urllist'.
Please call 'o conf init urllist' to configure your CPAN server(s) now!

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

cpan shell -- CPAN exploration and modules installation (v1.9205)
ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?)

cpan[1]>

初めてCPANシェルを起動した時は、「Would you like me to configure as much as possible automatically? [yes]」と聞かれるので、デフォルト(Yes)のままEnterを押す。

再設定をしたい場合は、

cpan[2]> o conf init

とする事で、設定し直す事ができる。その時、「Would you like me to configure as much as possible automatically? [yes]」では no にするとよい


設定内容を確認する。

cpan[1]> o conf
$CPAN::Config options from '/usr/local/lib/perl5/5.10.0/CPAN/Config.pm':
    commit             [Commit changes to disk]
    defaults           [Reload defaults from disk]
    help               [Short help about 'o conf' usage]
    init               [Interactive setting of all options]

    applypatch         []
    auto_commit        [0]
    build_cache        [100]
    build_dir          [/root/.cpan/build]
    build_dir_reuse    [1]
    build_requires_install_policy [ask/yes]
    bzip2              [/usr/bin/bzip2]
    cache_metadata     [1]
    check_sigs         [0]
    colorize_debug     undef
    colorize_output    undef
    colorize_print     undef
    colorize_warn      undef
    commandnumber_in_prompt [1]
    commands_quote     undef
    cpan_home          [/root/.cpan]
    curl               [/usr/bin/curl]
    dontload_hash      undef
    dontload_list      undef
    ftp                []
    ftp_passive        [1]
    ftp_proxy          []
    getcwd             [cwd]
    gpg                []
    gzip               [/bin/gzip]
    histfile           [/root/.cpan/histfile]
    histsize           [100]
    http_proxy         []
    inactivity_timeout [0]
    index_expire       [1]
    inhibit_startup_message [0]
    keep_source_where  [/root/.cpan/sources]
    load_module_verbosity [v]
    lynx               []
    make               [/usr/bin/make]
    make_arg           []
    make_install_arg   []
    make_install_make_command [/usr/bin/make]
    makepl_arg         []
    mbuild_arg         []
    mbuild_install_arg []
    mbuild_install_build_command [./Build]
    mbuildpl_arg       []
    ncftp              []
    ncftpget           []
    no_proxy           []
    pager              [/usr/bin/less]
    password           undef
    patch              [/usr/bin/patch]
    prefer_installer   [MB]
    prefs_dir          [/root/.cpan/prefs]
    prerequisites_policy [ask]
    proxy_pass         undef
    proxy_user         undef
    randomize_urllist  undef
    scan_cache         [atstart]
    shell              [/bin/bash]
    show_unparsable_versions [0]
    show_upload_date   [0]
    show_zero_versions [0]
    tar                [/bin/tar]
    tar_verbosity      [v]
    term_is_latin      [1]
    term_ornaments     [1]
    test_report        [0]
    unzip              []
    urllist
    use_sqlite         [0]
    username           undef
    wait_list          undef
    wget               [/usr/bin/wget]
    yaml_load_code     [0]
    yaml_module        [YAML]


cpan[2]> 

CPAN シェルで使えるコマンドを確認する。

cpan[2]> help

Display Information                                                (ver 1.9205)
 command  argument          description
 a,b,d,m  WORD or /REGEXP/  about authors, bundles, distributions, modules
 i        WORD or /REGEXP/  about any of the above
 ls       AUTHOR or GLOB    about files in the author's directory
    (with WORD being a module, bundle or author name or a distribution
    name of the form AUTHOR/DISTRIBUTION)

Download, Test, Make, Install...
 get      download                     clean    make clean
 make     make (implies get)           look     open subshell in dist directory
 test     make test (implies make)     readme   display these README files
 install  make install (implies test)  perldoc  display POD documentation

Upgrade
 r        WORDs or /REGEXP/ or NONE    report updates for some/matching/all modules
 upgrade  WORDs or /REGEXP/ or NONE    upgrade some/matching/all modules

Pragmas
 force  CMD    try hard to do command  fforce CMD    try harder
 notest CMD    skip testing

Other
 h,?           display this menu       ! perl-code   eval a perl command
 o conf [opt]  set and query options   q             quit the cpan shell
 reload cpan   load CPAN.pm again      reload index  load newer indices
 autobundle    Snapshot                recent        latest CPAN uploads

urllist を設定する。

cpan[3]> o conf init urllist
You have no /root/.cpan/sources/MIRRORED.BY
  I'm trying to fetch one

I would like to connect to one of the following sites to get 'MIRRORED.BY':

 http://www.perl.org/CPAN/
 ftp://ftp.perl.org/pub/CPAN/

Is it OK to try to connect to the Internet? [yes]
  LWP not available

Trying with "/usr/bin/curl -L -f -s -S --netrc-optional" to get
    http://www.perl.org/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 by typing in the number(s)
in front of the item(s) you want to select. You can pick several of
each, separated by spaces. 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

(1) China
(2) Hong Kong
(3) Indonesia
(4) Israel
(5) Japan
(6) Korea
(7) Pakistan
(8) Philippines
(9) Republic of Korea
(10) Saudi Arabia
(11) Singapore
(12) Taiwan
(13) Thailand
(14) Turkey
Select your country (or several nearby countries) [] 5

(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, hyphenated ranges allowed
 e.g. '1 4 5' or '7 1-4 8' [] 2 3

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


Please remember to call 'o conf commit' to make the config permanent!


cpan[4]> o conf
$CPAN::Config options from '/usr/local/lib/perl5/5.10.0/CPAN/Config.pm':
(省略)
    urllist
        0 [ftp://ftp.jaist.ac.jp/pub/CPAN/]
        1 [ftp://ftp.kddilabs.jp/CPAN/]

install Bundle::CPAN

cpan[5]> install Bundle::CPAN
CPAN: Storable loaded ok (v2.18)

Trying with "/usr/bin/curl -L -f -s -S --netrc-optional" to get
    ftp://ftp.jaist.ac.jp/pub/CPAN/authors/01mailrc.txt.gz
CPAN: Compress::Zlib loaded ok (v2.008)
Going to read /root/.cpan/sources/authors/01mailrc.txt.gz
............................................................................DONE

Trying with "/usr/bin/curl -L -f -s -S --netrc-optional" to get
    ftp://ftp.jaist.ac.jp/pub/CPAN/modules/02packages.details.txt.gz
Going to read /root/.cpan/sources/modules/02packages.details.txt.gz
  Database was generated on Sun, 21 Sep 2008 08:03:21 GMT
  HTTP::Date not available
.....

途中で

Enter arithmetic or Perl expression: exit
と聞かれる。そのまま Enter を押す。
Continue installing YAML.pm? [y]

これも、そのまま Enter 。


インストール後の最後の表示内容。

CPAN: Term::ReadLine::Perl loaded ok (v1.0302)
.....................
21 subroutines in Term::ReadLine redefined
Exiting subroutine via last at /usr/local/lib/perl5/5.10.0/CPAN.pm line 1450.

cpan shell -- CPAN exploration and modules installation (v1.9205)
ReadLine support enabled

cpan[6]>

このアーカイブについて

このページには、過去に書かれたブログ記事のうちshellカテゴリに属しているものが含まれています。

前のカテゴリはPOEIKCです。

最近のコンテンツはインデックスページで見られます。過去に書かれたものはアーカイブのページで見られます。