Leaked source code of windows server 2003
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.

486 lines
14 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
  6. of Perl code that they think will be useful to the world, they
  7. register as a Perl developer at
  8. http://www.perl.com/CPAN/modules/04pause.html so that they can then
  9. upload their code to CPAN. CPAN is the Comprehensive Perl Archive
  10. Network and can be accessed at http://www.perl.com/CPAN/, or searched
  11. via http://cpan.perl.com/ and
  12. http://theory.uwinnipeg.ca/mod_perl/cpan-search.pl .
  13. This documentation is for people who want to download CPAN modules
  14. and install them on their own computer.
  15. =head2 PREAMBLE
  16. You have a file ending in F<.tar.gz> (or, less often, F<.zip>).
  17. You know there's a tasty module inside. You must now take four
  18. steps:
  19. =over 5
  20. =item B<DECOMPRESS> the file
  21. =item B<UNPACK> the file into a directory
  22. =item B<BUILD> the module (sometimes unnecessary)
  23. =item B<INSTALL> the module.
  24. =back
  25. Here's how to perform each step for each operating system. This is
  26. I<not> a substitute for reading the README and INSTALL files that
  27. might have come with your module!
  28. Also note that these instructions are tailored for installing the
  29. module into your system's repository of Perl modules. But you can
  30. install modules into any directory you wish. For instance, where I
  31. say C<perl Makefile.PL>, you can substitute C<perl
  32. Makefile.PL PREFIX=/my/perl_directory> to install the modules
  33. into C</my/perl_directory>. Then you can use the modules
  34. from your Perl programs with C<use lib
  35. "/my/perl_directory/lib/site_perl"> or sometimes just C<use
  36. "/my/perl_directory">.
  37. =over 4
  38. =item *
  39. B<If you're on Unix,>
  40. You can use Andreas Koenig's CPAN module
  41. (which comes standard with Perl, or can itself be downloaded
  42. from http://www.perl.com/CPAN/modules/by-module/CPAN)
  43. to automate the following steps, from DECOMPRESS through INSTALL.
  44. A. DECOMPRESS
  45. Decompress the file with C<gzip -d yourmodule.tar.gz>
  46. You can get gzip from ftp://prep.ai.mit.edu/pub/gnu.
  47. Or, you can combine this step with the next to save disk space:
  48. gzip -dc yourmodule.tar.gz | tar -xof -
  49. B. UNPACK
  50. Unpack the result with C<tar -xof yourmodule.tar>
  51. C. BUILD
  52. Go into the newly-created directory and type:
  53. perl Makefile.PL
  54. make
  55. make test
  56. D. INSTALL
  57. While still in that directory, type:
  58. make install
  59. Make sure you have appropriate permissions to install the module
  60. in your Perl 5 library directory. Often, you'll need to be root.
  61. Perl maintains a record of all module installations. To look at
  62. this list, simply type:
  63. perldoc perllocal
  64. That's all you need to do on Unix systems with dynamic linking.
  65. Most Unix systems have dynamic linking--if yours doesn't, or if for
  66. another reason you have a statically-linked perl, I<and> the
  67. module requires compilation, you'll need to build a new Perl binary
  68. that includes the module. Again, you'll probably need to be root.
  69. =item *
  70. B<If you're running Windows 95 or NT with the ActiveState port of Perl>
  71. A. DECOMPRESS
  72. You can use the shareware B<Winzip> program ( http://www.winzip.com ) to
  73. decompress and unpack modules.
  74. B. UNPACK
  75. If you used WinZip, this was already done for you.
  76. C. BUILD
  77. Does the module require compilation (i.e. does it have files
  78. that end in .xs, .c, .h, .y, .cc, .cxx, or .C)? If it does, you're on
  79. your own. You can try compiling it yourself if you have a C compiler.
  80. If you're successful, consider uploading the resulting binary to
  81. CPAN for others to use. If it doesn't, go to INSTALL.
  82. D. INSTALL
  83. Copy the module into your Perl's I<lib> directory. That'll be one
  84. of the directories you see when you type
  85. perl -e 'print "@INC"'
  86. =item *
  87. B<If you're running Windows 95 or NT with the core Windows distribution of
  88. Perl,>
  89. A. DECOMPRESS
  90. When you download the module, make sure it ends in either
  91. F<.tar.gz> or F<.zip>. Windows browsers sometimes
  92. download C<.tar.gz> files as C<_tar.tar>, because
  93. early versions of Windows prohibited more than one dot in a filename.
  94. You can use the shareware B<WinZip> program ( http://www.winzip.com ) to
  95. decompress and unpack modules.
  96. Or, you can use InfoZip's C<unzip> utility (
  97. http://www.cdrom.com/pub/infozip/ ) to uncompress C<.zip> files; type
  98. C<unzip yourmodule.zip> in your shell.
  99. Or, if you have a working C<tar> and C<gzip>, you can
  100. type
  101. gzip -cd yourmodule.tar.gz | tar xvf -
  102. in the shell to decompress C<yourmodule.tar.gz>. This will
  103. UNPACK your module as well.
  104. B. UNPACK
  105. The methods in DECOMPRESS will have done this for you.
  106. C. BUILD
  107. Go into the newly-created directory and type:
  108. perl Makefile.PL
  109. dmake
  110. dmake test
  111. Depending on your perl configuration, C<dmake> might not be
  112. available. You might have to substitute whatever C<perl
  113. -V:make> says. (Usually, that will be C<nmake> or
  114. C<make>.)
  115. D. INSTALL
  116. While still in that directory, type:
  117. dmake install
  118. =item *
  119. B<If you're using a Macintosh,>
  120. A. DECOMPRESS
  121. First thing you should do is make sure you have the latest B<cpan-mac>
  122. distribution ( http://www.cpan.org/authors/id/CNANDOR/ ), which has
  123. utilities for doing all of the steps. Read the cpan-mac directions
  124. carefully and install it. If you choose not to use cpan-mac
  125. for some reason, there are alternatives listed here.
  126. After installing cpan-mac, drop the module archive on the
  127. B<untarzipme> droplet, which will decompress and unpack for you.
  128. B<Or>, you can either use the shareware B<StuffIt Expander> program
  129. ( http://www.aladdinsys.com/expander/ )
  130. in combination with B<DropStuff with Expander Enhancer>
  131. ( http://www.aladdinsys.com/dropstuff/ )
  132. or the freeware B<MacGzip> program (
  133. http://persephone.cps.unizar.es/general/gente/spd/gzip/gzip.html ).
  134. B. UNPACK
  135. If you're using untarzipme or StuffIt, the archive should be extracted
  136. now. B<Or>, you can use the freeware B<suntar> or I<Tar> (
  137. http://hyperarchive.lcs.mit.edu/HyperArchive/Archive/cmp/ ).
  138. C. BUILD
  139. Check the contents of the distribution.
  140. Read the module's documentation, looking for
  141. reasons why you might have trouble using it with MacPerl. Look for
  142. F<.xs> and F<.c> files, which normally denote that the distribution
  143. must be compiled, and you cannot install it "out of the box."
  144. (See L<"PORTABILITY">.)
  145. If a module does not work on MacPerl but should, or needs to be
  146. compiled, see if the module exists already as a port on the
  147. MacPerl Module Porters site (http://pudge.net/mmp/).
  148. For more information on doing XS with MacPerl yourself, see
  149. Arved Sandstrom's XS tutorial (http://macperl.com/depts/Tutorials/),
  150. and then consider uploading your binary to the CPAN and
  151. registering it on the MMP site.
  152. D. INSTALL
  153. If you are using cpan-mac, just drop the folder on the
  154. B<installme> droplet, and use the module.
  155. B<Or>, if you aren't using cpan-mac, do some manual labor.
  156. Make sure the newlines for the modules are in Mac format, not Unix format.
  157. If they are not then you might have decompressed them incorrectly. Check
  158. your decompression and unpacking utilities settings to make sure they are
  159. translating text files properly.
  160. As a last resort, you can use the perl one-liner:
  161. perl -i.bak -pe 's/(?:\015)?\012/\015/g' <filenames>
  162. on the source files.
  163. Then move the files (probably just the F<.pm> files, though there
  164. may be some additional ones, too; check the module documentation)
  165. to their final destination: This will
  166. most likely be in C<$ENV{MACPERL}site_lib:> (i.e.,
  167. C<HD:MacPerl folder:site_lib:>). You can add new paths to
  168. the default C<@INC> in the Preferences menu item in the
  169. MacPerl application (C<$ENV{MACPERL}site_lib:> is added
  170. automagically). Create whatever directory structures are required
  171. (i.e., for C<Some::Module>, create
  172. C<$ENV{MACPERL}site_lib:Some:> and put
  173. C<Module.pm> in that directory).
  174. Then run the following script (or something like it):
  175. #!perl -w
  176. use AutoSplit;
  177. my $dir = "${MACPERL}site_perl";
  178. autosplit("$dir:Some:Module.pm", "$dir:auto", 0, 1, 1);
  179. =item *
  180. B<If you're on the DJGPP port of DOS,>
  181. A. DECOMPRESS
  182. djtarx ( ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2/ )
  183. will both uncompress and unpack.
  184. B. UNPACK
  185. See above.
  186. C. BUILD
  187. Go into the newly-created directory and type:
  188. perl Makefile.PL
  189. make
  190. make test
  191. You will need the packages mentioned in F<README.dos>
  192. in the Perl distribution.
  193. D. INSTALL
  194. While still in that directory, type:
  195. make install
  196. You will need the packages mentioned in F<README.dos> in the Perl distribution.
  197. =item *
  198. B<If you're on OS/2,>
  199. Get the EMX development suite and gzip/tar, from either Hobbes (
  200. http://hobbes.nmsu.edu ) or Leo ( http://www.leo.org ), and then follow
  201. the instructions for Unix.
  202. =item *
  203. B<If you're on VMS,>
  204. When downloading from CPAN, save your file with a F<.tgz>
  205. extension instead of F<.tar.gz>. All other periods in the
  206. filename should be replaced with underscores. For example,
  207. C<Your-Module-1.33.tar.gz> should be downloaded as
  208. C<Your-Module-1_33.tgz>.
  209. A. DECOMPRESS
  210. Type
  211. gzip -d Your-Module.tgz
  212. or, for zipped modules, type
  213. unzip Your-Module.zip
  214. Executables for gzip, zip, and VMStar ( Alphas:
  215. http://www.openvms.digital.com/freeware/000TOOLS/ALPHA/ and Vaxen:
  216. http://www.openvms.digital.com/freeware/000TOOLS/VAX/ ).
  217. gzip and tar
  218. are also available at ftp://ftp.digital.com/pub/VMS.
  219. Note that GNU's gzip/gunzip is not the same as Info-ZIP's zip/unzip
  220. package. The former is a simple compression tool; the latter permits
  221. creation of multi-file archives.
  222. B. UNPACK
  223. If you're using VMStar:
  224. VMStar xf Your-Module.tar
  225. Or, if you're fond of VMS command syntax:
  226. tar/extract/verbose Your_Module.tar
  227. C. BUILD
  228. Make sure you have MMS (from Digital) or the freeware MMK ( available from
  229. MadGoat at http://www.madgoat.com ). Then type this to create the
  230. DESCRIP.MMS for the module:
  231. perl Makefile.PL
  232. Now you're ready to build:
  233. mms
  234. mms test
  235. Substitute C<mmk> for C<mms> above if you're using MMK.
  236. D. INSTALL
  237. Type
  238. mms install
  239. Substitute C<mmk> for C<mms> above if you're using MMK.
  240. =item *
  241. B<If you're on MVS>,
  242. Introduce the F<.tar.gz> file into an HFS as binary; don't translate from
  243. ASCII to EBCDIC.
  244. A. DECOMPRESS
  245. Decompress the file with C<gzip -d yourmodule.tar.gz>
  246. You can get gzip from
  247. http://www.s390.ibm.com/products/oe/bpxqp1.html.
  248. B. UNPACK
  249. Unpack the result with
  250. pax -o to=IBM-1047,from=ISO8859-1 -r < yourmodule.tar
  251. The BUILD and INSTALL steps are identical to those for Unix. Some
  252. modules generate Makefiles that work better with GNU make, which is
  253. available from http://www.mks.com/s390/gnu/index.htm.
  254. =back
  255. =head1 PORTABILITY
  256. Note that not all modules will work with on all platforms.
  257. See L<perlport> for more information on portability issues.
  258. Read the documentation to see if the module will work on your
  259. system. There are basically three categories
  260. of modules that will not work "out of the box" with all
  261. platforms (with some possibility of overlap):
  262. =over 4
  263. =item *
  264. B<Those that should, but don't.> These need to be fixed; consider
  265. contacting the author and possibly writing a patch.
  266. =item *
  267. B<Those that need to be compiled, where the target platform
  268. doesn't have compilers readily available.> (These modules contain
  269. F<.xs> or F<.c> files, usually.) You might be able to find
  270. existing binaries on the CPAN or elsewhere, or you might
  271. want to try getting compilers and building it yourself, and then
  272. release the binary for other poor souls to use.
  273. =item *
  274. B<Those that are targeted at a specific platform.>
  275. (Such as the Win32:: modules.) If the module is targeted
  276. specifically at a platform other than yours, you're out
  277. of luck, most likely.
  278. =back
  279. Check the CPAN Testers if a module should work with your platform
  280. but it doesn't behave as you'd expect, or you aren't sure whether or
  281. not a module will work under your platform. If the module you want
  282. isn't listed there, you can test it yourself and let CPAN Testers know,
  283. you can join CPAN Testers, or you can request it be tested.
  284. http://testers.cpan.org/
  285. =head1 HEY
  286. If you have any suggested changes for this page, let me know. Please
  287. don't send me mail asking for help on how to install your modules.
  288. There are too many modules, and too few Orwants, for me to be able to
  289. answer or even acknowledge all your questions. Contact the module
  290. author instead, or post to comp.lang.perl.modules, or ask someone
  291. familiar with Perl on your operating system.
  292. =head1 AUTHOR
  293. Jon Orwant
  294. [email protected]
  295. The Perl Journal, http://tpj.com
  296. with invaluable help from Brandon Allbery, Charles Bailey, Graham
  297. Barr, Dominic Dunlop, Jarkko Hietaniemi, Ben Holzman, Tom Horsley,
  298. Nick Ing-Simmons, Tuomas J. Lukka, Laszlo Molnar, Chris Nandor, Alan
  299. Olsen, Peter Prymmer, Gurusamy Sarathy, Christoph Spalinger, Dan
  300. Sugalski, Larry Virden, and Ilya Zakharevich.
  301. First version July 22, 1998
  302. Last Modified August 22, 2000
  303. =head1 COPYRIGHT
  304. Copyright (C) 1998, 2000 Jon Orwant. All Rights Reserved.
  305. Permission is granted to make and distribute verbatim copies of this
  306. documentation provided the copyright notice and this permission notice are
  307. preserved on all copies.
  308. Permission is granted to copy and distribute modified versions of this
  309. documentation under the conditions for verbatim copying, provided also
  310. that they are marked clearly as modified versions, that the authors'
  311. names and title are unchanged (though subtitles and additional
  312. authors' names may be added), and that the entire resulting derived
  313. work is distributed under the terms of a permission notice identical
  314. to this one.
  315. Permission is granted to copy and distribute translations of this
  316. documentation into another language, under the above conditions for
  317. modified versions.