Integrate against change 9670 aka perl-5.7.1
[p5sagit/p5-mst-13.2.git] / pod / perlmodlib.pod
CommitLineData
4e860d0a 1# Generated by perlmodlib.PL DO NOT EDIT!
2
f102b883 3=head1 NAME
4
5perlmodlib - constructing new Perl modules and finding existing ones
6
7=head1 DESCRIPTION
8
9=head1 THE PERL MODULE LIBRARY
10
19799a22 11Many modules are included the Perl distribution. These are described
12below, and all end in F<.pm>. You may discover compiled library
13file (usually ending in F<.so>) or small pieces of modules to be
14autoloaded (ending in F<.al>); these were automatically generated
15by the installation process. You may also discover files in the
16library directory that end in either F<.pl> or F<.ph>. These are
17old libraries supplied so that old programs that use them still
18run. The F<.pl> files will all eventually be converted into standard
19modules, and the F<.ph> files made by B<h2ph> will probably end up
20as extension modules made by B<h2xs>. (Some F<.ph> values may
21already be available through the POSIX, Errno, or Fcntl modules.)
22The B<pl2pm> file in the distribution may help in your conversion,
23but it's just a mechanical process and therefore far from bulletproof.
f102b883 24
25=head2 Pragmatic Modules
26
19799a22 27They work somewhat like compiler directives (pragmata) in that they
28tend to affect the compilation of your program, and thus will usually
29work well only when used within a C<use>, or C<no>. Most of these
30are lexically scoped, so an inner BLOCK may countermand them
31by saying:
f102b883 32
33 no integer;
34 no strict 'refs';
4438c4b7 35 no warnings;
f102b883 36
37which lasts until the end of that BLOCK.
38
19799a22 39Some pragmas are lexically scoped--typically those that affect the
40C<$^H> hints variable. Others affect the current package instead,
77ca0c92 41like C<use vars> and C<use subs>, which allow you to predeclare a
19799a22 42variables or subroutines within a particular I<file> rather than
43just a block. Such declarations are effective for the entire file
44for which they were declared. You cannot rescind them with C<no
45vars> or C<no subs>.
f102b883 46
47The following pragmas are defined (and have their own documentation).
48
49=over 12
50
09bef843 51=item attributes
52
9e107c59 53Get/set subroutine or variable attributes
09bef843 54
19799a22 55=item attrs
f102b883 56
9e107c59 57Set/get attributes of a subroutine (deprecated)
19799a22 58
59=item autouse
60
9e107c59 61Postpone load of modules until a function is used
19799a22 62
63=item base
64
65Establish IS-A relationship with base class at compile time
f102b883 66
67=item blib
68
19799a22 69Use MakeMaker's uninstalled version of a package
70
2e1d04bc 71=item bytes
9e107c59 72
2e1d04bc 73Force byte semantics rather than character semantics
9e107c59 74
75=item charnames
76
77Define character names for C<\N{named}> string literal escape.
78
19799a22 79=item constant
80
9e107c59 81Declare constants
f102b883 82
83=item diagnostics
84
2e1d04bc 85Perl compiler pragma to force verbose warning diagnostics
19799a22 86
87=item fields
88
2e1d04bc 89Compile-time class fields
19799a22 90
91=item filetest
92
2e1d04bc 93Control the filetest permission operators
f102b883 94
95=item integer
96
4e860d0a 97Use integer arithmetic instead of floating point
f102b883 98
99=item less
100
2e1d04bc 101Request less of something from the compiler
f102b883 102
f102b883 103=item locale
104
2e1d04bc 105Use and avoid POSIX locales for built-in operations
106
107=item open
108
109Set default disciplines for input and output
f102b883 110
111=item ops
112
9e107c59 113Restrict unsafe operations when compiling
f102b883 114
115=item overload
116
2e1d04bc 117Package for overloading perl operations
f102b883 118
b3eb6a9b 119=item re
120
2e1d04bc 121Alter regular expression behaviour
b3eb6a9b 122
f102b883 123=item sigtrap
124
9e107c59 125Enable simple signal handling
f102b883 126
127=item strict
128
9e107c59 129Restrict unsafe constructs
f102b883 130
131=item subs
132
2e1d04bc 133Predeclare sub names
f102b883 134
4e860d0a 135=item unicode::distinct
136
137Strictly distinguish UTF8 data and non-UTF data.
138
19799a22 139=item utf8
f102b883 140
2e1d04bc 141Enable/disable UTF-8 in source code
f102b883 142
143=item vars
144
2e1d04bc 145Predeclare global variable names (obsolete)
f102b883 146
4438c4b7 147=item warnings
0453d815 148
9e107c59 149Control optional warnings
19799a22 150
13a2d996 151=item warnings::register
152
153Warnings import function
154
f102b883 155=back
156
157=head2 Standard Modules
158
159Standard, bundled modules are all expected to behave in a well-defined
160manner with respect to namespace pollution because they use the
161Exporter module. See their own documentation for details.
162
163=over 12
164
165=item AnyDBM_File
166
2e1d04bc 167Provide framework for multiple DBMs
f102b883 168
169=item AutoLoader
170
9e107c59 171Load subroutines only on demand
f102b883 172
173=item AutoSplit
174
9e107c59 175Split a package for autoloading
f102b883 176
19799a22 177=item B
178
2e1d04bc 179The Perl Compiler
19799a22 180
181=item B::Asmdata
182
183Autogenerated data about Perl ops, used to generate bytecode
184
185=item B::Assembler
186
187Assemble Perl bytecode
188
189=item B::Bblock
190
191Walk basic blocks
192
193=item B::Bytecode
194
195Perl compiler's bytecode backend
196
197=item B::C
198
199Perl compiler's C backend
200
201=item B::CC
202
203Perl compiler's optimized C translation backend
204
4e860d0a 205=item B::Concise
206
207Walk Perl syntax tree, printing concise info about ops
208
19799a22 209=item B::Debug
210
211Walk Perl syntax tree, printing debug info about ops
212
213=item B::Deparse
214
2e1d04bc 215Perl compiler backend to produce perl code
19799a22 216
217=item B::Disassembler
218
219Disassemble Perl bytecode
220
221=item B::Lint
222
2e1d04bc 223Perl lint
19799a22 224
225=item B::Showlex
226
227Show lexical variables used in functions or files
228
229=item B::Stackobj
230
231Helper module for CC backend
232
13a2d996 233=item B::Stash
234
235Show what stashes are loaded
236
19799a22 237=item B::Terse
238
239Walk Perl syntax tree, printing terse info about ops
240
241=item B::Xref
242
243Generates cross reference reports for Perl programs
244
f102b883 245=item Benchmark
246
2e1d04bc 247Benchmark running times of Perl code
9e107c59 248
249=item ByteLoader
250
2e1d04bc 251Load byte compiled perl code
f102b883 252
19799a22 253=item CGI
254
2e1d04bc 255Simple Common Gateway Interface Class
19799a22 256
257=item CGI::Apache
258
2e1d04bc 259Backward compatibility module for CGI.pm
19799a22 260
261=item CGI::Carp
262
263CGI routines for writing to the HTTPD (or other) error log
264
265=item CGI::Cookie
266
267Interface to Netscape Cookies
268
269=item CGI::Fast
270
271CGI Interface for Fast CGI
272
9e107c59 273=item CGI::Pretty
274
275Module to produce nicely formatted HTML code
276
19799a22 277=item CGI::Push
278
279Simple Interface to Server Push
280
281=item CGI::Switch
282
2e1d04bc 283Backward compatibility module for defunct CGI::Switch
19799a22 284
4e860d0a 285=item CGI::Util
286
287Internal utilities used by CGI module
288
f102b883 289=item CPAN
290
2e1d04bc 291Query, download and build perl modules from CPAN sites
f102b883 292
293=item CPAN::FirstTime
294
2e1d04bc 295Utility for CPAN::Config file Initialization
f102b883 296
297=item CPAN::Nox
298
19799a22 299Wrapper around CPAN.pm without using any XS module
f102b883 300
301=item Carp
302
2e1d04bc 303Warn of errors (from perspective of caller)
9e107c59 304
4e860d0a 305=item Carp::Heavy
306
307No user serviceable parts inside
308
309=item Class::ISA
310
311Report the search path for a class's ISA tree
312
f102b883 313=item Class::Struct
314
9e107c59 315Declare struct-like datatypes as Perl classes
f102b883 316
f102b883 317=item Cwd
318
9e107c59 319Get pathname of current working directory
f102b883 320
19799a22 321=item DB
322
2e1d04bc 323Programmatic interface to the Perl debugging API (draft, subject to
19799a22 324
f102b883 325=item DB_File
326
19799a22 327Perl5 access to Berkeley DB version 1.x
328
f102b883 329=item Devel::SelfStubber
330
9e107c59 331Generate stubs for a SelfLoading module
f102b883 332
4e860d0a 333=item Digest
334
335Modules that calculate message digests
336
f102b883 337=item DirHandle
338
9e107c59 339Supply object methods for directory handles
f102b883 340
19799a22 341=item Dumpvalue
342
2e1d04bc 343Provides screen dump of Perl data.
f102b883 344
13a2d996 345=item Encode
346
347Character encodings
348
4e860d0a 349=item Encode::EncodeFormat
350
351The format of encoding tables of the Encode extension
352
353=item Encode::Tcl
354
355Tcl encodings
356
f102b883 357=item English
358
2e1d04bc 359Use nice English (or awk) names for ugly punctuation variables
f102b883 360
361=item Env
362
2e1d04bc 363Perl module that imports environment variables as scalars or arrays
f102b883 364
365=item Exporter
366
2e1d04bc 367Implements default import method for modules
9e107c59 368
369=item Exporter::Heavy
370
371Exporter guts
19799a22 372
373=item ExtUtils::Command
374
2e1d04bc 375Utilities to replace common UNIX commands in Makefiles etc.
f102b883 376
377=item ExtUtils::Embed
378
2e1d04bc 379Utilities for embedding Perl in C/C++ applications
f102b883 380
381=item ExtUtils::Install
382
9e107c59 383Install files from here to there
f102b883 384
19799a22 385=item ExtUtils::Installed
386
387Inventory management of installed modules
388
f102b883 389=item ExtUtils::Liblist
390
9e107c59 391Determine libraries to use and how to use them
392
393=item ExtUtils::MM_Cygwin
394
2e1d04bc 395Methods to override UN*X behaviour in ExtUtils::MakeMaker
f102b883 396
397=item ExtUtils::MM_OS2
398
2e1d04bc 399Methods to override UN*X behaviour in ExtUtils::MakeMaker
f102b883 400
401=item ExtUtils::MM_Unix
402
9e107c59 403Methods used by ExtUtils::MakeMaker
f102b883 404
405=item ExtUtils::MM_VMS
406
2e1d04bc 407Methods to override UN*X behaviour in ExtUtils::MakeMaker
19799a22 408
409=item ExtUtils::MM_Win32
410
2e1d04bc 411Methods to override UN*X behaviour in ExtUtils::MakeMaker
f102b883 412
413=item ExtUtils::MakeMaker
414
9e107c59 415Create an extension Makefile
f102b883 416
417=item ExtUtils::Manifest
418
9e107c59 419Utilities to write and check a MANIFEST file
f102b883 420
421=item ExtUtils::Mkbootstrap
422
9e107c59 423Make a bootstrap file for use by DynaLoader
f102b883 424
425=item ExtUtils::Mksymlists
426
9e107c59 427Write linker options files for dynamic extension
f102b883 428
19799a22 429=item ExtUtils::Packlist
430
9e107c59 431Manage .packlist files
19799a22 432
f102b883 433=item ExtUtils::testlib
434
9e107c59 435Add blib/* directories to @INC
f102b883 436
b6c543e3 437=item Fatal
438
9e107c59 439Replace functions with equivalents which succeed or die
b6c543e3 440
f102b883 441=item Fcntl
442
2e1d04bc 443Load the C Fcntl.h defines
f102b883 444
445=item File::Basename
446
9e107c59 447Split a pathname into pieces
448
449=item File::CheckTree
450
451Run many filetest checks on a tree
f102b883 452
f102b883 453=item File::Compare
454
19799a22 455Compare files or filehandles
f102b883 456
457=item File::Copy
458
19799a22 459Copy files or filehandles
460
461=item File::DosGlob
462
2e1d04bc 463DOS like globbing and then some
f102b883 464
465=item File::Find
466
2e1d04bc 467Traverse a file tree
f102b883 468
469=item File::Path
470
2e1d04bc 471Create or remove directory trees
f102b883 472
f505c983 473=item File::Spec
474
9e107c59 475Portably perform operations on file names
f505c983 476
165c0277 477=item File::Spec::Epoc
478
479Methods for Epoc file specs
480
f505c983 481=item File::Spec::Functions
482
9e107c59 483Portably perform operations on file names
19799a22 484
485=item File::Spec::Mac
486
487File::Spec for MacOS
488
489=item File::Spec::OS2
490
9e107c59 491Methods for OS/2 file specs
19799a22 492
493=item File::Spec::Unix
494
9e107c59 495Methods used by File::Spec
19799a22 496
497=item File::Spec::VMS
498
9e107c59 499Methods for VMS file specs
19799a22 500
501=item File::Spec::Win32
502
9e107c59 503Methods for Win32 file specs
f505c983 504
2e1d04bc 505=item File::Temp
506
507Return name and handle of a temporary file safely
508
f102b883 509=item File::stat
510
9e107c59 511By-name interface to Perl's built-in stat() functions
f102b883 512
513=item FileCache
514
9e107c59 515Keep more files open than the system permits
f102b883 516
517=item FileHandle
518
9e107c59 519Supply object methods for filehandles
f102b883 520
165c0277 521=item Filter::Simple
522
523Simplified source filtering
524
f102b883 525=item FindBin
526
2e1d04bc 527Locate directory of original perl script
f102b883 528
529=item Getopt::Long
530
9e107c59 531Extended processing of command line options
f102b883 532
533=item Getopt::Std
534
19799a22 535Process single-character switches with switch clustering
f102b883 536
537=item I18N::Collate
538
2e1d04bc 539Compare 8-bit scalar data according to the current locale
f102b883 540
541=item IO
542
2e1d04bc 543Load various IO modules
f102b883 544
545=item IPC::Open2
546
9e107c59 547Open a process for both reading and writing
f102b883 548
549=item IPC::Open3
550
9e107c59 551Open a process for reading, writing, and error handling
f102b883 552
4e860d0a 553=item Locale::Constants
554
555Constants for Locale codes
556
557=item Locale::Country
558
559ISO codes for country identification (ISO 3166)
560
561=item Locale::Currency
562
563ISO three letter codes for currency identification (ISO 4217)
564
565=item Locale::Language
566
567ISO two letter codes for language identification (ISO 639)
568
f102b883 569=item Math::BigFloat
570
19799a22 571Arbitrary length float math package
f102b883 572
573=item Math::BigInt
574
19799a22 575Arbitrary size integer math package
f102b883 576
577=item Math::Complex
578
9e107c59 579Complex numbers and associated mathematical functions
f102b883 580
404b15a1 581=item Math::Trig
582
9e107c59 583Trigonometric functions
f102b883 584
2e1d04bc 585=item NDBM_File
586
587Tied access to ndbm files
588
f102b883 589=item Net::Ping
590
9e107c59 591Check a remote host for reachability
f102b883 592
593=item Net::hostent
594
9e107c59 595By-name interface to Perl's built-in gethost*() functions
f102b883 596
597=item Net::netent
598
9e107c59 599By-name interface to Perl's built-in getnet*() functions
f102b883 600
601=item Net::protoent
602
9e107c59 603By-name interface to Perl's built-in getproto*() functions
f102b883 604
605=item Net::servent
606
9e107c59 607By-name interface to Perl's built-in getserv*() functions
f102b883 608
19799a22 609=item O
f102b883 610
19799a22 611Generic interface to Perl Compiler backends
f102b883 612
2e1d04bc 613=item ODBM_File
f102b883 614
2e1d04bc 615Tied access to odbm files
f102b883 616
2e1d04bc 617=item Opcode
f102b883 618
2e1d04bc 619Disable named opcodes when compiling perl code
19799a22 620
4e860d0a 621=item POSIX
622
623Perl interface to IEEE Std 1003.1
624
625=item PerlIO
626
627On demand loader for PerlIO layers and root of PerlIO::* name space
628
9e107c59 629=item Pod::Checker
630
631Check pod documents for syntax errors
632
2e1d04bc 633=item Pod::Find
634
635Find POD documents in directory trees
636
19799a22 637=item Pod::Html
638
9e107c59 639Module to convert pod files to HTML
640
641=item Pod::InputObjects
642
2e1d04bc 643Objects representing POD input paragraphs, commands, etc.
9e107c59 644
13a2d996 645=item Pod::LaTeX
646
647Convert Pod data to formatted Latex
648
9e107c59 649=item Pod::Man
650
651Convert POD data to formatted *roff input
652
2e1d04bc 653=item Pod::ParseUtils
654
655Helpers for POD parsing and conversion
656
9e107c59 657=item Pod::Parser
658
659Base class for creating POD filters and translators
660
2e1d04bc 661=item Pod::Plainer
662
663Perl extension for converting Pod to old style Pod.
664
9e107c59 665=item Pod::Select
666
667Extract selected sections of POD from input
19799a22 668
669=item Pod::Text
670
9e107c59 671Convert POD data to formatted ASCII text
672
673=item Pod::Text::Color
674
675Convert POD data to formatted color ASCII text
676
4e860d0a 677=item Pod::Text::Overstrike
678
679Convert POD data to formatted overstrike text
680
2e1d04bc 681=item Pod::Text::Termcap
682
683Convert POD data to ASCII text with format escapes
684
9e107c59 685=item Pod::Usage
686
687Print a usage message from embedded pod documentation
f102b883 688
689=item SDBM_File
690
19799a22 691Tied access to sdbm files
f102b883 692
693=item Safe
694
19799a22 695Compile and execute code in restricted compartments
f102b883 696
697=item Search::Dict
698
9e107c59 699Search for key in dictionary file
f102b883 700
701=item SelectSaver
702
9e107c59 703Save and restore selected file handle
f102b883 704
705=item SelfLoader
706
9e107c59 707Load functions only on demand
f102b883 708
709=item Shell
710
2e1d04bc 711Run shell commands transparently within perl
f102b883 712
713=item Socket
714
2e1d04bc 715Load the C socket.h defines and structure manipulators
f102b883 716
13a2d996 717=item Storable
718
719Persistency for perl data structures
720
4e860d0a 721=item Switch
722
723A switch statement for Perl
724
f102b883 725=item Symbol
726
9e107c59 727Manipulate Perl symbols and their names
f102b883 728
2e1d04bc 729=item Term::ANSIColor
f102b883 730
2e1d04bc 731Color screen output using ANSI escape sequences
f102b883 732
733=item Term::Cap
734
2e1d04bc 735Perl termcap interface
f102b883 736
737=item Term::Complete
738
2e1d04bc 739Perl word completion module
f102b883 740
741=item Term::ReadLine
742
2e1d04bc 743Perl interface to various C<readline> packages. If
19799a22 744
745=item Test
746
9e107c59 747Provides a simple framework for writing test scripts
f102b883 748
749=item Test::Harness
750
2e1d04bc 751Run perl standard test scripts with statistics
f102b883 752
753=item Text::Abbrev
754
9e107c59 755Create an abbreviation table from a list
f102b883 756
4e860d0a 757=item Text::Balanced
758
759Extract delimited text sequences from strings.
760
f102b883 761=item Text::ParseWords
762
2e1d04bc 763Parse text into an array of tokens or array of arrays
f102b883 764
765=item Text::Soundex
766
2e1d04bc 767Implementation of the Soundex Algorithm as Described by Knuth
f102b883 768
4e860d0a 769=item Text::Tabs
770
771Expand and unexpand tabs per the unix expand(1) and unexpand(1)
772
f102b883 773=item Text::Wrap
774
9e107c59 775Line wrapping to form simple paragraphs
19799a22 776
777=item Tie::Array
778
9e107c59 779Base class for tied arrays
19799a22 780
781=item Tie::Handle
782
9e107c59 783Base class definitions for tied handles
19799a22 784
9e107c59 785=item Tie::Hash
f102b883 786
9e107c59 787Base class definitions for tied hashes
f102b883 788
789=item Tie::RefHash
790
9e107c59 791Use references as hash keys
f102b883 792
9e107c59 793=item Tie::Scalar
f102b883 794
9e107c59 795Base class definitions for tied scalars
f102b883 796
797=item Tie::SubstrHash
798
19799a22 799Fixed-table-size, fixed-key-length hashing
f102b883 800
801=item Time::Local
802
9e107c59 803Efficiently compute time from local and GMT time
f102b883 804
805=item Time::gmtime
806
9e107c59 807By-name interface to Perl's built-in gmtime() function
f102b883 808
809=item Time::localtime
810
9e107c59 811By-name interface to Perl's built-in localtime() function
f102b883 812
813=item Time::tm
814
9e107c59 815Internal object used by Time::gmtime and Time::localtime
f102b883 816
817=item UNIVERSAL
818
9e107c59 819Base class for ALL classes (blessed references)
f102b883 820
821=item User::grent
822
9e107c59 823By-name interface to Perl's built-in getgr*() functions
f102b883 824
825=item User::pwent
826
9e107c59 827By-name interface to Perl's built-in getpw*() functions
f102b883 828
4e860d0a 829=item Win32
830
831Interfaces to some Win32 API Functions
832
f102b883 833=back
834
19799a22 835To find out I<all> modules installed on your system, including
2e1d04bc 836those without documentation or outside the standard release,
b1866b2d 837just do this:
f102b883 838
5a964f20 839 % find `perl -e 'print "@INC"'` -name '*.pm' -print
f102b883 840
2e1d04bc 841They should all have their own documentation installed and accessible
842via your system man(1) command. If you do not have a B<find>
19799a22 843program, you can use the Perl B<find2perl> program instead, which
844generates Perl code as output you can run through perl. If you
845have a B<man> program but it doesn't find your modules, you'll have
2e1d04bc 846to fix your manpath. See L<perl> for details. If you have no
847system B<man> command, you might try the B<perldoc> program.
f102b883 848
849=head2 Extension Modules
850
19799a22 851Extension modules are written in C (or a mix of Perl and C). They
852are usually dynamically loaded into Perl if and when you need them,
2e1d04bc 853but may also be be linked in statically. Supported extension modules
19799a22 854include Socket, Fcntl, and POSIX.
f102b883 855
856Many popular C extension modules do not come bundled (at least, not
19799a22 857completely) due to their sizes, volatility, or simply lack of time
858for adequate testing and configuration across the multitude of
859platforms on which Perl was beta-tested. You are encouraged to
860look for them on CPAN (described below), or using web search engines
861like Alta Vista or Deja News.
f102b883 862
863=head1 CPAN
864
19799a22 865CPAN stands for Comprehensive Perl Archive Network; it's a globally
866replicated trove of Perl materials, including documentation, style
2e1d04bc 867guides, tricks and traps, alternate ports to non-Unix systems and
19799a22 868occasional binary distributions for these. Search engines for
869CPAN can be found at http://cpan.perl.com/ and at
870http://theory.uwinnipeg.ca/mod_perl/cpan-search.pl .
871
872Most importantly, CPAN includes around a thousand unbundled modules,
873some of which require a C compiler to build. Major categories of
874modules are:
f102b883 875
4e860d0a 876=over
f102b883 877
878=item *
551e1d92 879
f102b883 880Language Extensions and Documentation Tools
881
882=item *
551e1d92 883
f102b883 884Development Support
885
886=item *
551e1d92 887
f102b883 888Operating System Interfaces
889
890=item *
551e1d92 891
f102b883 892Networking, Device Control (modems) and InterProcess Communication
893
894=item *
551e1d92 895
f102b883 896Data Types and Data Type Utilities
897
898=item *
551e1d92 899
f102b883 900Database Interfaces
901
902=item *
551e1d92 903
f102b883 904User Interfaces
905
906=item *
551e1d92 907
f102b883 908Interfaces to / Emulations of Other Programming Languages
909
910=item *
551e1d92 911
f102b883 912File Names, File Systems and File Locking (see also File Handles)
913
914=item *
551e1d92 915
f102b883 916String Processing, Language Text Processing, Parsing, and Searching
917
918=item *
551e1d92 919
f102b883 920Option, Argument, Parameter, and Configuration File Processing
921
922=item *
551e1d92 923
f102b883 924Internationalization and Locale
925
926=item *
551e1d92 927
f102b883 928Authentication, Security, and Encryption
929
930=item *
551e1d92 931
f102b883 932World Wide Web, HTML, HTTP, CGI, MIME
933
934=item *
551e1d92 935
f102b883 936Server and Daemon Utilities
937
938=item *
551e1d92 939
f102b883 940Archiving and Compression
941
942=item *
551e1d92 943
f102b883 944Images, Pixmap and Bitmap Manipulation, Drawing, and Graphing
945
946=item *
551e1d92 947
f102b883 948Mail and Usenet News
949
950=item *
551e1d92 951
f102b883 952Control Flow Utilities (callbacks and exceptions etc)
953
954=item *
551e1d92 955
f102b883 956File Handle and Input/Output Stream Utilities
957
958=item *
551e1d92 959
f102b883 960Miscellaneous Modules
961
962=back
963
19799a22 964Registered CPAN sites as of this writing include the following.
f102b883 965You should try to choose one close to you:
966
4e860d0a 967=head2 Africa
968
cea6626f 969=over 4
f102b883 970
4e860d0a 971=item *
972
973South Africa
974
975 ftp://ftp.is.co.za/programming/perl/CPAN/
976 ftp://ftp.saix.net/pub/CPAN/
977 ftp://ftpza.co.za/pub/mirrors/cpan/
978 ftp://ftp.sun.ac.za/CPAN/
979
980=back
981
982=head2 Asia
983
984=over 4
985
986=item *
987
988China
989
990 ftp://freesoft.cei.gov.cn/pub/languages/perl/CPAN/
991 http://www2.linuxforum.net/mirror/CPAN/
992 http://cpan.shellhung.org/
993 ftp://ftp.shellhung.org/pub/CPAN
994
995=item *
996
997Hong Kong
998
999 http://CPAN.pacific.net.hk/
1000 ftp://ftp.pacific.net.hk/pub/mirror/CPAN/
1001
1002=item *
1003
1004Indonesia
1005
1006 http://piksi.itb.ac.id/CPAN/
1007 ftp://mirrors.piksi.itb.ac.id/CPAN/
1008 http://CPAN.mweb.co.id/
1009 ftp://ftp.mweb.co.id/pub/languages/perl/CPAN/
1010
1011=item *
1012
1013Israel
1014
1015 http://www.iglu.org.il:/pub/CPAN/
1016 ftp://ftp.iglu.org.il/pub/CPAN/
1017 http://bioinfo.weizmann.ac.il/pub/software/perl/CPAN/
1018 ftp://bioinfo.weizmann.ac.il/pub/software/perl/CPAN/
1019
1020=item *
1021
1022Japan
1023
1024 ftp://ftp.u-aizu.ac.jp/pub/lang/perl/CPAN/
1025 ftp://ftp.kddlabs.co.jp/CPAN/
1026 http://mirror.nucba.ac.jp/mirror/Perl/
1027 ftp://mirror.nucba.ac.jp/mirror/Perl/
1028 ftp://ftp.meisei-u.ac.jp/pub/CPAN/
1029 ftp://ftp.jaist.ac.jp/pub/lang/perl/CPAN/
1030 ftp://ftp.dti.ad.jp/pub/lang/CPAN/
1031 ftp://ftp.ring.gr.jp/pub/lang/perl/CPAN/
1032
1033=item *
1034
1035Saudi Arabia
1036
1037 ftp://ftp.isu.net.sa/pub/CPAN/
1038
1039=item *
1040
1041Singapore
1042
1043 http://cpan.hjc.edu.sg
1044 http://ftp.nus.edu.sg/unix/perl/CPAN/
1045 ftp://ftp.nus.edu.sg/pub/unix/perl/CPAN/
1046
1047=item *
1048
1049South Korea
1050
1051 http://CPAN.bora.net/
1052 ftp://ftp.bora.net/pub/CPAN/
1053 http://ftp.kornet.net/CPAN/
1054 ftp://ftp.kornet.net/pub/CPAN/
1055 ftp://ftp.nuri.net/pub/CPAN/
1056
1057=item *
1058
1059Taiwan
1060
1061 ftp://coda.nctu.edu.tw/UNIX/perl/CPAN
1062 ftp://ftp.ee.ncku.edu.tw/pub/perl/CPAN/
1063 ftp://ftp1.sinica.edu.tw/pub1/perl/CPAN/
1064
1065=item *
1066
1067Thailand
1068
1069 http://download.nectec.or.th/CPAN/
1070 ftp://ftp.nectec.or.th/pub/languages/CPAN/
1071 ftp://ftp.cs.riubon.ac.th/pub/mirrors/CPAN/
1072
1073=back
1074
1075=head2 Central America
1076
1077=over 4
1078
1079=item *
1080
1081Costa Rica
1082
1083 ftp://ftp.linux.co.cr/mirrors/CPAN/
1084 http://ftp.ucr.ac.cr/Unix/CPAN/
1085 ftp://ftp.ucr.ac.cr/pub/Unix/CPAN/
1086
1087=back
1088
1089=head2 Europe
1090
1091=over 4
1092
1093=item *
1094
1095Austria
1096
1097 ftp://ftp.tuwien.ac.at/pub/languages/perl/CPAN/
1098
1099=item *
1100
1101Belgium
1102
1103 http://ftp.easynet.be/CPAN/
1104 ftp://ftp.easynet.be/CPAN/
1105 ftp://ftp.kulnet.kuleuven.ac.be/pub/mirror/CPAN/
1106
1107=item *
1108
1109Bulgaria
1110
1111 ftp://ftp.ntrl.net/pub/mirrors/CPAN/
1112
1113=item *
1114
1115Croatia
1116
1117 ftp://ftp.linux.hr/pub/CPAN/
1118
1119=item *
1120
1121Czech Republic
1122
1123 http://www.fi.muni.cz/pub/perl/
1124 ftp://ftp.fi.muni.cz/pub/perl/
1125 ftp://sunsite.mff.cuni.cz/MIRRORS/ftp.funet.fi/pub/languages/perl/CPAN/
1126
1127=item *
1128
1129Denmark
1130
1131 ftp://sunsite.auc.dk/pub/languages/perl/CPAN/
1132 http://www.cpan.dk/CPAN/
1133 ftp://www.cpan.dk/ftp.cpan.org/CPAN/
1134
1135=item *
1136
1137England
1138
1139 http://www.mirror.ac.uk/sites/ftp.funet.fi/pub/languages/perl/CPAN
1140 ftp://ftp.mirror.ac.uk/sites/ftp.funet.fi/pub/languages/perl/CPAN/
1141 ftp://ftp.demon.co.uk/pub/mirrors/perl/CPAN/
1142 ftp://ftp.flirble.org/pub/languages/perl/CPAN/
1143 ftp://ftp.plig.org/pub/CPAN/
1144 ftp://sunsite.doc.ic.ac.uk/packages/CPAN/
1145 http://mirror.uklinux.net/CPAN/
1146 ftp://mirror.uklinux.net/pub/CPAN/
1147 ftp://usit.shef.ac.uk/pub/packages/CPAN/
1148
1149=item *
1150
1151Estonia
1152
1153 ftp://ftp.ut.ee/pub/languages/perl/CPAN/
1154
1155=item *
1156
1157Finland
1158
1159 ftp://ftp.funet.fi/pub/languages/perl/CPAN/
1160
1161=item *
1162
1163France
1164
1165 ftp://cpan.ftp.worldonline.fr/pub/CPAN/
1166 ftp://ftp.club-internet.fr/pub/perl/CPAN/
1167 ftp://ftp.lip6.fr/pub/perl/CPAN/
1168 ftp://ftp.oleane.net/pub/mirrors/CPAN/
1169 ftp://ftp.pasteur.fr/pub/computing/CPAN/
1170 ftp://cpan.cict.fr/pub/CPAN/
1171 ftp://ftp.uvsq.fr/pub/perl/CPAN/
1172
1173=item *
1174
1175Germany
1176
1177 ftp://ftp.rz.ruhr-uni-bochum.de/pub/CPAN/
1178 ftp://ftp.freenet.de/pub/ftp.cpan.org/pub/CPAN/
1179 ftp://ftp.uni-erlangen.de/pub/source/CPAN/
1180 ftp://ftp-stud.fht-esslingen.de/pub/Mirrors/CPAN
1181 ftp://ftp.gigabell.net/pub/CPAN/
1182 http://ftp.gwdg.de/pub/languages/perl/CPAN/
1183 ftp://ftp.gwdg.de/pub/languages/perl/CPAN/
1184 ftp://ftp.uni-hamburg.de/pub/soft/lang/perl/CPAN/
1185 ftp://ftp.leo.org/pub/comp/general/programming/languages/script/perl/CPAN/
1186 ftp://ftp.mpi-sb.mpg.de/pub/perl/CPAN/
1187 ftp://ftp.gmd.de/mirrors/CPAN/
1188
1189=item *
1190
1191Greece
1192
1193 ftp://ftp.forthnet.gr/pub/languages/perl/CPAN
1194 ftp://ftp.ntua.gr/pub/lang/perl/
1195
1196=item *
1197
1198Hungary
1199
1200 http://cpan.artifact.hu/
1201 ftp://cpan.artifact.hu/CPAN/
1202 ftp://ftp.kfki.hu/pub/packages/perl/CPAN/
1203
1204=item *
1205
1206Iceland
1207
1208 http://cpan.gm.is/
1209 ftp://ftp.gm.is/pub/CPAN/
1210
1211=item *
1212
1213Ireland
1214
1215 http://cpan.indigo.ie/
1216 ftp://cpan.indigo.ie/pub/CPAN/
1217 http://sunsite.compapp.dcu.ie/pub/perl/
1218 ftp://sunsite.compapp.dcu.ie/pub/perl/
1219
1220=item *
1221
1222Italy
1223
1224 http://cpan.nettuno.it/
1225 http://gusp.dyndns.org/CPAN/
1226 ftp://gusp.dyndns.org/pub/CPAN
1227 http://softcity.iol.it/cpan
1228 ftp://softcity.iol.it/pub/cpan
1229 ftp://ftp.unina.it/pub/Other/CPAN/
1230 ftp://ftp.unipi.it/pub/mirror/perl/CPAN/
1231 ftp://cis.uniRoma2.it/CPAN/
1232 ftp://ftp.edisontel.it/pub/CPAN_Mirror/
1233 ftp://ftp.flashnet.it/pub/CPAN/
1234
1235=item *
1236
1237Latvia
1238
1239 http://kvin.lv/pub/CPAN/
1240
1241=item *
1242
1243Netherlands
1244
1245 ftp://download.xs4all.nl/pub/mirror/CPAN/
1246 ftp://ftp.nl.uu.net/pub/CPAN/
1247 ftp://ftp.nluug.nl/pub/languages/perl/CPAN/
1248 ftp://ftp.cpan.nl/pub/CPAN/
1249 http://www.cs.uu.nl/mirror/CPAN/
1250 ftp://ftp.cs.uu.nl/mirror/CPAN/
1251
1252=item *
1253
1254Norway
1255
1256 ftp://sunsite.uio.no/pub/languages/perl/CPAN/
1257 ftp://ftp.uit.no/pub/languages/perl/cpan/
1258
1259=item *
1260
1261Poland
1262
1263 ftp://ftp.pk.edu.pl/pub/lang/perl/CPAN/
1264 ftp://ftp.mega.net.pl/pub/mirrors/ftp.perl.com/
1265 ftp://ftp.man.torun.pl/pub/doc/CPAN/
1266 ftp://sunsite.icm.edu.pl/pub/CPAN/
1267
1268=item *
1269
1270Portugal
1271
1272 ftp://ftp.ua.pt/pub/CPAN/
1273 ftp://perl.di.uminho.pt/pub/CPAN/
1274 ftp://ftp.ist.utl.pt/pub/CPAN/
1275 ftp://ftp.netc.pt/pub/CPAN/
1276
1277=item *
1278
1279Romania
1280
1281 ftp://archive.logicnet.ro/mirrors/ftp.cpan.org/CPAN/
1282 ftp://ftp.kappa.ro/pub/mirrors/ftp.perl.org/pub/CPAN/
1283 ftp://ftp.dntis.ro/pub/cpan/
1284 ftp://ftp.opsynet.com/cpan/
1285 ftp://ftp.dnttm.ro/pub/CPAN/
1286 ftp://ftp.timisoara.roedu.net/mirrors/CPAN/
1287
1288=item *
1289
1290Russia
1291
1292 ftp://ftp.chg.ru/pub/lang/perl/CPAN/
1293 http://cpan.rinet.ru/
1294 ftp://cpan.rinet.ru/pub/mirror/CPAN/
1295 ftp://ftp.aha.ru/pub/CPAN/
1296 ftp://ftp.sai.msu.su/pub/lang/perl/CPAN/
1297
1298=item *
1299
1300Slovakia
1301
1302 ftp://ftp.entry.sk/pub/languages/perl/CPAN/
1303
1304=item *
1305
1306Slovenia
1307
1308 ftp://ftp.arnes.si/software/perl/CPAN/
1309
1310=item *
1311
1312Spain
1313
1314 ftp://ftp.rediris.es/mirror/CPAN/
1315 ftp://ftp.etse.urv.es/pub/perl/
1316
1317=item *
1318
1319Sweden
1320
1321 http://ftp.du.se/CPAN/
1322 ftp://ftp.du.se/pub/CPAN/
1323 ftp://ftp.sunet.se/pub/lang/perl/CPAN/
1324
1325=item *
1326
1327Switzerland
1328
1329 ftp://ftp.danyk.ch/CPAN/
1330 ftp://sunsite.cnlab-switch.ch/mirror/CPAN/
1331
1332=item *
1333
1334Turkey
1335
1336 ftp://sunsite.bilkent.edu.tr/pub/languages/CPAN/
1337
1338=back
1339
1340=head2 North America
1341
1342=over 4
1343
1344=item *
1345
1346Canada
1347
1348=over 8
1349
1350=item *
1351
1352Alberta
1353
1354 http://sunsite.ualberta.ca/pub/Mirror/CPAN/
1355 ftp://sunsite.ualberta.ca/pub/Mirror/CPAN/
1356
1357=item *
1358
1359Manitoba
1360
1361 http://theoryx5.uwinnipeg.ca/pub/CPAN/
1362 ftp://theoryx5.uwinnipeg.ca/pub/CPAN/
1363
1364=item *
1365
1366Nova Scotia
1367
1368 ftp://cpan.chebucto.ns.ca/pub/CPAN/
1369
1370=item *
1371
1372Ontario
1373
1374 ftp://ftp.crc.ca/pub/packages/lang/perl/CPAN/
1375
1376=item *
1377
1378Mexico
1379
1380 http://www.msg.com.mx/CPAN/
1381 ftp://ftp.msg.com.mx/pub/CPAN/
1382
1383=back
1384
1385=item *
1386
1387United States
1388
1389=over 8
1390
1391=item *
1392
1393Alabama
1394
1395 http://mirror.hiwaay.net/CPAN/
1396 ftp://mirror.hiwaay.net/CPAN/
1397
1398=item *
1399
1400California
1401
1402 http://www.cpan.org/
1403 ftp://ftp.cpan.org/CPAN/
1404 ftp://cpan.nas.nasa.gov/pub/perl/CPAN/
1405 ftp://ftp.digital.com/pub/plan/perl/CPAN/
1406 http://www.kernel.org/pub/mirrors/cpan/
1407 ftp://ftp.kernel.org/pub/mirrors/cpan/
1408 http://www.perl.com/CPAN/
1409 http://download.sourceforge.net/mirrors/CPAN/
1410
1411=item *
1412
1413Colorado
1414
1415 ftp://ftp.cs.colorado.edu/pub/perl/CPAN/
1416
1417=item *
1418
1419Florida
1420
1421 ftp://ftp.cise.ufl.edu/pub/perl/CPAN/
1422
1423=item *
1424
1425Georgia
1426
1427 ftp://ftp.twoguys.org/CPAN/
1428
1429=item *
1430
1431Illinois
1432
1433 http://www.neurogames.com/mirrors/CPAN
1434 http://uiarchive.uiuc.edu/mirrors/ftp/ftp.cpan.org/pub/CPAN/
1435 ftp://uiarchive.uiuc.edu/mirrors/ftp/ftp.cpan.org/pub/CPAN/
1436
1437=item *
1438
1439Indiana
1440
1441 ftp://ftp.uwsg.indiana.edu/pub/perl/CPAN/
1442 http://cpan.nitco.com/
1443 ftp://cpan.nitco.com/pub/CPAN/
1444 ftp://cpan.in-span.net/
1445 http://csociety-ftp.ecn.purdue.edu/pub/CPAN
1446 ftp://csociety-ftp.ecn.purdue.edu/pub/CPAN
1447
1448=item *
1449
1450Kentucky
1451
1452 http://cpan.uky.edu/
1453 ftp://cpan.uky.edu/pub/CPAN/
1454
1455=item *
1456
1457Massachusetts
1458
1459 ftp://ftp.ccs.neu.edu/net/mirrors/ftp.funet.fi/pub/languages/perl/CPAN/
1460 ftp://ftp.iguide.com/pub/mirrors/packages/perl/CPAN/
1461
1462=item *
1463
1464New Jersey
1465
1466 ftp://ftp.cpanel.net/pub/CPAN/
1467
1468=item *
1469
1470New York
1471
1472 ftp://ftp.freesoftware.com/pub/perl/CPAN/
1473 http://www.deao.net/mirrors/CPAN/
1474 ftp://ftp.deao.net/pub/CPAN/
1475 ftp://ftp.stealth.net/pub/mirrors/ftp.cpan.org/pub/CPAN/
1476 http://mirror.nyc.anidea.com/CPAN/
1477 ftp://mirror.nyc.anidea.com/pub/CPAN/
1478 http://www.rge.com/pub/languages/perl/
1479 ftp://ftp.rge.com/pub/languages/perl/
1480 ftp://mirrors.cloud9.net/pub/mirrors/CPAN/
1481
1482=item *
1483
1484North Carolina
1485
1486 ftp://ftp.duke.edu/pub/perl/
1487
1488=item *
1489
1490Ohio
1491
1492 ftp://ftp.loaded.net/pub/CPAN/
1493
1494=item *
1495
1496Oklahoma
1497
1498 ftp://ftp.ou.edu/mirrors/CPAN/
1499
1500=item *
1501
1502Oregon
1503
1504 ftp://ftp.orst.edu/pub/packages/CPAN/
1505
1506=item *
1507
1508Pennsylvania
1509
1510 http://ftp.epix.net/CPAN/
1511 ftp://ftp.epix.net/pub/languages/perl/
1512 ftp://carroll.cac.psu.edu/pub/CPAN/
1513
1514=item *
1515
1516Tennessee
1517
1518 ftp://ftp.sunsite.utk.edu/pub/CPAN/
1519
1520=item *
1521
1522Texas
1523
1524 http://ftp.sedl.org/pub/mirrors/CPAN/
1525 http://jhcloos.com/pub/mirror/CPAN/
1526 ftp://jhcloos.com/pub/mirror/CPAN/
1527
1528=item *
1529
1530Utah
1531
1532 ftp://mirror.xmission.com/CPAN/
1533
1534=item *
1535
1536Virginia
1537
1538 http://mirrors.rcn.net/pub/lang/CPAN/
1539 ftp://mirrors.rcn.net/pub/lang/CPAN/
1540 ftp://ruff.cs.jmu.edu/pub/CPAN/
1541 http://perl.Liquidation.com/CPAN/
1542
1543=item *
1544
1545Washington
1546
1547 http://cpan.llarian.net/
1548 ftp://cpan.llarian.net/pub/CPAN/
1549 ftp://ftp-mirror.internap.com/pub/CPAN/
1550 ftp://ftp.spu.edu/pub/CPAN/
1551
1552=back
1553
1554=back
1555
1556=head2 Oceania
1557
1558=over 4
1559
1560=item *
1561
1562Australia
1563
1564 http://ftp.planetmirror.com/pub/CPAN/
1565 ftp://ftp.planetmirror.com/pub/CPAN/
1566 ftp://mirror.aarnet.edu.au/pub/perl/CPAN/
1567 ftp://cpan.topend.com.au/pub/CPAN/
1568
1569=item *
1570
1571New Zealand
1572
1573 ftp://ftp.auckland.ac.nz/pub/perl/CPAN/
1574
1575=back
1576
1577=head2 South America
1578
1579=over 4
1580
1581=item *
1582
1583Argentina
1584
1585 ftp://mirrors.bannerlandia.com.ar/mirrors/CPAN/
1586
1587=item *
1588
1589Brazil
1590
1591 ftp://cpan.pop-mg.com.br/pub/CPAN/
1592 ftp://ftp.matrix.com.br/pub/perl/
1593 ftp://cpan.if.usp.br/pub/mirror/CPAN/
1594
1595=item *
1596
1597Chile
1598
1599 ftp://ftp.psinet.cl/pub/programming/perl/CPAN/
1600 ftp://sunsite.dcc.uchile.cl/pub/lang/perl/
f102b883 1601
1602=back
1603
1604For an up-to-date listing of CPAN sites,
4e860d0a 1605see http://www.cpan.org/SITES or ftp://www.cpan.org/SITES .
f102b883 1606
1607=head1 Modules: Creation, Use, and Abuse
1608
1609(The following section is borrowed directly from Tim Bunce's modules
1610file, available at your nearest CPAN site.)
1611
1612Perl implements a class using a package, but the presence of a
1613package doesn't imply the presence of a class. A package is just a
1614namespace. A class is a package that provides subroutines that can be
1615used as methods. A method is just a subroutine that expects, as its
1616first argument, either the name of a package (for "static" methods),
1617or a reference to something (for "virtual" methods).
1618
1619A module is a file that (by convention) provides a class of the same
1620name (sans the .pm), plus an import method in that class that can be
1621called to fetch exported symbols. This module may implement some of
1622its methods by loading dynamic C or C++ objects, but that should be
1623totally transparent to the user of the module. Likewise, the module
1624might set up an AUTOLOAD function to slurp in subroutine definitions on
1625demand, but this is also transparent. Only the F<.pm> file is required to
2e1d04bc 1626exist. See L<perlsub>, L<perltoot>, and L<AutoLoader> for details about
f102b883 1627the AUTOLOAD mechanism.
1628
1629=head2 Guidelines for Module Creation
1630
1631=over 4
1632
4e860d0a 1633=item *
1634
1635Do similar modules already exist in some form?
f102b883 1636
1637If so, please try to reuse the existing modules either in whole or
1638by inheriting useful features into a new class. If this is not
1639practical try to get together with the module authors to work on
1640extending or enhancing the functionality of the existing modules.
1641A perfect example is the plethora of packages in perl4 for dealing
1642with command line options.
1643
1644If you are writing a module to expand an already existing set of
1645modules, please coordinate with the author of the package. It
1646helps if you follow the same naming scheme and module interaction
1647scheme as the original author.
1648
4e860d0a 1649=item *
1650
1651Try to design the new module to be easy to extend and reuse.
f102b883 1652
9f1b1f2d 1653Try to C<use warnings;> (or C<use warnings qw(...);>).
1654Remember that you can add C<no warnings qw(...);> to individual blocks
2e1d04bc 1655of code that need less warnings.
19799a22 1656
f102b883 1657Use blessed references. Use the two argument form of bless to bless
1658into the class name given as the first parameter of the constructor,
1659e.g.,:
1660
1661 sub new {
2e1d04bc 1662 my $class = shift;
1663 return bless {}, $class;
f102b883 1664 }
1665
1666or even this if you'd like it to be used as either a static
1667or a virtual method.
1668
1669 sub new {
2e1d04bc 1670 my $self = shift;
1671 my $class = ref($self) || $self;
1672 return bless {}, $class;
f102b883 1673 }
1674
1675Pass arrays as references so more parameters can be added later
1676(it's also faster). Convert functions into methods where
1677appropriate. Split large methods into smaller more flexible ones.
1678Inherit methods from other modules if appropriate.
1679
1680Avoid class name tests like: C<die "Invalid" unless ref $ref eq 'FOO'>.
19799a22 1681Generally you can delete the C<eq 'FOO'> part with no harm at all.
f102b883 1682Let the objects look after themselves! Generally, avoid hard-wired
1683class names as far as possible.
1684
c47ff5f1 1685Avoid C<< $r->Class::func() >> where using C<@ISA=qw(... Class ...)> and
1686C<< $r->func() >> would work (see L<perlbot> for more details).
f102b883 1687
1688Use autosplit so little used or newly added functions won't be a
5a964f20 1689burden to programs that don't use them. Add test functions to
f102b883 1690the module after __END__ either using AutoSplit or by saying:
1691
1692 eval join('',<main::DATA>) || die $@ unless caller();
1693
1694Does your module pass the 'empty subclass' test? If you say
19799a22 1695C<@SUBCLASS::ISA = qw(YOURCLASS);> your applications should be able
f102b883 1696to use SUBCLASS in exactly the same way as YOURCLASS. For example,
1697does your application still work if you change: C<$obj = new YOURCLASS;>
1698into: C<$obj = new SUBCLASS;> ?
1699
1700Avoid keeping any state information in your packages. It makes it
1701difficult for multiple other packages to use yours. Keep state
1702information in objects.
1703
2e1d04bc 1704Always use B<-w>.
19799a22 1705
1706Try to C<use strict;> (or C<use strict qw(...);>).
f102b883 1707Remember that you can add C<no strict qw(...);> to individual blocks
2e1d04bc 1708of code that need less strictness.
19799a22 1709
2e1d04bc 1710Always use B<-w>.
19799a22 1711
f102b883 1712Follow the guidelines in the perlstyle(1) manual.
1713
19799a22 1714Always use B<-w>.
1715
4e860d0a 1716=item *
1717
1718Some simple style guidelines
f102b883 1719
5a964f20 1720The perlstyle manual supplied with Perl has many helpful points.
f102b883 1721
1722Coding style is a matter of personal taste. Many people evolve their
1723style over several years as they learn what helps them write and
1724maintain good code. Here's one set of assorted suggestions that
1725seem to be widely used by experienced developers:
1726
1727Use underscores to separate words. It is generally easier to read
1728$var_names_like_this than $VarNamesLikeThis, especially for
1729non-native speakers of English. It's also a simple rule that works
1730consistently with VAR_NAMES_LIKE_THIS.
1731
1732Package/Module names are an exception to this rule. Perl informally
1733reserves lowercase module names for 'pragma' modules like integer
1734and strict. Other modules normally begin with a capital letter and
1735use mixed case with no underscores (need to be short and portable).
1736
1737You may find it helpful to use letter case to indicate the scope
1738or nature of a variable. For example:
1739
5a964f20 1740 $ALL_CAPS_HERE constants only (beware clashes with Perl vars)
f102b883 1741 $Some_Caps_Here package-wide global/static
1742 $no_caps_here function scope my() or local() variables
1743
1744Function and method names seem to work best as all lowercase.
c47ff5f1 1745e.g., C<< $obj->as_string() >>.
f102b883 1746
1747You can use a leading underscore to indicate that a variable or
1748function should not be used outside the package that defined it.
1749
4e860d0a 1750=item *
1751
1752Select what to export.
f102b883 1753
1754Do NOT export method names!
1755
1756Do NOT export anything else by default without a good reason!
1757
1758Exports pollute the namespace of the module user. If you must
1759export try to use @EXPORT_OK in preference to @EXPORT and avoid
1760short or common names to reduce the risk of name clashes.
1761
1762Generally anything not exported is still accessible from outside the
c47ff5f1 1763module using the ModuleName::item_name (or C<< $blessed_ref->method >>)
f102b883 1764syntax. By convention you can use a leading underscore on names to
1765indicate informally that they are 'internal' and not for public use.
1766
1767(It is actually possible to get private functions by saying:
1768C<my $subref = sub { ... }; &$subref;>. But there's no way to call that
1769directly as a method, because a method must have a name in the symbol
1770table.)
1771
1772As a general rule, if the module is trying to be object oriented
1773then export nothing. If it's just a collection of functions then
1774@EXPORT_OK anything but use @EXPORT with caution.
1775
4e860d0a 1776=item *
1777
1778Select a name for the module.
f102b883 1779
1780This name should be as descriptive, accurate, and complete as
1781possible. Avoid any risk of ambiguity. Always try to use two or
1782more whole words. Generally the name should reflect what is special
1783about what the module does rather than how it does it. Please use
1784nested module names to group informally or categorize a module.
1785There should be a very good reason for a module not to have a nested name.
1786Module names should begin with a capital letter.
1787
1788Having 57 modules all called Sort will not make life easy for anyone
1789(though having 23 called Sort::Quick is only marginally better :-).
1790Imagine someone trying to install your module alongside many others.
1791If in any doubt ask for suggestions in comp.lang.perl.misc.
1792
1793If you are developing a suite of related modules/classes it's good
1794practice to use nested classes with a common prefix as this will
1795avoid namespace clashes. For example: Xyz::Control, Xyz::View,
1796Xyz::Model etc. Use the modules in this list as a naming guide.
1797
1798If adding a new module to a set, follow the original author's
1799standards for naming modules and the interface to methods in
1800those modules.
1801
165c0277 1802If developing modules for private internal or project specific use,
1803that will never be released to the public, then you should ensure
1804that their names will not clash with any future public module. You
1805can do this either by using the reserved Local::* category or by
1806using a category name that includes an underscore like Foo_Corp::*.
1807
f102b883 1808To be portable each component of a module name should be limited to
180911 characters. If it might be used on MS-DOS then try to ensure each is
1810unique in the first 8 characters. Nested modules make this easier.
1811
4e860d0a 1812=item *
1813
1814Have you got it right?
f102b883 1815
1816How do you know that you've made the right decisions? Have you
1817picked an interface design that will cause problems later? Have
1818you picked the most appropriate name? Do you have any questions?
1819
1820The best way to know for sure, and pick up many helpful suggestions,
1821is to ask someone who knows. Comp.lang.perl.misc is read by just about
1822all the people who develop modules and it's the best place to ask.
1823
1824All you need to do is post a short summary of the module, its
1825purpose and interfaces. A few lines on each of the main methods is
1826probably enough. (If you post the whole module it might be ignored
1827by busy people - generally the very people you want to read it!)
1828
1829Don't worry about posting if you can't say when the module will be
1830ready - just say so in the message. It might be worth inviting
1831others to help you, they may be able to complete it for you!
1832
4e860d0a 1833=item *
1834
1835README and other Additional Files.
f102b883 1836
1837It's well known that software developers usually fully document the
1838software they write. If, however, the world is in urgent need of
1839your software and there is not enough time to write the full
1840documentation please at least provide a README file containing:
1841
1842=over 10
1843
1844=item *
4e860d0a 1845
f102b883 1846A description of the module/package/extension etc.
1847
1848=item *
4e860d0a 1849
f102b883 1850A copyright notice - see below.
1851
1852=item *
4e860d0a 1853
f102b883 1854Prerequisites - what else you may need to have.
1855
1856=item *
4e860d0a 1857
f102b883 1858How to build it - possible changes to Makefile.PL etc.
1859
1860=item *
4e860d0a 1861
f102b883 1862How to install it.
1863
1864=item *
4e860d0a 1865
f102b883 1866Recent changes in this release, especially incompatibilities
1867
1868=item *
4e860d0a 1869
f102b883 1870Changes / enhancements you plan to make in the future.
1871
1872=back
1873
1874If the README file seems to be getting too large you may wish to
1875split out some of the sections into separate files: INSTALL,
1876Copying, ToDo etc.
1877
1878=over 4
1879
1880=item Adding a Copyright Notice.
1881
4e860d0a 1882
f102b883 1883How you choose to license your work is a personal decision.
1884The general mechanism is to assert your Copyright and then make
1885a declaration of how others may copy/use/modify your work.
1886
1887Perl, for example, is supplied with two types of licence: The GNU
1888GPL and The Artistic Licence (see the files README, Copying, and
1889Artistic). Larry has good reasons for NOT just using the GNU GPL.
1890
1891My personal recommendation, out of respect for Larry, Perl, and the
5a964f20 1892Perl community at large is to state something simply like:
f102b883 1893
1894 Copyright (c) 1995 Your Name. All rights reserved.
1895 This program is free software; you can redistribute it and/or
1896 modify it under the same terms as Perl itself.
1897
1898This statement should at least appear in the README file. You may
1899also wish to include it in a Copying file and your source files.
1900Remember to include the other words in addition to the Copyright.
1901
4e860d0a 1902=item *
1903
1904Give the module a version/issue/release number.
f102b883 1905
1906To be fully compatible with the Exporter and MakeMaker modules you
1907should store your module's version number in a non-my package
1908variable called $VERSION. This should be a floating point
1909number with at least two digits after the decimal (i.e., hundredths,
1910e.g, C<$VERSION = "0.01">). Don't use a "1.3.2" style version.
19799a22 1911See L<Exporter> for details.
f102b883 1912
1913It may be handy to add a function or method to retrieve the number.
1914Use the number in announcements and archive file names when
1915releasing the module (ModuleName-1.02.tar.Z).
1916See perldoc ExtUtils::MakeMaker.pm for details.
1917
4e860d0a 1918=item *
1919
1920How to release and distribute a module.
f102b883 1921
1922It's good idea to post an announcement of the availability of your
1923module (or the module itself if small) to the comp.lang.perl.announce
1924Usenet newsgroup. This will at least ensure very wide once-off
1925distribution.
1926
2e1d04bc 1927If possible, register the module with CPAN. You should
f102b883 1928include details of its location in your announcement.
1929
1930Some notes about ftp archives: Please use a long descriptive file
5a964f20 1931name that includes the version number. Most incoming directories
f102b883 1932will not be readable/listable, i.e., you won't be able to see your
1933file after uploading it. Remember to send your email notification
1934message as soon as possible after uploading else your file may get
1935deleted automatically. Allow time for the file to be processed
1936and/or check the file has been processed before announcing its
1937location.
1938
1939FTP Archives for Perl Modules:
1940
6cecdcac 1941Follow the instructions and links on:
f102b883 1942
4e860d0a 1943 http://www.cpan.org/modules/00modlist.long.html
1944 http://www.cpan.org/modules/04pause.html
f102b883 1945
1946or upload to one of these sites:
1947
6cecdcac 1948 https://pause.kbx.de/pause/
1949 http://pause.perl.org/pause/
f102b883 1950
6cecdcac 1951and notify <modules@perl.org>.
f102b883 1952
1953By using the WWW interface you can ask the Upload Server to mirror
1954your modules from your ftp or WWW site into your own directory on
1955CPAN!
1956
1957Please remember to send me an updated entry for the Module list!
1958
4e860d0a 1959=item *
1960
1961Take care when changing a released module.
f102b883 1962
7b8d334a 1963Always strive to remain compatible with previous released versions.
1964Otherwise try to add a mechanism to revert to the
19799a22 1965old behavior if people rely on it. Document incompatible changes.
f102b883 1966
1967=back
1968
1969=back
1970
1971=head2 Guidelines for Converting Perl 4 Library Scripts into Modules
1972
1973=over 4
1974
4e860d0a 1975=item *
1976
1977There is no requirement to convert anything.
f102b883 1978
1979If it ain't broke, don't fix it! Perl 4 library scripts should
1980continue to work with no problems. You may need to make some minor
1981changes (like escaping non-array @'s in double quoted strings) but
1982there is no need to convert a .pl file into a Module for just that.
1983
4e860d0a 1984=item *
1985
1986Consider the implications.
f102b883 1987
5a964f20 1988All Perl applications that make use of the script will need to
f102b883 1989be changed (slightly) if the script is converted into a module. Is
1990it worth it unless you plan to make other changes at the same time?
1991
4e860d0a 1992=item *
1993
1994Make the most of the opportunity.
f102b883 1995
1996If you are going to convert the script to a module you can use the
19799a22 1997opportunity to redesign the interface. The guidelines for module
1998creation above include many of the issues you should consider.
f102b883 1999
4e860d0a 2000=item *
2001
2002The pl2pm utility will get you started.
f102b883 2003
2004This utility will read *.pl files (given as parameters) and write
2005corresponding *.pm files. The pl2pm utilities does the following:
2006
2007=over 10
2008
2009=item *
4e860d0a 2010
f102b883 2011Adds the standard Module prologue lines
2012
2013=item *
4e860d0a 2014
f102b883 2015Converts package specifiers from ' to ::
2016
2017=item *
4e860d0a 2018
f102b883 2019Converts die(...) to croak(...)
2020
2021=item *
4e860d0a 2022
f102b883 2023Several other minor changes
2024
2025=back
2026
2027Being a mechanical process pl2pm is not bullet proof. The converted
2028code will need careful checking, especially any package statements.
2029Don't delete the original .pl file till the new .pm one works!
2030
2031=back
2032
2033=head2 Guidelines for Reusing Application Code
2034
2035=over 4
2036
4e860d0a 2037=item *
551e1d92 2038
2039Complete applications rarely belong in the Perl Module Library.
f102b883 2040
4e860d0a 2041=item *
551e1d92 2042
2043Many applications contain some Perl code that could be reused.
f102b883 2044
2045Help save the world! Share your code in a form that makes it easy
2046to reuse.
2047
4e860d0a 2048=item *
551e1d92 2049
2050Break-out the reusable code into one or more separate module files.
f102b883 2051
4e860d0a 2052=item *
551e1d92 2053
2054Take the opportunity to reconsider and redesign the interfaces.
2055
4e860d0a 2056=item *
f102b883 2057
551e1d92 2058In some cases the 'application' can then be reduced to a small
f102b883 2059
2060fragment of code built on top of the reusable modules. In these cases
2061the application could invoked as:
2062
5a964f20 2063 % perl -e 'use Module::Name; method(@ARGV)' ...
f102b883 2064or
5a964f20 2065 % perl -mModule::Name ... (in perl5.002 or higher)
f102b883 2066
2067=back
2068
2069=head1 NOTE
2070
2071Perl does not enforce private and public parts of its modules as you may
2072have been used to in other languages like C++, Ada, or Modula-17. Perl
2073doesn't have an infatuation with enforced privacy. It would prefer
2074that you stayed out of its living room because you weren't invited, not
2075because it has a shotgun.
2076
2077The module and its user have a contract, part of which is common law,
2078and part of which is "written". Part of the common law contract is
2079that a module doesn't pollute any namespace it wasn't asked to. The
2080written contract for the module (A.K.A. documentation) may make other
2081provisions. But then you know when you C<use RedefineTheWorld> that
2082you're redefining the world and willing to take the consequences.