3 perlmodlib - constructing new Perl modules and finding existing ones
7 =head1 THE PERL MODULE LIBRARY
9 A number of modules are included the Perl distribution. These are
10 described below, and all end in F<.pm>. You may also discover files in
11 the library directory that end in either F<.pl> or F<.ph>. These are old
12 libraries supplied so that old programs that use them still run. The
13 F<.pl> files will all eventually be converted into standard modules, and
14 the F<.ph> files made by B<h2ph> will probably end up as extension modules
15 made by B<h2xs>. (Some F<.ph> values may already be available through the
16 POSIX module.) The B<pl2pm> file in the distribution may help in your
17 conversion, but it's just a mechanical process and therefore far from
20 =head2 Pragmatic Modules
22 They work somewhat like pragmas in that they tend to affect the compilation of
23 your program, and thus will usually work well only when used within a
24 C<use>, or C<no>. Most of these are locally scoped, so an inner BLOCK
25 may countermand any of these by saying:
30 which lasts until the end of that BLOCK.
32 Unlike the pragmas that effect the C<$^H> hints variable, the C<use
33 vars> and C<use subs> declarations are not BLOCK-scoped. They allow
34 you to predeclare a variables or subroutines within a particular
35 I<file> rather than just a block. Such declarations are effective
36 for the entire file for which they were declared. You cannot rescind
37 them with C<no vars> or C<no subs>.
39 The following pragmas are defined (and have their own documentation).
43 =item use autouse MODULE => qw(sub1 sub2 sub3)
45 Defers C<require MODULE> until someone calls one of the specified
46 subroutines (which must be exported by MODULE). This pragma should be
47 used with caution, and only when necessary.
51 manipulate @INC at compile time to use MakeMaker's uninstalled version
56 force verbose warning diagnostics
60 compute arithmetic in integer instead of double
64 request less of something from the compiler
68 manipulate @INC at compile time
72 use or ignore current locale for builtin operations (see L<perllocale>)
76 restrict named opcodes when compiling or running Perl code
80 overload basic Perl operations
84 enable simple signal handling
88 restrict unsafe constructs
96 adopt certain VMS-specific behaviors
100 predeclare global variable names
104 =head2 Standard Modules
106 Standard, bundled modules are all expected to behave in a well-defined
107 manner with respect to namespace pollution because they use the
108 Exporter module. See their own documentation for details.
114 provide framework for multiple DBMs
118 load functions only on demand
122 split a package for autoloading
126 benchmark running times of code
130 interface to Comprehensive Perl Archive Network
132 =item CPAN::FirstTime
134 create a CPAN configuration file
138 run CPAN while avoiding compiled extensions
142 warn of errors (from perspective of caller)
146 declare struct-like datatypes
150 access Perl configuration information
154 get pathname of current working directory
158 access to Berkeley DB
160 =item Devel::SelfStubber
162 generate stubs for a SelfLoading module
166 supply object methods for directory handles
170 dynamically load C libraries into Perl code
174 use nice English (or awk) names for ugly punctuation variables
178 import environment variables
182 implements default import method for modules
184 =item ExtUtils::Embed
186 utilities for embedding Perl in C/C++ applications
188 =item ExtUtils::Install
190 install files from here to there
192 =item ExtUtils::Liblist
194 determine libraries to use and how to use them
196 =item ExtUtils::MM_OS2
198 methods to override Unix behaviour in ExtUtils::MakeMaker
200 =item ExtUtils::MM_Unix
202 methods used by ExtUtils::MakeMaker
204 =item ExtUtils::MM_VMS
206 methods to override Unix behaviour in ExtUtils::MakeMaker
208 =item ExtUtils::MakeMaker
210 create an extension Makefile
212 =item ExtUtils::Manifest
214 utilities to write and check a MANIFEST file
216 =item ExtUtils::Mkbootstrap
218 make a bootstrap file for use by DynaLoader
220 =item ExtUtils::Mksymlists
222 write linker options files for dynamic extension
224 =item ExtUtils::testlib
226 add blib/* directories to @INC
230 load the C Fcntl.h defines
234 split a pathname into pieces
236 =item File::CheckTree
238 run many filetest checks on a tree
242 compare files or filehandles
246 copy files or filehandles
254 create or remove a series of directories
258 by-name interface to Perl's builtin stat() functions
262 keep more files open than the system permits
266 supply object methods for filehandles
270 locate directory of original perl script
274 access to the gdbm library
278 extended processing of command line options
282 process single-character switches with switch clustering
286 compare 8-bit scalar data according to the current locale
290 load various IO modules
294 supply object methods for filehandles
298 supply object methods for I/O handles
302 supply object methods for pipes
306 supply seek based methods for I/O objects
310 OO interface to the select system call
314 object interface to socket communications
318 open a process for both reading and writing
322 open a process for reading, writing, and error handling
326 arbitrary length float math package
330 arbitrary size integer math package
334 complex numbers and associated mathematical functions
338 tied access to ndbm files
346 by-name interface to Perl's builtin gethost*() functions
350 by-name interface to Perl's builtin getnet*() functions
354 by-name interface to Perl's builtin getproto*() functions
358 by-name interface to Perl's builtin getserv*() functions
362 disable named opcodes when compiling or running perl code
366 convert POD data to formatted ASCII text
370 interface to IEEE Standard 1003.1
374 tied access to sdbm files
378 compile and execute code in restricted compartments
382 search for key in dictionary file
386 save and restore selected file handle
390 load functions only on demand
394 run shell commands transparently within perl
398 load the C socket.h defines and structure manipulators
402 manipulate Perl symbols and their names
406 try every conceivable way to get hostname
410 interface to the Unix syslog(3) calls
418 word completion module
422 interface to various C<readline> packages
426 run perl standard test scripts with statistics
430 create an abbreviation table from a list
432 =item Text::ParseWords
434 parse text into an array of tokens
438 implementation of the Soundex Algorithm as described by Knuth
442 expand and unexpand tabs per the Unix expand(1) and unexpand(1)
446 line wrapping to form simple paragraphs
450 base class definitions for tied hashes
454 base class definitions for tied hashes with references as keys
458 base class definitions for tied scalars
460 =item Tie::SubstrHash
462 fixed-table-size, fixed-key-length hashing
466 efficiently compute time from local and GMT time
470 by-name interface to Perl's builtin gmtime() function
472 =item Time::localtime
474 by-name interface to Perl's builtin localtime() function
478 internal object used by Time::gmtime and Time::localtime
482 base class for ALL classes (blessed references)
486 by-name interface to Perl's builtin getgr*() functions
490 by-name interface to Perl's builtin getpw*() functions
494 To find out I<all> the modules installed on your system, including
495 those without documentation or outside the standard release, do this:
497 find `perl -e 'print "@INC"'` -name '*.pm' -print
499 They should all have their own documentation installed and accessible via
500 your system man(1) command. If that fails, try the I<perldoc> program.
502 =head2 Extension Modules
504 Extension modules are written in C (or a mix of Perl and C) and may be
505 statically linked or in general are
506 dynamically loaded into Perl if and when you need them. Supported
507 extension modules include the Socket, Fcntl, and POSIX modules.
509 Many popular C extension modules do not come bundled (at least, not
510 completely) due to their sizes, volatility, or simply lack of time for
511 adequate testing and configuration across the multitude of platforms on
512 which Perl was beta-tested. You are encouraged to look for them in
513 archie(1L), the Perl FAQ or Meta-FAQ, the WWW page, and even with their
514 authors before randomly posting asking for their present condition and
519 CPAN stands for the Comprehensive Perl Archive Network. This is a globally
520 replicated collection of all known Perl materials, including hundreds
521 of unbundled modules. Here are the major categories of modules:
526 Language Extensions and Documentation Tools
532 Operating System Interfaces
535 Networking, Device Control (modems) and InterProcess Communication
538 Data Types and Data Type Utilities
547 Interfaces to / Emulations of Other Programming Languages
550 File Names, File Systems and File Locking (see also File Handles)
553 String Processing, Language Text Processing, Parsing, and Searching
556 Option, Argument, Parameter, and Configuration File Processing
559 Internationalization and Locale
562 Authentication, Security, and Encryption
565 World Wide Web, HTML, HTTP, CGI, MIME
568 Server and Daemon Utilities
571 Archiving and Compression
574 Images, Pixmap and Bitmap Manipulation, Drawing, and Graphing
580 Control Flow Utilities (callbacks and exceptions etc)
583 File Handle and Input/Output Stream Utilities
586 Miscellaneous Modules
590 The registered CPAN sites as of this writing include the following.
591 You should try to choose one close to you:
598 South Africa ftp://ftp.is.co.za/programming/perl/CPAN/
603 Hong Kong ftp://ftp.hkstar.com/pub/CPAN/
604 Japan ftp://ftp.jaist.ac.jp/pub/lang/perl/CPAN/
605 ftp://ftp.lab.kdd.co.jp/lang/perl/CPAN/
606 South Korea ftp://ftp.nuri.net/pub/CPAN/
607 Taiwan ftp://dongpo.math.ncu.edu.tw/perl/CPAN/
608 ftp://ftp.wownet.net/pub2/PERL/
613 Australia ftp://ftp.netinfo.com.au/pub/perl/CPAN/
614 New Zealand ftp://ftp.tekotago.ac.nz/pub/perl/CPAN/
619 Austria ftp://ftp.tuwien.ac.at/pub/languages/perl/CPAN/
620 Belgium ftp://ftp.kulnet.kuleuven.ac.be/pub/mirror/CPAN/
621 Czech Republic ftp://sunsite.mff.cuni.cz/Languages/Perl/CPAN/
622 Denmark ftp://sunsite.auc.dk/pub/languages/perl/CPAN/
623 Finland ftp://ftp.funet.fi/pub/languages/perl/CPAN/
624 France ftp://ftp.ibp.fr/pub/perl/CPAN/
625 ftp://ftp.pasteur.fr/pub/computing/unix/perl/CPAN/
626 Germany ftp://ftp.gmd.de/packages/CPAN/
627 ftp://ftp.leo.org/pub/comp/programming/languages/perl/CPAN/
628 ftp://ftp.mpi-sb.mpg.de/pub/perl/CPAN/
629 ftp://ftp.rz.ruhr-uni-bochum.de/pub/CPAN/
630 ftp://ftp.uni-erlangen.de/pub/source/Perl/CPAN/
631 ftp://ftp.uni-hamburg.de/pub/soft/lang/perl/CPAN/
632 Greece ftp://ftp.ntua.gr/pub/lang/perl/
633 Hungary ftp://ftp.kfki.hu/pub/packages/perl/CPAN/
634 Italy ftp://cis.utovrm.it/CPAN/
635 the Netherlands ftp://ftp.cs.ruu.nl/pub/PERL/CPAN/
636 ftp://ftp.EU.net/packages/cpan/
637 Norway ftp://ftp.uit.no/pub/languages/perl/cpan/
638 Poland ftp://ftp.pk.edu.pl/pub/lang/perl/CPAN/
639 ftp://sunsite.icm.edu.pl/pub/CPAN/
640 Portugal ftp://ftp.ci.uminho.pt/pub/lang/perl/
641 ftp://ftp.telepac.pt/pub/CPAN/
642 Russia ftp://ftp.sai.msu.su/pub/lang/perl/CPAN/
643 Slovenia ftp://ftp.arnes.si/software/perl/CPAN/
644 Spain ftp://ftp.etse.urv.es/pub/mirror/perl/
645 ftp://ftp.rediris.es/mirror/CPAN/
646 Sweden ftp://ftp.sunet.se/pub/lang/perl/CPAN/
647 UK ftp://ftp.demon.co.uk/pub/mirrors/perl/CPAN/
648 ftp://sunsite.doc.ic.ac.uk/packages/CPAN/
649 ftp://unix.hensa.ac.uk/mirrors/perl-CPAN/
654 Ontario ftp://ftp.utilis.com/public/CPAN/
655 ftp://enterprise.ic.gc.ca/pub/perl/CPAN/
656 Manitoba ftp://theory.uwinnipeg.ca/pub/CPAN/
657 California ftp://ftp.digital.com/pub/plan/perl/CPAN/
658 ftp://ftp.cdrom.com/pub/perl/CPAN/
659 Colorado ftp://ftp.cs.colorado.edu/pub/perl/CPAN/
660 Florida ftp://ftp.cis.ufl.edu/pub/perl/CPAN/
661 Illinois ftp://uiarchive.uiuc.edu/pub/lang/perl/CPAN/
662 Massachusetts ftp://ftp.iguide.com/pub/mirrors/packages/perl/CPAN/
663 New York ftp://ftp.rge.com/pub/languages/perl/
664 North Carolina ftp://ftp.duke.edu/pub/perl/
665 Oklahoma ftp://ftp.ou.edu/mirrors/CPAN/
666 Oregon http://www.perl.org/CPAN/
667 ftp://ftp.orst.edu/pub/packages/CPAN/
668 Pennsylvania ftp://ftp.epix.net/pub/languages/perl/
669 Texas ftp://ftp.sedl.org/pub/mirrors/CPAN/
670 ftp://ftp.metronet.com/pub/perl/
675 Chile ftp://sunsite.dcc.uchile.cl/pub/Lang/perl/CPAN/
679 For an up-to-date listing of CPAN sites,
680 see F<http://www.perl.com/perl/CPAN> or F<ftp://ftp.perl.com/perl/>.
682 =head1 Modules: Creation, Use, and Abuse
684 (The following section is borrowed directly from Tim Bunce's modules
685 file, available at your nearest CPAN site.)
687 Perl implements a class using a package, but the presence of a
688 package doesn't imply the presence of a class. A package is just a
689 namespace. A class is a package that provides subroutines that can be
690 used as methods. A method is just a subroutine that expects, as its
691 first argument, either the name of a package (for "static" methods),
692 or a reference to something (for "virtual" methods).
694 A module is a file that (by convention) provides a class of the same
695 name (sans the .pm), plus an import method in that class that can be
696 called to fetch exported symbols. This module may implement some of
697 its methods by loading dynamic C or C++ objects, but that should be
698 totally transparent to the user of the module. Likewise, the module
699 might set up an AUTOLOAD function to slurp in subroutine definitions on
700 demand, but this is also transparent. Only the F<.pm> file is required to
701 exist. See L<perlsub>, L<perltoot>, and L<AutoLoader> for details about
702 the AUTOLOAD mechanism.
704 =head2 Guidelines for Module Creation
708 =item Do similar modules already exist in some form?
710 If so, please try to reuse the existing modules either in whole or
711 by inheriting useful features into a new class. If this is not
712 practical try to get together with the module authors to work on
713 extending or enhancing the functionality of the existing modules.
714 A perfect example is the plethora of packages in perl4 for dealing
715 with command line options.
717 If you are writing a module to expand an already existing set of
718 modules, please coordinate with the author of the package. It
719 helps if you follow the same naming scheme and module interaction
720 scheme as the original author.
722 =item Try to design the new module to be easy to extend and reuse.
724 Use blessed references. Use the two argument form of bless to bless
725 into the class name given as the first parameter of the constructor,
730 return bless {}, $class;
733 or even this if you'd like it to be used as either a static
738 my $class = ref($self) || $self;
739 return bless {}, $class;
742 Pass arrays as references so more parameters can be added later
743 (it's also faster). Convert functions into methods where
744 appropriate. Split large methods into smaller more flexible ones.
745 Inherit methods from other modules if appropriate.
747 Avoid class name tests like: C<die "Invalid" unless ref $ref eq 'FOO'>.
748 Generally you can delete the "C<eq 'FOO'>" part with no harm at all.
749 Let the objects look after themselves! Generally, avoid hard-wired
750 class names as far as possible.
752 Avoid C<$r-E<gt>Class::func()> where using C<@ISA=qw(... Class ...)> and
753 C<$r-E<gt>func()> would work (see L<perlbot> for more details).
755 Use autosplit so little used or newly added functions won't be a
756 burden to programs which don't use them. Add test functions to
757 the module after __END__ either using AutoSplit or by saying:
759 eval join('',<main::DATA>) || die $@ unless caller();
761 Does your module pass the 'empty subclass' test? If you say
762 "C<@SUBCLASS::ISA = qw(YOURCLASS);>" your applications should be able
763 to use SUBCLASS in exactly the same way as YOURCLASS. For example,
764 does your application still work if you change: C<$obj = new YOURCLASS;>
765 into: C<$obj = new SUBCLASS;> ?
767 Avoid keeping any state information in your packages. It makes it
768 difficult for multiple other packages to use yours. Keep state
769 information in objects.
771 Always use B<-w>. Try to C<use strict;> (or C<use strict qw(...);>).
772 Remember that you can add C<no strict qw(...);> to individual blocks
773 of code which need less strictness. Always use B<-w>. Always use B<-w>!
774 Follow the guidelines in the perlstyle(1) manual.
776 =item Some simple style guidelines
778 The perlstyle manual supplied with perl has many helpful points.
780 Coding style is a matter of personal taste. Many people evolve their
781 style over several years as they learn what helps them write and
782 maintain good code. Here's one set of assorted suggestions that
783 seem to be widely used by experienced developers:
785 Use underscores to separate words. It is generally easier to read
786 $var_names_like_this than $VarNamesLikeThis, especially for
787 non-native speakers of English. It's also a simple rule that works
788 consistently with VAR_NAMES_LIKE_THIS.
790 Package/Module names are an exception to this rule. Perl informally
791 reserves lowercase module names for 'pragma' modules like integer
792 and strict. Other modules normally begin with a capital letter and
793 use mixed case with no underscores (need to be short and portable).
795 You may find it helpful to use letter case to indicate the scope
796 or nature of a variable. For example:
798 $ALL_CAPS_HERE constants only (beware clashes with perl vars)
799 $Some_Caps_Here package-wide global/static
800 $no_caps_here function scope my() or local() variables
802 Function and method names seem to work best as all lowercase.
803 e.g., C<$obj-E<gt>as_string()>.
805 You can use a leading underscore to indicate that a variable or
806 function should not be used outside the package that defined it.
808 =item Select what to export.
810 Do NOT export method names!
812 Do NOT export anything else by default without a good reason!
814 Exports pollute the namespace of the module user. If you must
815 export try to use @EXPORT_OK in preference to @EXPORT and avoid
816 short or common names to reduce the risk of name clashes.
818 Generally anything not exported is still accessible from outside the
819 module using the ModuleName::item_name (or C<$blessed_ref-E<gt>method>)
820 syntax. By convention you can use a leading underscore on names to
821 indicate informally that they are 'internal' and not for public use.
823 (It is actually possible to get private functions by saying:
824 C<my $subref = sub { ... }; &$subref;>. But there's no way to call that
825 directly as a method, because a method must have a name in the symbol
828 As a general rule, if the module is trying to be object oriented
829 then export nothing. If it's just a collection of functions then
830 @EXPORT_OK anything but use @EXPORT with caution.
832 =item Select a name for the module.
834 This name should be as descriptive, accurate, and complete as
835 possible. Avoid any risk of ambiguity. Always try to use two or
836 more whole words. Generally the name should reflect what is special
837 about what the module does rather than how it does it. Please use
838 nested module names to group informally or categorize a module.
839 There should be a very good reason for a module not to have a nested name.
840 Module names should begin with a capital letter.
842 Having 57 modules all called Sort will not make life easy for anyone
843 (though having 23 called Sort::Quick is only marginally better :-).
844 Imagine someone trying to install your module alongside many others.
845 If in any doubt ask for suggestions in comp.lang.perl.misc.
847 If you are developing a suite of related modules/classes it's good
848 practice to use nested classes with a common prefix as this will
849 avoid namespace clashes. For example: Xyz::Control, Xyz::View,
850 Xyz::Model etc. Use the modules in this list as a naming guide.
852 If adding a new module to a set, follow the original author's
853 standards for naming modules and the interface to methods in
856 To be portable each component of a module name should be limited to
857 11 characters. If it might be used on MS-DOS then try to ensure each is
858 unique in the first 8 characters. Nested modules make this easier.
860 =item Have you got it right?
862 How do you know that you've made the right decisions? Have you
863 picked an interface design that will cause problems later? Have
864 you picked the most appropriate name? Do you have any questions?
866 The best way to know for sure, and pick up many helpful suggestions,
867 is to ask someone who knows. Comp.lang.perl.misc is read by just about
868 all the people who develop modules and it's the best place to ask.
870 All you need to do is post a short summary of the module, its
871 purpose and interfaces. A few lines on each of the main methods is
872 probably enough. (If you post the whole module it might be ignored
873 by busy people - generally the very people you want to read it!)
875 Don't worry about posting if you can't say when the module will be
876 ready - just say so in the message. It might be worth inviting
877 others to help you, they may be able to complete it for you!
879 =item README and other Additional Files.
881 It's well known that software developers usually fully document the
882 software they write. If, however, the world is in urgent need of
883 your software and there is not enough time to write the full
884 documentation please at least provide a README file containing:
889 A description of the module/package/extension etc.
892 A copyright notice - see below.
895 Prerequisites - what else you may need to have.
898 How to build it - possible changes to Makefile.PL etc.
904 Recent changes in this release, especially incompatibilities
907 Changes / enhancements you plan to make in the future.
911 If the README file seems to be getting too large you may wish to
912 split out some of the sections into separate files: INSTALL,
917 =item Adding a Copyright Notice.
919 How you choose to license your work is a personal decision.
920 The general mechanism is to assert your Copyright and then make
921 a declaration of how others may copy/use/modify your work.
923 Perl, for example, is supplied with two types of licence: The GNU
924 GPL and The Artistic Licence (see the files README, Copying, and
925 Artistic). Larry has good reasons for NOT just using the GNU GPL.
927 My personal recommendation, out of respect for Larry, Perl, and the
928 perl community at large is to state something simply like:
930 Copyright (c) 1995 Your Name. All rights reserved.
931 This program is free software; you can redistribute it and/or
932 modify it under the same terms as Perl itself.
934 This statement should at least appear in the README file. You may
935 also wish to include it in a Copying file and your source files.
936 Remember to include the other words in addition to the Copyright.
938 =item Give the module a version/issue/release number.
940 To be fully compatible with the Exporter and MakeMaker modules you
941 should store your module's version number in a non-my package
942 variable called $VERSION. This should be a floating point
943 number with at least two digits after the decimal (i.e., hundredths,
944 e.g, C<$VERSION = "0.01">). Don't use a "1.3.2" style version.
945 See Exporter.pm in Perl5.001m or later for details.
947 It may be handy to add a function or method to retrieve the number.
948 Use the number in announcements and archive file names when
949 releasing the module (ModuleName-1.02.tar.Z).
950 See perldoc ExtUtils::MakeMaker.pm for details.
952 =item How to release and distribute a module.
954 It's good idea to post an announcement of the availability of your
955 module (or the module itself if small) to the comp.lang.perl.announce
956 Usenet newsgroup. This will at least ensure very wide once-off
959 If possible you should place the module into a major ftp archive and
960 include details of its location in your announcement.
962 Some notes about ftp archives: Please use a long descriptive file
963 name which includes the version number. Most incoming directories
964 will not be readable/listable, i.e., you won't be able to see your
965 file after uploading it. Remember to send your email notification
966 message as soon as possible after uploading else your file may get
967 deleted automatically. Allow time for the file to be processed
968 and/or check the file has been processed before announcing its
971 FTP Archives for Perl Modules:
973 Follow the instructions and links on
975 http://franz.ww.tu-berlin.de/modulelist
977 or upload to one of these sites:
979 ftp://franz.ww.tu-berlin.de/incoming
980 ftp://ftp.cis.ufl.edu/incoming
982 and notify <F<upload@franz.ww.tu-berlin.de>>.
984 By using the WWW interface you can ask the Upload Server to mirror
985 your modules from your ftp or WWW site into your own directory on
988 Please remember to send me an updated entry for the Module list!
990 =item Take care when changing a released module.
992 Always strive to remain compatible with previous released versions
993 (see 2.2 above) Otherwise try to add a mechanism to revert to the
994 old behaviour if people rely on it. Document incompatible changes.
1000 =head2 Guidelines for Converting Perl 4 Library Scripts into Modules
1004 =item There is no requirement to convert anything.
1006 If it ain't broke, don't fix it! Perl 4 library scripts should
1007 continue to work with no problems. You may need to make some minor
1008 changes (like escaping non-array @'s in double quoted strings) but
1009 there is no need to convert a .pl file into a Module for just that.
1011 =item Consider the implications.
1013 All the perl applications which make use of the script will need to
1014 be changed (slightly) if the script is converted into a module. Is
1015 it worth it unless you plan to make other changes at the same time?
1017 =item Make the most of the opportunity.
1019 If you are going to convert the script to a module you can use the
1020 opportunity to redesign the interface. The 'Guidelines for Module
1021 Creation' above include many of the issues you should consider.
1023 =item The pl2pm utility will get you started.
1025 This utility will read *.pl files (given as parameters) and write
1026 corresponding *.pm files. The pl2pm utilities does the following:
1031 Adds the standard Module prologue lines
1034 Converts package specifiers from ' to ::
1037 Converts die(...) to croak(...)
1040 Several other minor changes
1044 Being a mechanical process pl2pm is not bullet proof. The converted
1045 code will need careful checking, especially any package statements.
1046 Don't delete the original .pl file till the new .pm one works!
1050 =head2 Guidelines for Reusing Application Code
1054 =item Complete applications rarely belong in the Perl Module Library.
1056 =item Many applications contain some perl code which could be reused.
1058 Help save the world! Share your code in a form that makes it easy
1061 =item Break-out the reusable code into one or more separate module files.
1063 =item Take the opportunity to reconsider and redesign the interfaces.
1065 =item In some cases the 'application' can then be reduced to a small
1067 fragment of code built on top of the reusable modules. In these cases
1068 the application could invoked as:
1070 perl -e 'use Module::Name; method(@ARGV)' ...
1072 perl -mModule::Name ... (in perl5.002 or higher)
1078 Perl does not enforce private and public parts of its modules as you may
1079 have been used to in other languages like C++, Ada, or Modula-17. Perl
1080 doesn't have an infatuation with enforced privacy. It would prefer
1081 that you stayed out of its living room because you weren't invited, not
1082 because it has a shotgun.
1084 The module and its user have a contract, part of which is common law,
1085 and part of which is "written". Part of the common law contract is
1086 that a module doesn't pollute any namespace it wasn't asked to. The
1087 written contract for the module (A.K.A. documentation) may make other
1088 provisions. But then you know when you C<use RedefineTheWorld> that
1089 you're redefining the world and willing to take the consequences.