Ubuntu下安装Perl的扩展包很是简单,只需要简单的步骤就可以了。

1
2
3
sudo  cpan
cpan>  install  Bundle::CPANPLUS::Dependencies
cpan>  install  Bundle::CPANPLUS


整个过程需要些时间。当安装完毕,接下来就可以使用cpan命令来安装扩展包了,如要安装Text::Autoformat扩展包,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
cpan[3]>  install  Text::Autoformat
Reading  '/home/richard/.cpan/Metadata'
   Database was generated on Tue, 05 May 2015 10:41:02 GMT
Running  install  for  module  'Text::Autoformat'
Running  make  for  N /NE/NEILB/Text-Autoformat-1 .71. tar .gz
Fetching with LWP:
http: //mirror .as24220.net /pub/cpan/authors/id/N/NE/NEILB/Text-Autoformat-1 .71. tar .gz
Fetching with LWP:
http: //mirror .as24220.net /pub/cpan/authors/id/N/NE/NEILB/CHECKSUMS
Checksum  for  /home/richard/ .cpan /sources/authors/id/N/NE/NEILB/Text-Autoformat-1 .71. tar .gz ok
Scanning cache  /home/richard/ .cpan /build  for  sizes
............................................................................DONE
 
   CPAN.pm: Building N /NE/NEILB/Text-Autoformat-1 .71. tar .gz
 
Checking prerequisites...
   requires:
     !  Text::Reform is not installed
 
ERRORS /WARNINGS  FOUND IN PREREQUISITES.  You may wish to  install  the versions
of the modules indicated above before proceeding with this installation
 
Created MYMETA.yml and MYMETA.json
Creating new  'Build'  script  for  'Text-Autoformat'  version  '1.71'
---- Unsatisfied dependencies detected during ----
----     NEILB /Text-Autoformat-1 .71. tar .gz    ----
     Text::Reform [requires]
Running Build  test
   Delayed  until  after prerequisites
Running Build  install
   Delayed  until  after prerequisites
Running  install  for  module  'Text::Reform'
Running  make  for  C /CH/CHORNY/Text-Reform-1 .20. tar .gz
Fetching with LWP:
http: //mirror .as24220.net /pub/cpan/authors/id/C/CH/CHORNY/Text-Reform-1 .20. tar .gz
Fetching with LWP:
http: //mirror .as24220.net /pub/cpan/authors/id/C/CH/CHORNY/CHECKSUMS
Checksum  for  /home/richard/ .cpan /sources/authors/id/C/CH/CHORNY/Text-Reform-1 .20. tar .gz ok
 
   CPAN.pm: Building C /CH/CHORNY/Text-Reform-1 .20. tar .gz
 
Created MYMETA.yml and MYMETA.json
Creating new  'Build'  script  for  'Text-Reform'  version  '1.20'
Building Text-Reform
   CHORNY /Text-Reform-1 .20. tar .gz
   . /Build  -- OK
Running Build  test
t /00 .load.t .. 1 /1  # Testing Text::Reform 1.20
t /00 .load.t .. ok   
t /pod .t ...... skipped: Test::Pod 1.14 required  for  testing POD
t /reform .t ... ok     
All tests successful.
Files=3, Tests=67,  0 wallclock secs ( 0.04 usr  0.01 sys +  0.08 cusr  0.03 csys =  0.16 CPU)
Result: PASS
   CHORNY /Text-Reform-1 .20. tar .gz
   . /Build  test  -- OK
Running Build  install
Building Text-Reform
Installing  /usr/local/share/perl/5 .18.2 /Text/Reform .pm
Installing  /usr/local/man/man3/Text ::Reform.3pm
   CHORNY /Text-Reform-1 .20. tar .gz
   sudo  . /Build  install   -- OK
Running Build  for  N /NE/NEILB/Text-Autoformat-1 .71. tar .gz
   Has already been unwrapped into directory  /home/richard/ .cpan /build/Text-Autoformat-1 .71-u0bs8b
 
   CPAN.pm: Building N /NE/NEILB/Text-Autoformat-1 .71. tar .gz
 
Building Text-Autoformat
   NEILB /Text-Autoformat-1 .71. tar .gz
   . /Build  -- OK
Running Build  test
t /00 .load.t .......... 1 /1  # Testing Text::Autoformat 1.71
t /00 .load.t .......... ok   
t /01 .ignore.t ........ ok   
t /02 .wide-numbers.t .. ok   
All tests successful.
Files=3, Tests=4,  0 wallclock secs ( 0.04 usr  0.00 sys +  0.13 cusr  0.04 csys =  0.21 CPU)
Result: PASS
   NEILB /Text-Autoformat-1 .71. tar .gz
   . /Build  test  -- OK
Running Build  install
Building Text-Autoformat
Installing  /usr/local/share/perl/5 .18.2 /Text/Autoformat .pm
Installing  /usr/local/man/man3/Text ::Autoformat.3pm
   NEILB /Text-Autoformat-1 .71. tar .gz
   sudo  . /Build  install   -- OK