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