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