Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

430 lines
12 KiB

  1. =head1 NAME
  2. perlmodinstall - Installing CPAN Modules
  3. =head1 DESCRIPTION
  4. You can think of a module as the fundamental unit of reusable Perl
  5. code; see L<perlmod> for details. Whenever anyone creates a chunk of
  6. Perl code that they think will be useful to the world, they register
  7. as a Perl developer at http://www.perl.com/CPAN/modules/04pause.html
  8. so that they can then upload their code to the CPAN. The CPAN is the
  9. Comprehensive Perl Archive Network and can be accessed at
  10. http://www.perl.com/CPAN/.
  11. This documentation is for people who want to download CPAN modules
  12. and install them on their own computer.
  13. =head2 PREAMBLE
  14. You have a file ending in .tar.gz (or, less often, .zip). You know
  15. there's a tasty module inside. There are four steps you must now
  16. take:
  17. =over 5
  18. =item B<DECOMPRESS> the file
  19. =item B<UNPACK> the file into a directory
  20. =item B<BUILD> the module (sometimes unnecessary)
  21. =item B<INSTALL> the module.
  22. =back
  23. Here's how to perform each step for each operating system. This is
  24. I<not> a substitute for reading the README and INSTALL files that
  25. might have come with your module!
  26. Also note that these instructions are tailored for installing the
  27. module into your system's repository of Perl modules. But you can
  28. install modules into any directory you wish. For instance, where I
  29. say C<perl Makefile.PL>, you can substitute C<perl
  30. Makefile.PL PREFIX=/my/perl_directory> to install the modules
  31. into C</my/perl_directory>. Then you can use the modules
  32. from your Perl programs with C<use lib
  33. "/my/perl_directory/lib/site_perl";> or sometimes just C<use
  34. "/my/perl_directory";>.
  35. =over 4
  36. =item *
  37. B<If you're on Unix,>
  38. You can use Andreas Koenig's CPAN module
  39. ( http://www.perl.com/CPAN/modules/by-module/CPAN )
  40. to automate the following steps, from DECOMPRESS through INSTALL.
  41. A. DECOMPRESS
  42. Decompress the file with C<gzip -d yourmodule.tar.gz>
  43. You can get gzip from ftp://prep.ai.mit.edu/pub/gnu.
  44. Or, you can combine this step with the next to save disk space:
  45. gzip -dc yourmodule.tar.gz | tar -xof -
  46. B. UNPACK
  47. Unpack the result with C<tar -xof yourmodule.tar>
  48. C. BUILD
  49. Go into the newly-created directory and type:
  50. perl Makefile.PL
  51. make
  52. make test
  53. D. INSTALL
  54. While still in that directory, type:
  55. make install
  56. Make sure you have the appropriate permissions to install the module
  57. in your Perl 5 library directory. Often, you'll need to be root.
  58. That's all you need to do on Unix systems with dynamic linking.
  59. Most Unix systems have dynamic linking -- if yours doesn't, or if for
  60. another reason you have a statically-linked perl, B<and> the
  61. module requires compilation, you'll need to build a new Perl binary
  62. that includes the module. Again, you'll probably need to be root.
  63. =item *
  64. B<If you're running Windows 95 or NT with the ActiveState port of Perl>
  65. A. DECOMPRESS
  66. You can use the shareware Winzip ( http://www.winzip.com ) to
  67. decompress and unpack modules.
  68. B. UNPACK
  69. If you used WinZip, this was already done for you.
  70. C. BUILD
  71. Does the module require compilation (i.e. does it have files
  72. that end in .xs, .c, .h, .y, .cc, .cxx, or .C)? If it does, you're on
  73. your own. You can try compiling it yourself if you have a C compiler.
  74. If you're successful, consider uploading the resulting binary to the
  75. CPAN for others to use. If it doesn't, go to INSTALL.
  76. D. INSTALL
  77. Copy the module into your Perl's I<lib> directory. That'll be one
  78. of the directories you see when you type
  79. perl -e 'print "@INC"'
  80. =item *
  81. B<If you're running Windows 95 or NT with the core Windows distribution of Perl,>
  82. A. DECOMPRESS
  83. When you download the module, make sure it ends in either
  84. C<.tar.gz> or C<.zip>. Windows browsers sometimes
  85. download C<.tar.gz> files as C<_tar.tar>, because
  86. early versions of Windows prohibited more than one dot in a filename.
  87. You can use the shareware WinZip ( http://www.winzip.com ) to
  88. decompress and unpack modules.
  89. Or, you can use InfoZip's C<unzip> utility (
  90. http://www.cdrom.com/pub/infozip/Info-Zip.html ) to uncompress
  91. C<.zip> files; type C<unzip yourmodule.zip> in
  92. your shell.
  93. Or, if you have a working C<tar> and C<gzip>, you can
  94. type
  95. gzip -cd yourmodule.tar.gz | tar xvf -
  96. in the shell to decompress C<yourmodule.tar.gz>. This will
  97. UNPACK your module as well.
  98. B. UNPACK
  99. All of the methods in DECOMPRESS will have done this for you.
  100. C. BUILD
  101. Go into the newly-created directory and type:
  102. perl Makefile.PL
  103. dmake
  104. dmake test
  105. Depending on your perl configuration, C<dmake> might not be
  106. available. You might have to substitute whatever C<perl
  107. -V:make> says. (Usually, that will be C<nmake> or
  108. C<make>.)
  109. D. INSTALL
  110. While still in that directory, type:
  111. dmake install
  112. =item *
  113. B<If you're using a Macintosh,>
  114. A. DECOMPRESS
  115. In general, all Macintosh decompression utilities mentioned here
  116. can be found in the Info-Mac Hyperarchive
  117. ( http://hyperarchive.lcs.mit.edu/HyperArchive.html ).
  118. Specificly the "Commpress & Translate" listing
  119. ( http://hyperarchive.lcs.mit.edu/HyperArchive/Abstracts/cmp/HyperArchive.html ).
  120. You can either use the shareware StuffIt Expander
  121. ( http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/cmp/stuffit-expander-401.hqx )
  122. in combination with I<DropStuff with Expander Enhancer>
  123. ( http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/cmp/drop-stuff-with-ee-40.hqx )
  124. or the freeware MacGzip (
  125. http://persephone.cps.unizar.es/general/gente/spd/gzip/gzip.html ).
  126. B. UNPACK
  127. If you're using DropStuff or Stuffit, you can just extract the tar
  128. archive. Otherwise, you can use the freeware I<suntar>
  129. ( http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/cmp/suntar-221.hqx )
  130. or I<Tar> ( http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/cmp/tar-40b.hqx ).
  131. C. BUILD
  132. Does the module require compilation?
  133. 1. If it does,
  134. Overview: You need MPW and a combination of new and old CodeWarrior
  135. compilers for MPW and libraries. Makefiles created for building under
  136. MPW use the Metrowerks compilers. It's most likely possible to build
  137. without other compilers, but it has not been done successfully, to our
  138. knowledge. Read the documentation in MacPerl: Power and Ease (
  139. http://www.ptf.com/macperl/ ) on porting/building extensions, or find
  140. an existing precompiled binary, or hire someone to build it for you.
  141. Or, ask someone on the mac-perl mailing list ([email protected])
  142. to build it for you. To subscribe to the mac-perl mailing list, send
  143. mail to [email protected].
  144. 2. If the module doesn't require compilation, go to INSTALL.
  145. D. INSTALL
  146. Make sure the newlines for the modules are in Mac format, not Unix format.
  147. If they are not then you might have decompressed them incorrectly. Check
  148. your decompression and unpacking utilities settings to make sure they are
  149. translating text files properly.
  150. As a last resort, you can use the perl one-liner:
  151. perl -i.bak -pe 's/(?:\015)?\012/\015/g' filenames
  152. on the source files.
  153. Move the files manually into the correct folders.
  154. Move the files to their final destination: This will
  155. most likely be in C<$ENV{MACPERL}site_lib:> (i.e.,
  156. C<HD:MacPerl folder:site_lib:>). You can add new paths to
  157. the default C<@INC> in the Preferences menu item in the
  158. MacPerl application (C<$ENV{MACPERL}site_lib:> is added
  159. automagically). Create whatever directory structures are required
  160. (i.e., for C<Some::Module>, create
  161. C<$ENV{MACPERL}site_lib:Some:> and put
  162. C<Module.pm> in that directory).
  163. Run the following script (or something like it):
  164. #!perl -w
  165. use AutoSplit;
  166. my $dir = "${MACPERL}site_perl";
  167. autosplit("$dir:Some:Module.pm", "$dir:auto", 0, 1, 1);
  168. Eventually there should be a way to automate the installation process; some
  169. solutions exist, but none are ready for the general public yet.
  170. =item *
  171. B<If you're on the DJGPP port of DOS,>
  172. A. DECOMPRESS
  173. djtarx ( ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/ )
  174. will both uncompress and unpack.
  175. B. UNPACK
  176. See above.
  177. C. BUILD
  178. Go into the newly-created directory and type:
  179. perl Makefile.PL
  180. make
  181. make test
  182. You will need the packages mentioned in C<Readme.dos>
  183. in the Perl distribution.
  184. D. INSTALL
  185. While still in that directory, type:
  186. make install
  187. You will need the packages mentioned in Readme.dos in the Perl distribution.
  188. =item *
  189. B<If you're on OS/2,>
  190. Get the EMX development suite and gzip/tar, from either Hobbes (
  191. http://hobbes.nmsu.edu ) or Leo ( http://www.leo.org ), and then follow
  192. the instructions for Unix.
  193. =item *
  194. B<If you're on VMS,>
  195. When downloading from CPAN, save your file with a C<.tgz>
  196. extension instead of C<.tar.gz>. All other periods in the
  197. filename should be replaced with underscores. For example,
  198. C<Your-Module-1.33.tar.gz> should be downloaded as
  199. C<Your-Module-1_33.tgz>.
  200. A. DECOMPRESS
  201. Type
  202. gzip -d Your-Module.tgz
  203. or, for zipped modules, type
  204. unzip Your-Module.zip
  205. Executables for gzip, zip, and VMStar ( Alphas:
  206. http://www.openvms.digital.com/cd/000TOOLS/ALPHA/ and Vaxen:
  207. http://www.openvms.digital.com/cd/000TOOLS/VAX/ ).
  208. gzip and tar
  209. are also available at ftp://ftp.digital.com/pub/VMS.
  210. Note that GNU's gzip/gunzip is not the same as Info-ZIP's zip/unzip
  211. package. The former is a simple compression tool; the latter permits
  212. creation of multi-file archives.
  213. B. UNPACK
  214. If you're using VMStar:
  215. VMStar xf Your-Module.tar
  216. Or, if you're fond of VMS command syntax:
  217. tar/extract/verbose Your_Module.tar
  218. C. BUILD
  219. Make sure you have MMS (from Digital) or the freeware MMK ( available from MadGoat at http://www.madgoat.com ). Then type this to create the
  220. DESCRIP.MMS for the module:
  221. perl Makefile.PL
  222. Now you're ready to build:
  223. mms
  224. mms test
  225. Substitute C<mmk> for C<mms> above if you're using MMK.
  226. D. INSTALL
  227. Type
  228. mms install
  229. Substitute C<mmk> for C<mms> above if you're using MMK.
  230. =item *
  231. B<If you're on MVS>,
  232. Introduce the .tar.gz file into an HFS as binary; don't translate from
  233. ASCII to EBCDIC.
  234. A. DECOMPRESS
  235. Decompress the file with C<gzip -d yourmodule.tar.gz>
  236. You can get gzip from
  237. http://www.s390.ibm.com/products/oe/bpxqp1.html.
  238. B. UNPACK
  239. Unpack the result with
  240. pax -o to=IBM-1047,from=ISO8859-1 -r < yourmodule.tar
  241. The BUILD and INSTALL steps are identical to those for Unix. Some
  242. modules generate Makefiles that work better with GNU make, which is
  243. available from http://www.mks.com/s390/gnu/index.htm.
  244. =back
  245. =head1 HEY
  246. If you have any suggested changes for this page, let me know. Please
  247. don't send me mail asking for help on how to install your modules.
  248. There are too many modules, and too few Orwants, for me to be able to
  249. answer or even acknowledge all your questions. Contact the module
  250. author instead, or post to comp.lang.perl.modules, or ask someone
  251. familiar with Perl on your operating system.
  252. =head1 AUTHOR
  253. Jon Orwant
  254. [email protected]
  255. The Perl Journal, http://tpj.com
  256. with invaluable help from Brandon Allbery, Charles Bailey, Graham
  257. Barr, Dominic Dunlop, Jarkko Hietaniemi, Ben Holzman, Tom Horsley,
  258. Nick Ing-Simmons, Tuomas J. Lukka, Laszlo Molnar, Chris Nandor, Alan
  259. Olsen, Peter Prymmer, Gurusamy Sarathy, Christoph Spalinger, Dan
  260. Sugalski, Larry Virden, and Ilya Zakharevich.
  261. July 22, 1998
  262. =head1 COPYRIGHT
  263. Copyright (C) 1998 Jon Orwant. All Rights Reserved.
  264. Permission is granted to make and distribute verbatim copies of this
  265. documentation provided the copyright notice and this permission notice are
  266. preserved on all copies.
  267. Permission is granted to copy and distribute modified versions of this
  268. documentation under the conditions for verbatim copying, provided also
  269. that they are marked clearly as modified versions, that the authors'
  270. names and title are unchanged (though subtitles and additional
  271. authors' names may be added), and that the entire resulting derived
  272. work is distributed under the terms of a permission notice identical
  273. to this one.
  274. Permission is granted to copy and distribute translations of this
  275. documentation into another language, under the above conditions for
  276. modified versions.