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