This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldoc -f stat (perlfunc.pod)
[perl5.git] / pod / perlmodlib.PL
CommitLineData
2e1d04bc
JH
1#!../miniperl
2
1fa7ca25
JH
3$ENV{LC_ALL} = 'C';
4
2e1d04bc 5open (OUT, ">perlmodlib.tmp") or die $!;
1fa7ca25 6my (@pragma, @mod, @MANIFEST);
4d671226 7
2e1d04bc 8open (MANIFEST, "../MANIFEST") or die $!;
4d671226 9@MANIFEST = grep !m</(?:t|demo)/>, <MANIFEST>;
7ef5744c
RGS
10push @MANIFEST, 'lib/Config.pod', 'lib/Errno.pm', 'lib/lib.pm',
11 'lib/DynaLoader.pm', 'lib/XSLoader.pm';
2e1d04bc 12
4d671226 13for (@MANIFEST) {
2e1d04bc
JH
14 my $filename;
15 next unless s|^lib/|| or m|^ext/|;
7ef5744c 16 my ($origfilename) = ($filename) = m|^(\S+)|;
2e1d04bc 17 $filename =~ s|^[^/]+/|| if $filename =~ s|^ext/||;
1fa7ca25 18 next unless $filename =~ m!\.p(m|od)$!;
7ef5744c
RGS
19 unless (open (MOD, "../lib/$filename")) {
20 unless (open (MOD, "../$origfilename")) {
21 warn "Couldn't open ../$origfilename: $!";
22 next;
23 }
24 $filename = $origfilename;
25 }
4e860d0a 26
1fa7ca25 27
2e1d04bc
JH
28 my ($name, $thing);
29 my $foundit=0;
4e860d0a
JH
30 {
31 local $/="";
32 while (<MOD>) {
33 next unless /^=head1 NAME/;
34 $foundit++;
35 last;
36 }
2e1d04bc 37 }
4e860d0a 38 unless ($foundit) {
1fa7ca25 39 warn "$filename missing =head1 NAME (okay if there is respective .pod)\n";
4e860d0a 40 next;
2e1d04bc 41 }
2e1d04bc
JH
42 my $title = <MOD>;
43 chomp($title);
44 close MOD;
45
46 my $perlname = $filename;
7ef5744c 47 $perlname =~ s!^.*\b(ext|lib)/!!;
4e860d0a 48 $perlname =~ s!\.p(m|od)$!!;
7ef5744c 49 $perlname =~ s!\b(\w+)/\1\b!$1!;
4e860d0a
JH
50 $perlname =~ s!/!::!g;
51
52 ($name, $thing) = split / --? /, $title, 2;
53
54 unless ($name and $thing) {
55 warn "$filename missing name\n" unless $name;
56 warn "$filename missing thing\n" unless $thing;
57 next;
58 }
2e1d04bc 59
1fa7ca25 60
4e860d0a
JH
61 $thing =~ s/^perl pragma to //i;
62 $thing = ucfirst($thing);
2e1d04bc
JH
63 $title = "=item $perlname\n\n$thing\n\n";
64
1fa7ca25 65 if ($filename =~ /[A-Z]/) {
2e1d04bc
JH
66 push @mod, $title;
67 } else {
68 push @pragma, $title;
69 }
70}
71
72print OUT <<'EOF';
c165c82a
JH
73=for maintainers
74Generated by perlmodlib.PL -- DO NOT EDIT!
843dbe26 75
2e1d04bc
JH
76=head1 NAME
77
78perlmodlib - constructing new Perl modules and finding existing ones
79
2e1d04bc
JH
80=head1 THE PERL MODULE LIBRARY
81
7ef5744c 82Many modules are included in the Perl distribution. These are described
2e1d04bc 83below, and all end in F<.pm>. You may discover compiled library
7ef5744c 84files (usually ending in F<.so>) or small pieces of modules to be
2e1d04bc
JH
85autoloaded (ending in F<.al>); these were automatically generated
86by the installation process. You may also discover files in the
87library directory that end in either F<.pl> or F<.ph>. These are
88old libraries supplied so that old programs that use them still
89run. The F<.pl> files will all eventually be converted into standard
90modules, and the F<.ph> files made by B<h2ph> will probably end up
91as extension modules made by B<h2xs>. (Some F<.ph> values may
92already be available through the POSIX, Errno, or Fcntl modules.)
93The B<pl2pm> file in the distribution may help in your conversion,
94but it's just a mechanical process and therefore far from bulletproof.
95
96=head2 Pragmatic Modules
97
98They work somewhat like compiler directives (pragmata) in that they
99tend to affect the compilation of your program, and thus will usually
100work well only when used within a C<use>, or C<no>. Most of these
101are lexically scoped, so an inner BLOCK may countermand them
102by saying:
103
104 no integer;
105 no strict 'refs';
106 no warnings;
107
108which lasts until the end of that BLOCK.
109
110Some pragmas are lexically scoped--typically those that affect the
111C<$^H> hints variable. Others affect the current package instead,
112like C<use vars> and C<use subs>, which allow you to predeclare a
113variables or subroutines within a particular I<file> rather than
114just a block. Such declarations are effective for the entire file
115for which they were declared. You cannot rescind them with C<no
116vars> or C<no subs>.
117
118The following pragmas are defined (and have their own documentation).
119
120=over 12
121
122EOF
123
124print OUT $_ for (sort @pragma);
125
126print OUT <<EOF;
127=back
128
129=head2 Standard Modules
130
131Standard, bundled modules are all expected to behave in a well-defined
132manner with respect to namespace pollution because they use the
133Exporter module. See their own documentation for details.
134
7ef5744c
RGS
135It's possible that not all modules listed below are installed on your
136system. For example, the GDBM_File module will not be installed if you
137don't have the gdbm library.
138
2e1d04bc
JH
139=over 12
140
141EOF
142
143print OUT $_ for (sort @mod);
144
145print OUT <<'EOF';
146=back
147
148To find out I<all> modules installed on your system, including
149those without documentation or outside the standard release,
309a139e 150just do this:
2e1d04bc
JH
151
152 % find `perl -e 'print "@INC"'` -name '*.pm' -print
153
154They should all have their own documentation installed and accessible
155via your system man(1) command. If you do not have a B<find>
156program, you can use the Perl B<find2perl> program instead, which
157generates Perl code as output you can run through perl. If you
158have a B<man> program but it doesn't find your modules, you'll have
159to fix your manpath. See L<perl> for details. If you have no
160system B<man> command, you might try the B<perldoc> program.
161
162=head2 Extension Modules
163
164Extension modules are written in C (or a mix of Perl and C). They
165are usually dynamically loaded into Perl if and when you need them,
da75cd15 166but may also be linked in statically. Supported extension modules
2e1d04bc
JH
167include Socket, Fcntl, and POSIX.
168
169Many popular C extension modules do not come bundled (at least, not
170completely) due to their sizes, volatility, or simply lack of time
171for adequate testing and configuration across the multitude of
172platforms on which Perl was beta-tested. You are encouraged to
173look for them on CPAN (described below), or using web search engines
7ef5744c 174like Alta Vista or Google.
2e1d04bc
JH
175
176=head1 CPAN
177
178CPAN stands for Comprehensive Perl Archive Network; it's a globally
179replicated trove of Perl materials, including documentation, style
180guides, tricks and traps, alternate ports to non-Unix systems and
181occasional binary distributions for these. Search engines for
1577cd80 182CPAN can be found at http://www.cpan.org/
2e1d04bc
JH
183
184Most importantly, CPAN includes around a thousand unbundled modules,
185some of which require a C compiler to build. Major categories of
186modules are:
187
188=over
189
190=item *
ac634a9a 191
2e1d04bc
JH
192Language Extensions and Documentation Tools
193
194=item *
ac634a9a 195
2e1d04bc
JH
196Development Support
197
198=item *
ac634a9a 199
2e1d04bc
JH
200Operating System Interfaces
201
202=item *
ac634a9a 203
2e1d04bc
JH
204Networking, Device Control (modems) and InterProcess Communication
205
206=item *
ac634a9a 207
2e1d04bc
JH
208Data Types and Data Type Utilities
209
210=item *
ac634a9a 211
2e1d04bc
JH
212Database Interfaces
213
214=item *
ac634a9a 215
2e1d04bc
JH
216User Interfaces
217
218=item *
ac634a9a 219
2e1d04bc
JH
220Interfaces to / Emulations of Other Programming Languages
221
222=item *
ac634a9a 223
2e1d04bc
JH
224File Names, File Systems and File Locking (see also File Handles)
225
226=item *
ac634a9a 227
2e1d04bc
JH
228String Processing, Language Text Processing, Parsing, and Searching
229
230=item *
ac634a9a 231
2e1d04bc
JH
232Option, Argument, Parameter, and Configuration File Processing
233
234=item *
ac634a9a 235
2e1d04bc
JH
236Internationalization and Locale
237
238=item *
ac634a9a 239
2e1d04bc
JH
240Authentication, Security, and Encryption
241
242=item *
ac634a9a 243
2e1d04bc
JH
244World Wide Web, HTML, HTTP, CGI, MIME
245
246=item *
ac634a9a 247
2e1d04bc
JH
248Server and Daemon Utilities
249
250=item *
ac634a9a 251
2e1d04bc
JH
252Archiving and Compression
253
254=item *
ac634a9a 255
2e1d04bc
JH
256Images, Pixmap and Bitmap Manipulation, Drawing, and Graphing
257
258=item *
ac634a9a 259
2e1d04bc
JH
260Mail and Usenet News
261
262=item *
ac634a9a 263
2e1d04bc
JH
264Control Flow Utilities (callbacks and exceptions etc)
265
266=item *
ac634a9a 267
2e1d04bc
JH
268File Handle and Input/Output Stream Utilities
269
270=item *
ac634a9a 271
2e1d04bc
JH
272Miscellaneous Modules
273
274=back
275
5df44211
JH
276The list of the registered CPAN sites as of this writing follows.
277Please note that the sorting order is alphabetical on fields:
278
279Continent
280 |
281 |-->Country
282 |
283 |-->[state/province]
284 |
285 |-->ftp
286 |
287 |-->[http]
288
289and thus the North American servers happen to be listed between the
290European and the South American sites.
291
292You should try to choose one close to you.
2e1d04bc 293
4e860d0a
JH
294=head2 Africa
295
296=over 4
297
5df44211 298=item South Africa
4e860d0a 299
5df44211
JH
300 ftp://ftp.is.co.za/programming/perl/CPAN/
301 ftp://ftp.mweb.co.za/pub/mirrors/cpan/
302 ftp://ftp.saix.net/pub/CPAN/
303 ftp://ftp.sun.ac.za/CPAN/CPAN/
4e860d0a
JH
304
305=back
306
307=head2 Asia
308
309=over 4
310
5df44211 311=item China
4e860d0a 312
5df44211
JH
313 ftp://freesoft.cei.gov.cn/pub/languages/perl/CPAN/
314 http://www2.linuxforum.net/mirror/CPAN/
315 http://cpan.shellhung.org/
316 ftp://ftp.shellhung.org/pub/CPAN
4e860d0a 317
5df44211 318=item India
4e860d0a 319
5df44211
JH
320 http://cpan.in.freeos.com
321 ftp://cpan.in.freeos.com/pub/CPAN/
c165c82a 322
5df44211 323=item Indonesia
c165c82a 324
5df44211
JH
325 http://cpan.itb.web.id/
326 ftp://mirrors.piksi.itb.ac.id/CPAN/
327 http://cpan.cbn.net.id/
328 ftp://ftp.cbn.net.id/mirror/CPAN
329 http://CPAN.mweb.co.id/
330 ftp://ftp.mweb.co.id/pub/languages/perl/CPAN/
c165c82a 331
5df44211 332=item Israel
c165c82a 333
5df44211
JH
334 http://www.iglu.org.il:/pub/CPAN/
335 ftp://ftp.iglu.org.il/pub/CPAN/
336 http://cpan.lerner.co.il/
337 http://bioinfo.weizmann.ac.il/pub/software/perl/CPAN/
338 ftp://bioinfo.weizmann.ac.il/pub/software/perl/CPAN/
c165c82a 339
5df44211 340=item Japan
c165c82a 341
5df44211
JH
342 ftp://ftp.u-aizu.ac.jp/pub/CPAN
343 ftp://ftp.kddlabs.co.jp/CPAN/
344 http://mirror.nucba.ac.jp/mirror/Perl/
345 ftp://mirror.nucba.ac.jp/mirror/Perl/
346 ftp://ftp.meisei-u.ac.jp/pub/CPAN/
347 ftp://ftp.ayamura.org/pub/CPAN/
348 ftp://ftp.jaist.ac.jp/pub/lang/perl/CPAN/
349 ftp://ftp.dti.ad.jp/pub/lang/CPAN/
350 ftp://ftp.ring.gr.jp/pub/lang/perl/CPAN/
c165c82a 351
5df44211 352=item Korea
c165c82a 353
5df44211
JH
354 http://mirror.Mazic.org/pub/CPAN
355 ftp://mirror.Mazic.org/pub/CPAN
c165c82a 356
5df44211 357=item Philippines
4e860d0a 358
5df44211 359 http://www.adzu.edu.ph/CPAN
4e860d0a 360
5df44211 361=item Russian Federation
4e860d0a 362
5df44211
JH
363 http://cpan.tomsk.ru
364 ftp://cpan.tomsk.ru/pub/CPAN
4e860d0a 365
5df44211 366=item Saudi Arabia
4e860d0a 367
5df44211 368 ftp://ftp.isu.net.sa/pub/CPAN/
4e860d0a 369
5df44211 370=item Singapore
4e860d0a 371
5df44211
JH
372 http://cpan.hjc.edu.sg
373 http://mirror.averse.net/pub/CPAN
374 ftp://mirror.averse.net/pub/CPAN
4e860d0a 375
5df44211 376=item South Korea
4e860d0a 377
5df44211
JH
378 http://CPAN.bora.net/
379 ftp://ftp.bora.net/pub/CPAN/
380 http://ftp.kornet.net/pub/CPAN/
381 ftp://ftp.kornet.net/pub/CPAN/
382 ftp://ftp.nuri.net/pub/CPAN/
383 http://ftp.xgate.co.kr/cpan/
384 ftp://ftp.xgate.co.kr/pub/mirror/CPAN
4e860d0a 385
5df44211 386=item Taiwan
4e860d0a 387
5df44211
JH
388 ftp://ftp.nctu.edu.tw/UNIX/perl/CPAN
389 ftp://ftp.ee.ncku.edu.tw/pub/perl/CPAN/
390 ftp://ftp1.sinica.edu.tw/pub1/perl/CPAN/
391 http://ftp.tku.edu.tw/pub/CPAN/
392 ftp://ftp.tku.edu.tw/pub/CPAN/
4e860d0a 393
5df44211 394=item Thailand
4e860d0a 395
5df44211
JH
396 ftp://ftp.loxinfo.co.th/pub/cpan/
397 ftp://ftp.cs.riubon.ac.th/pub/mirrors/CPAN/
4e860d0a
JH
398
399=back
400
401=head2 Central America
402
403=over 4
404
5df44211 405=item Costa Rica
4e860d0a 406
5df44211
JH
407 ftp://ftp.linux.co.cr/mirrors/CPAN/
408 http://ftp.ucr.ac.cr/Unix/CPAN/
409 ftp://ftp.ucr.ac.cr/pub/Unix/CPAN/
4e860d0a
JH
410
411=back
412
413=head2 Europe
414
415=over 4
416
5df44211 417=item Austria
4e860d0a 418
5df44211 419 ftp://ftp.tuwien.ac.at/pub/CPAN/
4e860d0a 420
5df44211 421=item Belgium
4e860d0a 422
5df44211
JH
423 http://ftp.easynet.be/pub/CPAN/
424 ftp://ftp.easynet.be/pub/CPAN/
425 http://cpan.skynet.be
426 ftp://ftp.skynet.be/pub/CPAN
427 ftp://ftp.kulnet.kuleuven.ac.be/pub/mirror/CPAN/
4e860d0a 428
5df44211 429=item Bulgaria
4e860d0a 430
5df44211
JH
431 http://cpan.lirex.net/
432 ftp://ftp.lirex.net/pub/mirrors/CPAN
4e860d0a 433
5df44211 434=item Croatia
4e860d0a 435
5df44211
JH
436 http://ftp.linux.hr/pub/CPAN/
437 ftp://ftp.linux.hr/pub/CPAN/
4e860d0a 438
5df44211 439=item Czech Republic
4e860d0a 440
5df44211
JH
441 http://ftp.fi.muni.cz/pub/CPAN/
442 ftp://ftp.fi.muni.cz/pub/CPAN/
443 ftp://sunsite.mff.cuni.cz/MIRRORS/ftp.funet.fi/pub/languages/perl/CPAN/
4e860d0a 444
5df44211 445=item Denmark
4e860d0a 446
5df44211
JH
447 http://mirrors.sunsite.dk/cpan/
448 ftp://sunsite.dk/mirrors/cpan/
449 http://cpan.cybercity.dk
450 http://www.cpan.dk/CPAN/
451 ftp://www.cpan.dk/ftp.cpan.org/CPAN/
4e860d0a 452
5df44211 453=item Estonia
4e860d0a 454
5df44211 455 ftp://ftp.ut.ee/pub/languages/perl/CPAN/
4e860d0a 456
5df44211 457=item Finland
4e860d0a 458
5df44211
JH
459 ftp://ftp.funet.fi/pub/languages/perl/CPAN/
460 http://cpan.kpnqwest.fi/
4e860d0a 461
5df44211 462=item France
c165c82a 463
5df44211
JH
464 http://ftp.u-paris10.fr/perl/CPAN
465 ftp://ftp.u-paris10.fr/perl/CPAN
466 http://cpan.mirrors.easynet.fr/
467 ftp://cpan.mirrors.easynet.fr/pub/ftp.cpan.org/
468 ftp://ftp.club-internet.fr/pub/perl/CPAN/
469 http://fr.cpan.org/
470 ftp://ftp.lip6.fr/pub/perl/CPAN/
471 ftp://ftp.oleane.net/pub/mirrors/CPAN/
472 ftp://ftp.pasteur.fr/pub/computing/CPAN/
473 http://mir2.ovh.net/ftp.cpan.org
474 ftp://mir1.ovh.net/ftp.cpan.org
475 http://ftp.u-strasbg.fr/CPAN
476 ftp://ftp.u-strasbg.fr/CPAN
477 http://cpan.cict.fr/
478 ftp://cpan.cict.fr/pub/CPAN/
479 ftp://ftp.uvsq.fr/pub/perl/CPAN/
c165c82a 480
5df44211 481=item Germany
c165c82a 482
5df44211
JH
483 ftp://ftp.rz.ruhr-uni-bochum.de/pub/CPAN/
484 ftp://ftp.freenet.de/pub/ftp.cpan.org/pub/CPAN/
485 ftp://ftp.uni-erlangen.de/pub/source/CPAN/
486 ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/CPAN
487 http://pandemonium.tiscali.de/pub/CPAN/
488 ftp://pandemonium.tiscali.de/pub/CPAN/
489 http://ftp.gwdg.de/pub/languages/perl/CPAN/
490 ftp://ftp.gwdg.de/pub/languages/perl/CPAN/
491 ftp://ftp.uni-hamburg.de/pub/soft/lang/perl/CPAN/
492 ftp://ftp.leo.org/pub/CPAN/
493 http://cpan.noris.de/
494 ftp://cpan.noris.de/pub/CPAN/
495 ftp://ftp.mpi-sb.mpg.de/pub/perl/CPAN/
496 ftp://ftp.gmd.de/mirrors/CPAN/
4e860d0a 497
5df44211 498=item Greece
4e860d0a 499
5df44211
JH
500 ftp://ftp.acn.gr/pub/lang/perl/CPAN
501 ftp://ftp.forthnet.gr/pub/languages/perl/CPAN
502 ftp://ftp.ntua.gr/pub/lang/perl/
4e860d0a 503
5df44211 504=item Hungary
4e860d0a 505
5df44211
JH
506 http://cpan.artifact.hu/
507 ftp://cpan.artifact.hu/CPAN/
508 http://ftp.kfki.hu/packages/perl/CPAN/
509 ftp://ftp.kfki.hu/pub/packages/perl/CPAN/
4e860d0a 510
5df44211 511=item Iceland
4e860d0a 512
5df44211
JH
513 http://ftp.rhnet.is/pub/CPAN/
514 ftp://ftp.rhnet.is/pub/CPAN/
4e860d0a 515
5df44211 516=item Ireland
4e860d0a 517
5df44211
JH
518 http://cpan.indigo.ie/
519 ftp://cpan.indigo.ie/pub/CPAN/
520 http://sunsite.compapp.dcu.ie/pub/perl/
521 ftp://sunsite.compapp.dcu.ie/pub/perl/
4e860d0a 522
5df44211 523=item Italy
4e860d0a 524
5df44211
JH
525 http://cpan.nettuno.it/
526 http://gusp.dyndns.org/CPAN/
527 ftp://gusp.dyndns.org/pub/CPAN
528 http://softcity.iol.it/cpan
529 ftp://softcity.iol.it/pub/cpan
530 ftp://ftp.unina.it/pub/Other/CPAN/CPAN/
531 ftp://ftp.unipi.it/pub/mirror/perl/CPAN/
532 ftp://cis.uniRoma2.it/CPAN/
533 ftp://ftp.edisontel.it/pub/CPAN_Mirror/
534 ftp://ftp.flashnet.it/pub/CPAN/
4e860d0a 535
5df44211 536=item Latvia
4e860d0a 537
5df44211 538 http://kvin.lv/pub/CPAN/
4e860d0a 539
5df44211 540=item Lithuania
4e860d0a 541
5df44211 542 ftp://ftp.unix.lt/pub/CPAN/
4e860d0a 543
5df44211 544=item Netherlands
4e860d0a 545
5df44211
JH
546 ftp://download.xs4all.nl/pub/mirror/CPAN/
547 ftp://ftp.nl.uu.net/pub/CPAN/
548 ftp://ftp.nluug.nl/pub/languages/perl/CPAN/
549 http://cpan.cybercomm.nl/
550 ftp://mirror.cybercomm.nl/pub/CPAN
551 ftp://ftp.cpan.nl/pub/CPAN/
552 http://ftp.easynet.nl/mirror/CPAN
553 ftp://ftp.easynet.nl/mirror/CPAN
554 http://archive.cs.uu.nl/mirror/CPAN/
555 ftp://ftp.cs.uu.nl/mirror/CPAN/
4e860d0a 556
5df44211
JH
557=item Norway
558
559 ftp://ftp.uninett.no/pub/languages/perl/CPAN
560 ftp://ftp.uit.no/pub/languages/perl/cpan/
561
562=item Poland
563
564 ftp://ftp.pk.edu.pl/pub/lang/perl/CPAN/
565 ftp://ftp.mega.net.pl/pub/mirrors/ftp.perl.com/
566 ftp://ftp.man.torun.pl/pub/doc/CPAN/
567 ftp://sunsite.icm.edu.pl/pub/CPAN/
568
569=item Portugal
570
571 ftp://ftp.ua.pt/pub/CPAN/
572 ftp://perl.di.uminho.pt/pub/CPAN/
573 http://cpan.dei.uc.pt/
574 ftp://ftp.dei.uc.pt/pub/CPAN
575 ftp://ftp.ist.utl.pt/pub/CPAN/
576 http://cpan.ip.pt/
577 ftp://cpan.ip.pt/pub/cpan/
578 ftp://ftp.netc.pt/pub/CPAN/
579 ftp://ftp.up.pt/pub/CPAN
4e860d0a 580
5df44211 581=item Romania
4e860d0a 582
5df44211
JH
583 ftp://ftp.kappa.ro/pub/mirrors/ftp.perl.org/pub/CPAN/
584 ftp://ftp.dntis.ro/pub/cpan/
585 ftp://ftp.dnttm.ro/pub/CPAN/
586 ftp://ftp.lasting.ro/pub/CPAN
587 ftp://ftp.timisoara.roedu.net/mirrors/CPAN/
4e860d0a 588
5df44211 589=item Russia
4e860d0a 590
5df44211
JH
591 ftp://ftp.chg.ru/pub/lang/perl/CPAN/
592 http://cpan.rinet.ru/
593 ftp://cpan.rinet.ru/pub/mirror/CPAN/
594 ftp://ftp.aha.ru/pub/CPAN/
595 http://cpan.sai.msu.ru/
596 ftp://ftp.sai.msu.su/pub/lang/perl/CPAN/
4e860d0a 597
5df44211 598=item Slovakia
4e860d0a 599
5df44211
JH
600 http://ftp.cvt.stuba.sk/pub/CPAN/
601 ftp://ftp.cvt.stuba.sk/pub/CPAN/
4e860d0a 602
5df44211 603=item Slovenia
4e860d0a 604
5df44211 605 ftp://ftp.arnes.si/software/perl/CPAN/
4e860d0a 606
5df44211 607=item Spain
4e860d0a 608
5df44211
JH
609 http://cpan.imasd.elmundo.es/
610 ftp://ftp.rediris.es/mirror/CPAN/
611 ftp://ftp.etse.urv.es/pub/perl/
4e860d0a 612
5df44211 613=item Sweden
4e860d0a 614
5df44211
JH
615 http://ftp.du.se/CPAN/
616 ftp://ftp.du.se/pub/CPAN/
617 ftp://mirror.dataphone.se/pub/CPAN
618 ftp://ftp.sunet.se/pub/lang/perl/CPAN/
4e860d0a 619
5df44211 620=item Switzerland
4e860d0a 621
5df44211
JH
622 ftp://ftp.danyk.ch/CPAN/
623 ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
4e860d0a 624
5df44211 625=item Turkey
4e860d0a 626
5df44211
JH
627 http://ftp.ulak.net.tr/perl/CPAN/
628 ftp://ftp.ulak.net.tr/perl/CPAN
629 ftp://sunsite.bilkent.edu.tr/pub/languages/CPAN/
c165c82a 630
5df44211 631=item Ukraine
c165c82a 632
5df44211
JH
633 http://cpan.org.ua/
634 ftp://cpan.org.ua/
635 ftp://ftp.perl.org.ua/pub/CPAN/
c165c82a 636
5df44211 637=item United Kingdom
d4858812 638
5df44211
JH
639 http://www.mirror.ac.uk/sites/ftp.funet.fi/pub/languages/perl/CPAN
640 ftp://ftp.mirror.ac.uk/sites/ftp.funet.fi/pub/languages/perl/CPAN/
641 http://cpan.teleglobe.net/
642 ftp://cpan.teleglobe.net/pub/CPAN
643 http://cpan.crazygreek.co.uk
644 ftp://ftp.demon.co.uk/pub/CPAN/
645 http://cpan.m.flirble.org/
646 ftp://ftp.flirble.org/pub/languages/perl/CPAN/
647 ftp://ftp.plig.org/pub/CPAN/
648 http://mirror.uklinux.net/CPAN/
649 ftp://mirror.uklinux.net/pub/CPAN/
650 http://cpan.mirrors.clockerz.net/
651 ftp://ftp.clockerz.net/pub/CPAN/
652 ftp://usit.shef.ac.uk/pub/packages/CPAN/
d4858812 653
4e860d0a
JH
654=back
655
656=head2 North America
657
658=over 4
659
5df44211 660=item Alberta
4e860d0a 661
5df44211
JH
662 http://sunsite.ualberta.ca/pub/Mirror/CPAN/
663 ftp://sunsite.ualberta.ca/pub/Mirror/CPAN/
4e860d0a 664
5df44211 665=item Manitoba
4e860d0a 666
5df44211
JH
667 http://theoryx5.uwinnipeg.ca/pub/CPAN/
668 ftp://theoryx5.uwinnipeg.ca/pub/CPAN/
4e860d0a 669
5df44211 670=item Nova Scotia
4e860d0a 671
5df44211 672 ftp://cpan.chebucto.ns.ca/pub/CPAN/
4e860d0a 673
5df44211 674=item Ontario
4e860d0a 675
5df44211 676 ftp://ftp.crc.ca/pub/CPAN/
4e860d0a 677
5df44211 678=item Quebec
4e860d0a 679
5df44211 680 http://cpan.mirror.smartworker.org/
c165c82a 681
5df44211 682=item Mexico
c165c82a 683
5df44211
JH
684 http://cpan.azc.uam.mx
685 ftp://cpan.azc.uam.mx/mirrors/CPAN
686 http://cpan.unam.mx/
687 ftp://cpan.unam.mx/pub/CPAN
688 http://www.msg.com.mx/CPAN/
689 ftp://ftp.msg.com.mx/pub/CPAN/
c165c82a
JH
690
691=back
4e860d0a 692
5df44211 693=head2 United States
d4858812 694
5df44211 695=over 4
4e860d0a 696
5df44211 697=item Alabama
4e860d0a 698
5df44211
JH
699 http://mirror.hiwaay.net/CPAN/
700 ftp://mirror.hiwaay.net/CPAN/
4e860d0a 701
5df44211 702=item California
4e860d0a 703
5df44211
JH
704 http://cpan.develooper.com/
705 http://www.cpan.org/
706 ftp://cpan.valueclick.com/pub/CPAN/
707 http://mirrors.gossamer-threads.com/CPAN
708 ftp://cpan.nas.nasa.gov/pub/perl/CPAN/
709 http://mirrors.kernel.org/cpan/
710 ftp://mirrors.kernel.org/pub/CPAN
711 http://cpan.digisle.net/
712 ftp://cpan.digisle.net/pub/CPAN
713 http://www.perl.com/CPAN/
714 http://download.sourceforge.net/mirrors/CPAN/
4e860d0a 715
5df44211 716=item Colorado
4e860d0a 717
5df44211 718 ftp://ftp.cs.colorado.edu/pub/perl/CPAN/
4e860d0a 719
5df44211 720=item Delaware
4e860d0a 721
5df44211
JH
722 http://ftp.lug.udel.edu/pub/CPAN
723 ftp://ftp.lug.udel.edu/pub/CPAN
4e860d0a 724
5df44211 725=item District of Columbia
4e860d0a 726
5df44211 727 ftp://ftp.dc.aleron.net/pub/CPAN/
4e860d0a 728
5df44211 729=item Florida
c165c82a 730
5df44211
JH
731 ftp://ftp.cise.ufl.edu/pub/mirrors/CPAN/
732 http://mirror.csit.fsu.edu/pub/CPAN/
733 ftp://mirror.csit.fsu.edu/pub/CPAN/
734 http://cpan.mirrors.nks.net/
c165c82a 735
5df44211 736=item Illinois
4e860d0a 737
5df44211
JH
738 http://uiarchive.uiuc.edu/mirrors/ftp/cpan.cse.msu.edu/
739 ftp://uiarchive.uiuc.edu/mirrors/ftp/cpan.cse.msu.edu/
4e860d0a 740
5df44211 741=item Indiana
4e860d0a 742
5df44211
JH
743 ftp://ftp.uwsg.iu.edu/pub/perl/CPAN/
744 http://cpan.netnitco.net/
745 ftp://cpan.netnitco.net/pub/mirrors/CPAN/
746 http://archive.progeny.com/CPAN/
747 ftp://archive.progeny.com/CPAN/
748 ftp://cpan.in-span.net/
749 http://csociety-ftp.ecn.purdue.edu/pub/CPAN
750 ftp://csociety-ftp.ecn.purdue.edu/pub/CPAN
4e860d0a 751
5df44211 752=item Kentucky
4e860d0a 753
5df44211
JH
754 http://cpan.uky.edu/
755 ftp://cpan.uky.edu/pub/CPAN/
4e860d0a 756
5df44211 757=item Massachusetts
4e860d0a 758
5df44211
JH
759 ftp://ftp.ccs.neu.edu/net/mirrors/ftp.funet.fi/pub/languages/perl/CPAN/
760 http://cpan.mirrors.netnumina.com/
761 ftp://mirrors.netnumina.com/cpan/
4e860d0a 762
5df44211 763=item Michigan
4e860d0a 764
5df44211 765 ftp://cpan.cse.msu.edu/
4e860d0a 766
5df44211 767=item New Jersey
4e860d0a 768
5df44211
JH
769 ftp://ftp.cpanel.net/pub/CPAN/
770 http://cpan.teleglobe.net/
771 ftp://cpan.teleglobe.net/pub/CPAN
4e860d0a 772
5df44211 773=item New York
4e860d0a 774
5df44211
JH
775 ftp://ftp.exobit.org/pub/perl/CPAN
776 http://cpan.belfry.net/
777 http://cpan.thepirtgroup.com/
778 ftp://cpan.thepirtgroup.com/
779 ftp://ftp.stealth.net/pub/CPAN/
780 http://www.rge.com/pub/languages/perl/
781 ftp://ftp.rge.com/pub/languages/perl/
782 ftp://mirrors.cloud9.net/pub/mirrors/CPAN/
4e860d0a 783
5df44211 784=item North Carolina
4e860d0a 785
5df44211 786 ftp://ftp.duke.edu/pub/perl/
4e860d0a 787
5df44211 788=item Ohio
4e860d0a 789
5df44211 790 ftp://ftp.loaded.net/pub/CPAN/
4e860d0a 791
5df44211 792=item Oklahoma
4e860d0a 793
5df44211 794 ftp://ftp.ou.edu/mirrors/CPAN/
4e860d0a 795
5df44211 796=item Oregon
4e860d0a 797
5df44211 798 ftp://ftp.orst.edu/pub/CPAN
4e860d0a 799
5df44211 800=item Pennsylvania
4e860d0a 801
5df44211
JH
802 http://ftp.epix.net/CPAN/
803 ftp://ftp.epix.net/pub/languages/perl/
804 http://mirrors.phenominet.com/pub/CPAN/
805 ftp://mirrors.phenominet.com/pub/CPAN/
806 http://cpan.pair.com/
807 ftp://cpan.pair.com/pub/CPAN/
808 ftp://carroll.cac.psu.edu/pub/CPAN/
4e860d0a 809
5df44211 810=item Tennessee
4e860d0a 811
5df44211 812 ftp://ftp.sunsite.utk.edu/pub/CPAN/
4e860d0a 813
5df44211 814=item Texas
4e860d0a 815
5df44211
JH
816 http://ftp.sedl.org/pub/mirrors/CPAN/
817 ftp://mirror.telentente.com/pub/CPAN
4e860d0a 818
5df44211 819=item Utah
4e860d0a 820
5df44211 821 ftp://mirror.xmission.com/CPAN/
4e860d0a 822
5df44211 823=item Virginia
4e860d0a 824
5df44211
JH
825 http://mirrors.rcn.net/pub/lang/CPAN/
826 ftp://mirrors.rcn.net/pub/lang/CPAN/
827 http://perl.secsup.org/
828 ftp://perl.secsup.org/pub/perl/
829 http://mirrors.phihost.com/CPAN/
830 ftp://mirrors.phihost.com/CPAN/
831 ftp://ruff.cs.jmu.edu/pub/CPAN/
832 http://perl.Liquidation.com/CPAN/
4e860d0a 833
5df44211 834=item ashington
4e860d0a 835
5df44211
JH
836 http://cpan.llarian.net/
837 ftp://cpan.llarian.net/pub/CPAN/
838 http://cpan.mirrorcentral.com/
839 ftp://ftp.mirrorcentral.com/pub/CPAN/
840 ftp://ftp-mirror.internap.com/pub/CPAN/
d4858812 841
5df44211 842=item Wisconsin
d4858812 843
5df44211
JH
844 http://mirror.sit.wisc.edu/pub/CPAN/
845 ftp://mirror.sit.wisc.edu/pub/CPAN/
4e860d0a
JH
846
847=back
848
849=head2 Oceania
850
851=over 4
852
5df44211 853=item Australia
4e860d0a 854
5df44211
JH
855 http://ftp.planetmirror.com/pub/CPAN/
856 ftp://ftp.planetmirror.com/pub/CPAN/
857 ftp://mirror.aarnet.edu.au/pub/perl/CPAN/
858 ftp://cpan.topend.com.au/pub/CPAN/
4e860d0a 859
5df44211 860=item New Zealand
d4858812 861
5df44211
JH
862 ftp://ftp.auckland.ac.nz/pub/perl/CPAN/
863 http://cpan.soa.co.nz/CPAN/
4e860d0a
JH
864
865=back
866
867=head2 South America
868
869=over 4
870
5df44211 871=item Argentina
4e860d0a 872
5df44211
JH
873 ftp://mirrors.bannerlandia.com.ar/mirrors/CPAN/
874 http://ftp.fcaglp.unlp.edu.ar/pub/CPAN/
875 ftp://ftp.fcaglp.unlp.edu.ar/pub/CPAN/
4e860d0a 876
5df44211 877=item Brazil
4e860d0a 878
5df44211
JH
879 ftp://cpan.pop-mg.com.br/pub/CPAN/
880 ftp://ftp.matrix.com.br/pub/perl/CPAN/
4e860d0a 881
5df44211 882=item Chile
4e860d0a 883
5df44211
JH
884 http://cpan.netglobalis.net/
885 ftp://cpan.netglobalis.net/pub/CPAN/
2e1d04bc
JH
886
887=back
888
5df44211
JH
889=head2 RSYNC Mirrors
890
891 ftp.fcaglp.unlp.edu.ar::CPAN
892 cpan.mirror.smartworker.org::CPAN
893 theoryx5.uwinnipeg.ca::CPAN
894 ftp.shellhung.org::CPAN
895 ftp.funet.fi::CPAN
896 ftp.u-paris10.fr::CPAN
897 mir1.ovh.net::CPAN
898 ftp.gwdg.de::FTP/languages/perl/CPAN/
899 ftp.leo.org::CPAN
900 CPAN.piksi.itb.ac.id::CPAN
901 ftp.cbn.net.id::CPAN
902 ftp.iglu.org.il::CPAN
903 gusp.dyndns.org::cpan
904 ftp.kddlabs.co.jp::cpan
905 ftp.ayamura.org::pub/CPAN/
906 mirror.averse.net::cpan
907 cpan.teleglobe.net::CPAN
908 ftp.sedl.org::cpan
909 archive.progeny.com::CPAN
910 cpan.teleglobe.net::CPAN
911 ftp.lug.udel.edu::cpan
912 mirrors.kernel.org::mirrors/CPAN
913 mirrors.phenominet.com::CPAN
914 mirror.csit.fsu.edu::CPAN
915 csociety-ftp.ecn.purdue.edu::CPAN
916
2e1d04bc 917For an up-to-date listing of CPAN sites,
4e860d0a 918see http://www.cpan.org/SITES or ftp://www.cpan.org/SITES .
2e1d04bc
JH
919
920=head1 Modules: Creation, Use, and Abuse
921
922(The following section is borrowed directly from Tim Bunce's modules
923file, available at your nearest CPAN site.)
924
925Perl implements a class using a package, but the presence of a
926package doesn't imply the presence of a class. A package is just a
927namespace. A class is a package that provides subroutines that can be
928used as methods. A method is just a subroutine that expects, as its
929first argument, either the name of a package (for "static" methods),
930or a reference to something (for "virtual" methods).
931
932A module is a file that (by convention) provides a class of the same
933name (sans the .pm), plus an import method in that class that can be
934called to fetch exported symbols. This module may implement some of
935its methods by loading dynamic C or C++ objects, but that should be
936totally transparent to the user of the module. Likewise, the module
937might set up an AUTOLOAD function to slurp in subroutine definitions on
938demand, but this is also transparent. Only the F<.pm> file is required to
939exist. See L<perlsub>, L<perltoot>, and L<AutoLoader> for details about
940the AUTOLOAD mechanism.
941
942=head2 Guidelines for Module Creation
943
944=over 4
945
ac634a9a
JH
946=item *
947
948Do similar modules already exist in some form?
2e1d04bc
JH
949
950If so, please try to reuse the existing modules either in whole or
951by inheriting useful features into a new class. If this is not
952practical try to get together with the module authors to work on
953extending or enhancing the functionality of the existing modules.
954A perfect example is the plethora of packages in perl4 for dealing
955with command line options.
956
957If you are writing a module to expand an already existing set of
958modules, please coordinate with the author of the package. It
959helps if you follow the same naming scheme and module interaction
960scheme as the original author.
961
ac634a9a
JH
962=item *
963
964Try to design the new module to be easy to extend and reuse.
2e1d04bc
JH
965
966Try to C<use warnings;> (or C<use warnings qw(...);>).
967Remember that you can add C<no warnings qw(...);> to individual blocks
968of code that need less warnings.
969
970Use blessed references. Use the two argument form of bless to bless
971into the class name given as the first parameter of the constructor,
972e.g.,:
973
974 sub new {
975 my $class = shift;
976 return bless {}, $class;
977 }
978
979or even this if you'd like it to be used as either a static
980or a virtual method.
981
982 sub new {
983 my $self = shift;
984 my $class = ref($self) || $self;
985 return bless {}, $class;
986 }
987
988Pass arrays as references so more parameters can be added later
989(it's also faster). Convert functions into methods where
990appropriate. Split large methods into smaller more flexible ones.
991Inherit methods from other modules if appropriate.
992
993Avoid class name tests like: C<die "Invalid" unless ref $ref eq 'FOO'>.
994Generally you can delete the C<eq 'FOO'> part with no harm at all.
995Let the objects look after themselves! Generally, avoid hard-wired
996class names as far as possible.
997
998Avoid C<< $r->Class::func() >> where using C<@ISA=qw(... Class ...)> and
999C<< $r->func() >> would work (see L<perlbot> for more details).
1000
1001Use autosplit so little used or newly added functions won't be a
1002burden to programs that don't use them. Add test functions to
1003the module after __END__ either using AutoSplit or by saying:
1004
1005 eval join('',<main::DATA>) || die $@ unless caller();
1006
1007Does your module pass the 'empty subclass' test? If you say
1008C<@SUBCLASS::ISA = qw(YOURCLASS);> your applications should be able
1009to use SUBCLASS in exactly the same way as YOURCLASS. For example,
1010does your application still work if you change: C<$obj = new YOURCLASS;>
1011into: C<$obj = new SUBCLASS;> ?
1012
1013Avoid keeping any state information in your packages. It makes it
1014difficult for multiple other packages to use yours. Keep state
1015information in objects.
1016
1017Always use B<-w>.
1018
1019Try to C<use strict;> (or C<use strict qw(...);>).
1020Remember that you can add C<no strict qw(...);> to individual blocks
1021of code that need less strictness.
1022
1023Always use B<-w>.
1024
1025Follow the guidelines in the perlstyle(1) manual.
1026
1027Always use B<-w>.
1028
ac634a9a
JH
1029=item *
1030
1031Some simple style guidelines
2e1d04bc
JH
1032
1033The perlstyle manual supplied with Perl has many helpful points.
1034
1035Coding style is a matter of personal taste. Many people evolve their
1036style over several years as they learn what helps them write and
1037maintain good code. Here's one set of assorted suggestions that
1038seem to be widely used by experienced developers:
1039
1040Use underscores to separate words. It is generally easier to read
1041$var_names_like_this than $VarNamesLikeThis, especially for
1042non-native speakers of English. It's also a simple rule that works
1043consistently with VAR_NAMES_LIKE_THIS.
1044
1045Package/Module names are an exception to this rule. Perl informally
1046reserves lowercase module names for 'pragma' modules like integer
1047and strict. Other modules normally begin with a capital letter and
1048use mixed case with no underscores (need to be short and portable).
1049
1050You may find it helpful to use letter case to indicate the scope
1051or nature of a variable. For example:
1052
1053 $ALL_CAPS_HERE constants only (beware clashes with Perl vars)
1054 $Some_Caps_Here package-wide global/static
1055 $no_caps_here function scope my() or local() variables
1056
1057Function and method names seem to work best as all lowercase.
1058e.g., C<< $obj->as_string() >>.
1059
1060You can use a leading underscore to indicate that a variable or
1061function should not be used outside the package that defined it.
1062
ac634a9a
JH
1063=item *
1064
1065Select what to export.
2e1d04bc
JH
1066
1067Do NOT export method names!
1068
1069Do NOT export anything else by default without a good reason!
1070
1071Exports pollute the namespace of the module user. If you must
1072export try to use @EXPORT_OK in preference to @EXPORT and avoid
1073short or common names to reduce the risk of name clashes.
1074
1075Generally anything not exported is still accessible from outside the
1076module using the ModuleName::item_name (or C<< $blessed_ref->method >>)
1077syntax. By convention you can use a leading underscore on names to
1078indicate informally that they are 'internal' and not for public use.
1079
1080(It is actually possible to get private functions by saying:
1081C<my $subref = sub { ... }; &$subref;>. But there's no way to call that
1082directly as a method, because a method must have a name in the symbol
1083table.)
1084
1085As a general rule, if the module is trying to be object oriented
1086then export nothing. If it's just a collection of functions then
1087@EXPORT_OK anything but use @EXPORT with caution.
1088
ac634a9a
JH
1089=item *
1090
1091Select a name for the module.
2e1d04bc
JH
1092
1093This name should be as descriptive, accurate, and complete as
1094possible. Avoid any risk of ambiguity. Always try to use two or
1095more whole words. Generally the name should reflect what is special
1096about what the module does rather than how it does it. Please use
1097nested module names to group informally or categorize a module.
1098There should be a very good reason for a module not to have a nested name.
1099Module names should begin with a capital letter.
1100
1101Having 57 modules all called Sort will not make life easy for anyone
1102(though having 23 called Sort::Quick is only marginally better :-).
1103Imagine someone trying to install your module alongside many others.
1104If in any doubt ask for suggestions in comp.lang.perl.misc.
1105
1106If you are developing a suite of related modules/classes it's good
1107practice to use nested classes with a common prefix as this will
1108avoid namespace clashes. For example: Xyz::Control, Xyz::View,
1109Xyz::Model etc. Use the modules in this list as a naming guide.
1110
1111If adding a new module to a set, follow the original author's
1112standards for naming modules and the interface to methods in
1113those modules.
1114
4844a3be
SP
1115If developing modules for private internal or project specific use,
1116that will never be released to the public, then you should ensure
1117that their names will not clash with any future public module. You
1118can do this either by using the reserved Local::* category or by
1119using a category name that includes an underscore like Foo_Corp::*.
1120
2e1d04bc
JH
1121To be portable each component of a module name should be limited to
112211 characters. If it might be used on MS-DOS then try to ensure each is
1123unique in the first 8 characters. Nested modules make this easier.
1124
ac634a9a
JH
1125=item *
1126
1127Have you got it right?
2e1d04bc
JH
1128
1129How do you know that you've made the right decisions? Have you
1130picked an interface design that will cause problems later? Have
1131you picked the most appropriate name? Do you have any questions?
1132
1133The best way to know for sure, and pick up many helpful suggestions,
1134is to ask someone who knows. Comp.lang.perl.misc is read by just about
1135all the people who develop modules and it's the best place to ask.
1136
1137All you need to do is post a short summary of the module, its
1138purpose and interfaces. A few lines on each of the main methods is
1139probably enough. (If you post the whole module it might be ignored
1140by busy people - generally the very people you want to read it!)
1141
1142Don't worry about posting if you can't say when the module will be
1143ready - just say so in the message. It might be worth inviting
1144others to help you, they may be able to complete it for you!
1145
ac634a9a
JH
1146=item *
1147
1148README and other Additional Files.
2e1d04bc
JH
1149
1150It's well known that software developers usually fully document the
1151software they write. If, however, the world is in urgent need of
1152your software and there is not enough time to write the full
1153documentation please at least provide a README file containing:
1154
1155=over 10
1156
1157=item *
ac634a9a 1158
2e1d04bc
JH
1159A description of the module/package/extension etc.
1160
1161=item *
ac634a9a 1162
2e1d04bc
JH
1163A copyright notice - see below.
1164
1165=item *
ac634a9a 1166
2e1d04bc
JH
1167Prerequisites - what else you may need to have.
1168
1169=item *
ac634a9a 1170
2e1d04bc
JH
1171How to build it - possible changes to Makefile.PL etc.
1172
1173=item *
ac634a9a 1174
2e1d04bc
JH
1175How to install it.
1176
1177=item *
ac634a9a 1178
2e1d04bc
JH
1179Recent changes in this release, especially incompatibilities
1180
1181=item *
ac634a9a 1182
2e1d04bc
JH
1183Changes / enhancements you plan to make in the future.
1184
1185=back
1186
1187If the README file seems to be getting too large you may wish to
1188split out some of the sections into separate files: INSTALL,
1189Copying, ToDo etc.
1190
1191=over 4
1192
c165c82a 1193=item *
2e1d04bc 1194
c165c82a 1195Adding a Copyright Notice.
ac634a9a 1196
2e1d04bc
JH
1197How you choose to license your work is a personal decision.
1198The general mechanism is to assert your Copyright and then make
1199a declaration of how others may copy/use/modify your work.
1200
1201Perl, for example, is supplied with two types of licence: The GNU
1202GPL and The Artistic Licence (see the files README, Copying, and
1203Artistic). Larry has good reasons for NOT just using the GNU GPL.
1204
1205My personal recommendation, out of respect for Larry, Perl, and the
1206Perl community at large is to state something simply like:
1207
1208 Copyright (c) 1995 Your Name. All rights reserved.
1209 This program is free software; you can redistribute it and/or
1210 modify it under the same terms as Perl itself.
1211
1212This statement should at least appear in the README file. You may
1213also wish to include it in a Copying file and your source files.
1214Remember to include the other words in addition to the Copyright.
1215
ac634a9a
JH
1216=item *
1217
1218Give the module a version/issue/release number.
2e1d04bc
JH
1219
1220To be fully compatible with the Exporter and MakeMaker modules you
1221should store your module's version number in a non-my package
1222variable called $VERSION. This should be a floating point
1223number with at least two digits after the decimal (i.e., hundredths,
1224e.g, C<$VERSION = "0.01">). Don't use a "1.3.2" style version.
1225See L<Exporter> for details.
1226
1227It may be handy to add a function or method to retrieve the number.
1228Use the number in announcements and archive file names when
1229releasing the module (ModuleName-1.02.tar.Z).
1230See perldoc ExtUtils::MakeMaker.pm for details.
1231
ac634a9a
JH
1232=item *
1233
1234How to release and distribute a module.
2e1d04bc
JH
1235
1236It's good idea to post an announcement of the availability of your
1237module (or the module itself if small) to the comp.lang.perl.announce
1238Usenet newsgroup. This will at least ensure very wide once-off
1239distribution.
1240
1241If possible, register the module with CPAN. You should
1242include details of its location in your announcement.
1243
1244Some notes about ftp archives: Please use a long descriptive file
1245name that includes the version number. Most incoming directories
1246will not be readable/listable, i.e., you won't be able to see your
1247file after uploading it. Remember to send your email notification
1248message as soon as possible after uploading else your file may get
1249deleted automatically. Allow time for the file to be processed
1250and/or check the file has been processed before announcing its
1251location.
1252
1253FTP Archives for Perl Modules:
1254
1255Follow the instructions and links on:
1256
4e860d0a
JH
1257 http://www.cpan.org/modules/00modlist.long.html
1258 http://www.cpan.org/modules/04pause.html
2e1d04bc
JH
1259
1260or upload to one of these sites:
1261
1262 https://pause.kbx.de/pause/
1263 http://pause.perl.org/pause/
1264
1265and notify <modules@perl.org>.
1266
1267By using the WWW interface you can ask the Upload Server to mirror
1268your modules from your ftp or WWW site into your own directory on
1269CPAN!
1270
1271Please remember to send me an updated entry for the Module list!
1272
ac634a9a
JH
1273=item *
1274
1275Take care when changing a released module.
2e1d04bc
JH
1276
1277Always strive to remain compatible with previous released versions.
1278Otherwise try to add a mechanism to revert to the
1279old behavior if people rely on it. Document incompatible changes.
1280
1281=back
1282
1283=back
1284
1285=head2 Guidelines for Converting Perl 4 Library Scripts into Modules
1286
1287=over 4
1288
ac634a9a
JH
1289=item *
1290
1291There is no requirement to convert anything.
2e1d04bc
JH
1292
1293If it ain't broke, don't fix it! Perl 4 library scripts should
1294continue to work with no problems. You may need to make some minor
1295changes (like escaping non-array @'s in double quoted strings) but
1296there is no need to convert a .pl file into a Module for just that.
1297
ac634a9a
JH
1298=item *
1299
1300Consider the implications.
2e1d04bc
JH
1301
1302All Perl applications that make use of the script will need to
1303be changed (slightly) if the script is converted into a module. Is
1304it worth it unless you plan to make other changes at the same time?
1305
ac634a9a
JH
1306=item *
1307
1308Make the most of the opportunity.
2e1d04bc
JH
1309
1310If you are going to convert the script to a module you can use the
1311opportunity to redesign the interface. The guidelines for module
1312creation above include many of the issues you should consider.
1313
ac634a9a
JH
1314=item *
1315
1316The pl2pm utility will get you started.
2e1d04bc
JH
1317
1318This utility will read *.pl files (given as parameters) and write
1319corresponding *.pm files. The pl2pm utilities does the following:
1320
1321=over 10
1322
1323=item *
ac634a9a 1324
2e1d04bc
JH
1325Adds the standard Module prologue lines
1326
1327=item *
ac634a9a 1328
2e1d04bc
JH
1329Converts package specifiers from ' to ::
1330
1331=item *
ac634a9a 1332
2e1d04bc
JH
1333Converts die(...) to croak(...)
1334
1335=item *
ac634a9a 1336
2e1d04bc
JH
1337Several other minor changes
1338
1339=back
1340
1341Being a mechanical process pl2pm is not bullet proof. The converted
1342code will need careful checking, especially any package statements.
1343Don't delete the original .pl file till the new .pm one works!
1344
1345=back
1346
1347=head2 Guidelines for Reusing Application Code
1348
1349=over 4
1350
ac634a9a
JH
1351=item *
1352
1353Complete applications rarely belong in the Perl Module Library.
1354
1355=item *
2e1d04bc 1356
ac634a9a 1357Many applications contain some Perl code that could be reused.
2e1d04bc
JH
1358
1359Help save the world! Share your code in a form that makes it easy
1360to reuse.
1361
ac634a9a
JH
1362=item *
1363
1364Break-out the reusable code into one or more separate module files.
1365
1366=item *
1367
1368Take the opportunity to reconsider and redesign the interfaces.
2e1d04bc 1369
ac634a9a 1370=item *
2e1d04bc 1371
ac634a9a 1372In some cases the 'application' can then be reduced to a small
2e1d04bc
JH
1373
1374fragment of code built on top of the reusable modules. In these cases
1375the application could invoked as:
1376
1377 % perl -e 'use Module::Name; method(@ARGV)' ...
1378or
1379 % perl -mModule::Name ... (in perl5.002 or higher)
1380
1381=back
1382
1383=head1 NOTE
1384
1385Perl does not enforce private and public parts of its modules as you may
1386have been used to in other languages like C++, Ada, or Modula-17. Perl
1387doesn't have an infatuation with enforced privacy. It would prefer
1388that you stayed out of its living room because you weren't invited, not
1389because it has a shotgun.
1390
1391The module and its user have a contract, part of which is common law,
1392and part of which is "written". Part of the common law contract is
1393that a module doesn't pollute any namespace it wasn't asked to. The
1394written contract for the module (A.K.A. documentation) may make other
1395provisions. But then you know when you C<use RedefineTheWorld> that
1396you're redefining the world and willing to take the consequences.
1397EOF
1398
1399close MANIFEST or warn "$0: failed to close MANIFEST (../MANIFEST): $!";
1400close OUT or warn "$0: failed to close OUT (perlmodlib.tmp): $!";
1401