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