This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Reapply "docs: clarify effect of $^H, %^H, ${^WARNING_BITS}"
[perl5.git] / pod / perlmodlib.PL
1 #!../miniperl
2
3 use strict;
4 use warnings;
5
6 local $ENV{LC_ALL} = 'C';
7
8 my $Quiet;
9 @ARGV = grep { not($_ eq '-q' and $Quiet = 1) } @ARGV;
10
11 if (@ARGV) {
12     my $workdir = shift;
13     chdir $workdir
14         or die "Couldn't chdir to '$workdir': $!";
15 }
16 require './regen/regen_lib.pl';
17
18 # MANIFEST itself is Unix style filenames, so we have to assume that Unix style
19 # filenames will work.
20
21 open MANIFEST, '<', 'MANIFEST'
22     or die "Can't open MANIFEST: $!";
23 my @files =
24     grep !m#/perl.*\.pod#,
25     grep m#(?:\.pm|\.pod|_pm\.PL)#,
26     map {s/\s.*//s; $_}
27     grep { m#^(lib|ext|dist|cpan)/# && !m#/(?:t|demo|corpus)/# }
28     <MANIFEST>;
29 close MANIFEST
30     or die "$0: failed to close MANIFEST: $!";
31
32 my $out = open_new('pod/perlmodlib.pod', undef,
33                    {by => "$0 extracting documentation",
34                     from => 'the Perl source files'}, 1);
35
36 my %exceptions = (
37     'abbrev' => 'Text::Abbrev',
38     'carp' => 'Carp',
39     'getopt' => 'Getopt::Std',
40     'Encode::MIME::NAME' => 'Encode::MIME::Name',
41     'libnetFAQ' => 'Net::libnetFAQ',
42 );
43
44 my (@pragma, @mod);
45
46 for my $filename (@files) {
47     unless (open MOD, '<', $filename) {
48         warn "Couldn't open $filename: $!";
49         next;
50     }
51
52     my ($name, $thing);
53     my $foundit = 0;
54     {
55         local $/ = "";
56         while (<MOD>) {
57             next unless /^=head1 NAME/;
58             $foundit++;
59             last;
60         }
61     }
62     unless ($foundit) {
63         next if pod_for_module_has_head1_NAME($filename);
64         die "p5p-controlled module $filename missing =head1 NAME\n"
65             if $filename !~ m{^(dist/|cpan/)}n # under our direct control
66             && $filename !~ m{/_[^/]+\z}       # not private
67             && $filename ne 'lib/meta_notation.pm'      # no pod
68             && $filename ne 'lib/overload/numbers.pm';  # no pod
69         warn "$filename missing =head1 NAME\n" unless $Quiet;
70         next;
71     }
72     my $title = <MOD>;
73     chomp $title;
74     close MOD
75         or die "Error closing $filename: $!";
76
77     ($name, $thing) = split /\s+--?\s+/, $title, 2;
78
79     unless ($name and $thing) {
80         warn "$filename missing name\n"  unless $name;
81         warn "$filename missing thing\n" unless $thing or $Quiet;
82         next;
83     }
84
85     $name =~ s/[^A-Za-z0-9_:\$<>].*//;
86     $name = $exceptions{$name} || $name;
87     $thing =~ s/^perl pragma to //i;
88     $thing = ucfirst $thing;
89     $title = "=item $name\n\n$thing\n\n";
90
91     if ($name =~ /[A-Z]/) {
92         push @mod, $title;
93     } else {
94         push @pragma, $title;
95     }
96 }
97
98 sub pod_for_module_has_head1_NAME {
99     my ($filename) = @_;
100     (my $pod_file = $filename) =~ s/\.pm\z/.pod/ or return 0;
101     return 0 if !-e $pod_file;
102     open my $fh, '<', $pod_file
103         or die "Can't open $pod_file for reading: $!\n";
104     local $/ = '';
105     while (my $para = <$fh>) {
106         return 1 if $para =~ /\A=head1 NAME$/m;
107     }
108     return 0;
109 }
110
111 # Much easier to special case it like this than special case the depending on
112 # and parsing lib/Config.pod, or special case opening configpm and finding its
113 # =head1 (which is not found with the $/="" above)
114 push @mod, "=item Config\n\nAccess Perl configuration information\n\n";
115
116
117 # The intent of using =cut as the heredoc terminator is to make the whole file
118 # parse as (reasonably) sane Pod as-is to anything that attempts to
119 # brute-force treat it as such. The content is already useful - this just
120 # makes it tidier, by stopping anything doing this mistaking the rest of the
121 # Perl code for Pod. eg https://metacpan.org/pod/perlmodlib
122
123 print $out <<'=cut';
124 =head1 NAME
125
126 perlmodlib - constructing new Perl modules and finding existing ones
127
128 =head1 THE PERL MODULE LIBRARY
129
130 Many modules are included in the Perl distribution.  These are described
131 below, and all end in F<.pm>.  You may discover compiled library
132 files (usually ending in F<.so>) or small pieces of modules to be
133 autoloaded (ending in F<.al>); these were automatically generated
134 by the installation process.  You may also discover files in the
135 library directory that end in either F<.pl> or F<.ph>.  These are
136 old libraries supplied so that old programs that use them still
137 run.  The F<.pl> files will all eventually be converted into standard
138 modules, and the F<.ph> files made by B<h2ph> will probably end up
139 as extension modules made by B<h2xs>.  (Some F<.ph> values may
140 already be available through the POSIX, Errno, or Fcntl modules.)
141 The B<pl2pm> file in the distribution may help in your conversion,
142 but it's just a mechanical process and therefore far from bulletproof.
143
144 =head2 Pragmatic Modules
145
146 They work somewhat like compiler directives (pragmata) in that they
147 tend to affect the compilation of your program, and thus will usually
148 work well only when used within a C<use>, or C<no>.  Most of these
149 are lexically scoped, so an inner BLOCK may countermand them
150 by saying:
151
152     no integer;
153     no strict 'refs';
154     no warnings;
155
156 which lasts until the end of that BLOCK.
157
158 Some pragmas are lexically scoped--typically those that affect the
159 C<$^H> hints variable.  Others affect the current package instead,
160 like C<use vars> and C<use subs>, which allow you to predeclare a
161 variables or subroutines within a particular I<file> rather than
162 just a block.  Such declarations are effective for the entire file
163 for which they were declared.  You cannot rescind them with C<no
164 vars> or C<no subs>.
165
166 The following pragmas are defined (and have their own documentation).
167
168 =over 12
169
170 =cut
171
172 print $out $_ for sort @pragma;
173
174 print $out <<'=cut';
175
176 =back
177
178 =head2 Standard Modules
179
180 Standard, bundled modules are all expected to behave in a well-defined
181 manner with respect to namespace pollution because they use the
182 Exporter module.  See their own documentation for details.
183
184 It's possible that not all modules listed below are installed on your
185 system. For example, the GDBM_File module will not be installed if you
186 don't have the gdbm library.
187
188 =over 12
189
190 =cut
191
192 print $out $_ for sort @mod;
193
194 print $out <<'=cut', "=cut\n";
195
196 =back
197
198 To find out I<all> modules installed on your system, including
199 those without documentation or outside the standard release,
200 just use the following command (under the default win32 shell,
201 double quotes should be used instead of single quotes).
202
203     % perl -MFile::Find=find -MFile::Spec::Functions -Tlwe \
204       'find { wanted => sub { print canonpath $_ if /\.pm\z/ },
205       no_chdir => 1 }, @INC'
206
207 (The -T is here to prevent '.' from being listed in @INC.)
208 They should all have their own documentation installed and accessible
209 via your system man(1) command.  If you do not have a B<find>
210 program, you can use the Perl B<find2perl> program instead, which
211 generates Perl code as output you can run through perl.  If you
212 have a B<man> program but it doesn't find your modules, you'll have
213 to fix your manpath.  See L<perl> for details.  If you have no
214 system B<man> command, you might try the B<perldoc> program.
215
216 Note also that the command C<perldoc perllocal> gives you a (possibly
217 incomplete) list of the modules that have been further installed on
218 your system. (The perllocal.pod file is updated by the standard MakeMaker
219 install process.)
220
221 =head2 Extension Modules
222
223 Extension modules are written in C (or a mix of Perl and C).  They
224 are usually dynamically loaded into Perl if and when you need them,
225 but may also be linked in statically.  Supported extension modules
226 include Socket, Fcntl, and POSIX.
227
228 Many popular C extension modules do not come bundled (at least, not
229 completely) due to their sizes, volatility, or simply lack of time
230 for adequate testing and configuration across the multitude of
231 platforms on which Perl was beta-tested.  You are encouraged to
232 look for them on CPAN (described below), or using web search engines
233 like Google or DuckDuckGo.
234
235 =head1 CPAN
236
237 CPAN stands for Comprehensive Perl Archive Network; it's a globally
238 replicated trove of Perl materials, including documentation, style
239 guides, tricks and traps, alternate ports to non-Unix systems and
240 occasional binary distributions for these.   Search engines for
241 CPAN can be found at https://www.cpan.org/
242
243 Most importantly, CPAN includes around a thousand unbundled modules,
244 some of which require a C compiler to build.  Major categories of
245 modules are:
246
247 =over
248
249 =item *
250
251 Language Extensions and Documentation Tools
252
253 =item *
254
255 Development Support
256
257 =item *
258
259 Operating System Interfaces
260
261 =item *
262
263 Networking, Device Control (modems) and InterProcess Communication
264
265 =item *
266
267 Data Types and Data Type Utilities
268
269 =item *
270
271 Database Interfaces
272
273 =item *
274
275 User Interfaces
276
277 =item *
278
279 Interfaces to / Emulations of Other Programming Languages
280
281 =item *
282
283 File Names, File Systems and File Locking (see also File Handles)
284
285 =item *
286
287 String Processing, Language Text Processing, Parsing, and Searching
288
289 =item *
290
291 Option, Argument, Parameter, and Configuration File Processing
292
293 =item *
294
295 Internationalization and Locale
296
297 =item *
298
299 Authentication, Security, and Encryption
300
301 =item *
302
303 World Wide Web, HTML, HTTP, CGI, MIME
304
305 =item *
306
307 Server and Daemon Utilities
308
309 =item *
310
311 Archiving and Compression
312
313 =item *
314
315 Images, Pixmap and Bitmap Manipulation, Drawing, and Graphing
316
317 =item *
318
319 Mail and Usenet News
320
321 =item *
322
323 Control Flow Utilities (callbacks and exceptions etc)
324
325 =item *
326
327 File Handle and Input/Output Stream Utilities
328
329 =item *
330
331 Miscellaneous Modules
332
333 =back
334
335 You can find the CPAN online at L<https://www.cpan.org/>
336
337 =head1 Modules: Creation, Use, and Abuse
338
339 (The following section is borrowed directly from Tim Bunce's modules
340 file, available at your nearest CPAN site.)
341
342 Perl implements a class using a package, but the presence of a
343 package doesn't imply the presence of a class.  A package is just a
344 namespace.  A class is a package that provides subroutines that can be
345 used as methods.  A method is just a subroutine that expects, as its
346 first argument, either the name of a package (for "static" methods),
347 or a reference to something (for "virtual" methods).
348
349 A module is a file that (by convention) provides a class of the same
350 name (sans the .pm), plus an import method in that class that can be
351 called to fetch exported symbols.  This module may implement some of
352 its methods by loading dynamic C or C++ objects, but that should be
353 totally transparent to the user of the module.  Likewise, the module
354 might set up an AUTOLOAD function to slurp in subroutine definitions on
355 demand, but this is also transparent.  Only the F<.pm> file is required to
356 exist.  See L<perlsub>, L<perlobj>, and L<AutoLoader> for details about
357 the AUTOLOAD mechanism.
358
359 =head2 Guidelines for Module Creation
360
361 =over 4
362
363 =item  *
364
365 Do similar modules already exist in some form?
366
367 If so, please try to reuse the existing modules either in whole or
368 by inheriting useful features into a new class.  If this is not
369 practical try to get together with the module authors to work on
370 extending or enhancing the functionality of the existing modules.
371 A perfect example is the plethora of packages in perl4 for dealing
372 with command line options.
373
374 If you are writing a module to expand an already existing set of
375 modules, please coordinate with the author of the package.  It
376 helps if you follow the same naming scheme and module interaction
377 scheme as the original author.
378
379 =item  *
380
381 Try to design the new module to be easy to extend and reuse.
382
383 Try to C<use warnings;> (or C<use warnings qw(...);>).
384 Remember that you can add C<no warnings qw(...);> to individual blocks
385 of code that need less warnings.
386
387 Use blessed references.  Use the two argument form of bless to bless
388 into the class name given as the first parameter of the constructor,
389 e.g.,:
390
391  sub new {
392      my $class = shift;
393      return bless {}, $class;
394  }
395
396 or even this if you'd like it to be used as either a static
397 or a virtual method.
398
399  sub new {
400      my $self  = shift;
401      my $class = ref($self) || $self;
402      return bless {}, $class;
403  }
404
405 Pass arrays as references so more parameters can be added later
406 (it's also faster).  Convert functions into methods where
407 appropriate.  Split large methods into smaller more flexible ones.
408 Inherit methods from other modules if appropriate.
409
410 Avoid class name tests like: C<die "Invalid" unless ref $ref eq 'FOO'>.
411 Generally you can delete the C<eq 'FOO'> part with no harm at all.
412 Let the objects look after themselves! Generally, avoid hard-wired
413 class names as far as possible.
414
415 Avoid C<< $r->Class::func() >> where using C<@ISA=qw(... Class ...)> and
416 C<< $r->func() >> would work.
417
418 Use autosplit so little used or newly added functions won't be a
419 burden to programs that don't use them. Add test functions to
420 the module after __END__ either using AutoSplit or by saying:
421
422  eval join('',<main::DATA>) || die $@ unless caller();
423
424 Does your module pass the 'empty subclass' test? If you say
425 C<@SUBCLASS::ISA = qw(YOURCLASS);> your applications should be able
426 to use SUBCLASS in exactly the same way as YOURCLASS.  For example,
427 does your application still work if you change:  C<< $obj = YOURCLASS->new(); >>
428 into: C<< $obj = SUBCLASS->new(); >> ?
429
430 Avoid keeping any state information in your packages. It makes it
431 difficult for multiple other packages to use yours. Keep state
432 information in objects.
433
434 Always use B<-w>.
435
436 Try to C<use strict;> (or C<use strict qw(...);>).
437 Remember that you can add C<no strict qw(...);> to individual blocks
438 of code that need less strictness.
439
440 Always use B<-w>.
441
442 Follow the guidelines in L<perlstyle>.
443
444 Always use B<-w>.
445
446 =item  *
447
448 Some simple style guidelines
449
450 The perlstyle manual supplied with Perl has many helpful points.
451
452 Coding style is a matter of personal taste. Many people evolve their
453 style over several years as they learn what helps them write and
454 maintain good code.  Here's one set of assorted suggestions that
455 seem to be widely used by experienced developers:
456
457 Use underscores to separate words.  It is generally easier to read
458 $var_names_like_this than $VarNamesLikeThis, especially for
459 non-native speakers of English. It's also a simple rule that works
460 consistently with VAR_NAMES_LIKE_THIS.
461
462 Package/Module names are an exception to this rule. Perl informally
463 reserves lowercase module names for 'pragma' modules like integer
464 and strict. Other modules normally begin with a capital letter and
465 use mixed case with no underscores (need to be short and portable).
466
467 You may find it helpful to use letter case to indicate the scope
468 or nature of a variable. For example:
469
470  $ALL_CAPS_HERE   constants only (beware clashes with Perl vars)
471  $Some_Caps_Here  package-wide global/static
472  $no_caps_here    function scope my() or local() variables
473
474 Function and method names seem to work best as all lowercase.
475 e.g., C<< $obj->as_string() >>.
476
477 You can use a leading underscore to indicate that a variable or
478 function should not be used outside the package that defined it.
479
480 =item  *
481
482 Select what to export.
483
484 Do NOT export method names!
485
486 Do NOT export anything else by default without a good reason!
487
488 Exports pollute the namespace of the module user.  If you must
489 export try to use @EXPORT_OK in preference to @EXPORT and avoid
490 short or common names to reduce the risk of name clashes.
491
492 Generally anything not exported is still accessible from outside the
493 module using the ModuleName::item_name (or C<< $blessed_ref->method >>)
494 syntax.  By convention you can use a leading underscore on names to
495 indicate informally that they are 'internal' and not for public use.
496
497 (It is actually possible to get private functions by saying:
498 C<my $subref = sub { ... };  &$subref;>.  But there's no way to call that
499 directly as a method, because a method must have a name in the symbol
500 table.)
501
502 As a general rule, if the module is trying to be object oriented
503 then export nothing. If it's just a collection of functions then
504 @EXPORT_OK anything but use @EXPORT with caution.
505
506 =item  *
507
508 Select a name for the module.
509
510 This name should be as descriptive, accurate, and complete as
511 possible.  Avoid any risk of ambiguity. Always try to use two or
512 more whole words.  Generally the name should reflect what is special
513 about what the module does rather than how it does it.  Please use
514 nested module names to group informally or categorize a module.
515 There should be a very good reason for a module not to have a nested name.
516 Module names should begin with a capital letter.
517
518 Having 57 modules all called Sort will not make life easy for anyone
519 (though having 23 called Sort::Quick is only marginally better :-).
520 Imagine someone trying to install your module alongside many others.
521
522 If you are developing a suite of related modules/classes it's good
523 practice to use nested classes with a common prefix as this will
524 avoid namespace clashes. For example: Xyz::Control, Xyz::View,
525 Xyz::Model etc. Use the modules in this list as a naming guide.
526
527 If adding a new module to a set, follow the original author's
528 standards for naming modules and the interface to methods in
529 those modules.
530
531 If developing modules for private internal or project specific use,
532 that will never be released to the public, then you should ensure
533 that their names will not clash with any future public module. You
534 can do this either by using the reserved Local::* category or by
535 using a category name that includes an underscore like Foo_Corp::*.
536
537 To be portable each component of a module name should be limited to
538 11 characters. If it might be used on MS-DOS then try to ensure each is
539 unique in the first 8 characters. Nested modules make this easier.
540
541 For additional guidance on the naming of modules, please consult:
542
543     https://pause.perl.org/pause/query?ACTION=pause_namingmodules
544
545 or send mail to the <module-authors@perl.org> mailing list.
546
547 =item  *
548
549 Have you got it right?
550
551 How do you know that you've made the right decisions? Have you
552 picked an interface design that will cause problems later? Have
553 you picked the most appropriate name? Do you have any questions?
554
555 The best way to know for sure, and pick up many helpful suggestions,
556 is to ask someone who knows. The <module-authors@perl.org> mailing list
557 is useful for this purpose; it's also accessible via news interface as
558 perl.module-authors at nntp.perl.org.
559
560 All you need to do is post a short summary of the module, its
561 purpose and interfaces. A few lines on each of the main methods is
562 probably enough. (If you post the whole module it might be ignored
563 by busy people - generally the very people you want to read it!)
564
565 Don't worry about posting if you can't say when the module will be
566 ready - just say so in the message. It might be worth inviting
567 others to help you, they may be able to complete it for you!
568
569 =item  *
570
571 README and other Additional Files.
572
573 It's well known that software developers usually fully document the
574 software they write. If, however, the world is in urgent need of
575 your software and there is not enough time to write the full
576 documentation please at least provide a README file containing:
577
578 =over 10
579
580 =item *
581
582 A description of the module/package/extension etc.
583
584 =item *
585
586 A copyright notice - see below.
587
588 =item *
589
590 Prerequisites - what else you may need to have.
591
592 =item *
593
594 How to build it - possible changes to Makefile.PL etc.
595
596 =item *
597
598 How to install it.
599
600 =item *
601
602 Recent changes in this release, especially incompatibilities
603
604 =item *
605
606 Changes / enhancements you plan to make in the future.
607
608 =back
609
610 If the README file seems to be getting too large you may wish to
611 split out some of the sections into separate files: INSTALL,
612 Copying, ToDo etc.
613
614 =over 4
615
616 =item *
617
618 Adding a Copyright Notice.
619
620 How you choose to license your work is a personal decision.
621 The general mechanism is to assert your Copyright and then make
622 a declaration of how others may copy/use/modify your work.
623
624 Perl, for example, is supplied with two types of licence: The GNU GPL
625 and The Artistic Licence (see the files README, Copying, and Artistic,
626 or L<perlgpl> and L<perlartistic>).  Larry has good reasons for NOT
627 just using the GNU GPL.
628
629 My personal recommendation, out of respect for Larry, Perl, and the
630 Perl community at large is to state something simply like:
631
632  Copyright (c) 1995 Your Name. All rights reserved.
633  This program is free software; you can redistribute it and/or
634  modify it under the same terms as Perl itself.
635
636 This statement should at least appear in the README file. You may
637 also wish to include it in a Copying file and your source files.
638 Remember to include the other words in addition to the Copyright.
639
640 =item  *
641
642 Give the module a version/issue/release number.
643
644 To be fully compatible with the Exporter and MakeMaker modules you
645 should store your module's version number in a non-my package
646 variable called $VERSION.  This should be a positive floating point
647 number with at least two digits after the decimal (i.e., hundredths,
648 e.g, C<$VERSION = "0.01">).  Don't use a "1.3.2" style version.
649 See L<Exporter> for details.
650
651 It may be handy to add a function or method to retrieve the number.
652 Use the number in announcements and archive file names when
653 releasing the module (ModuleName-1.02.tar.Z).
654 See perldoc ExtUtils::MakeMaker.pm for details.
655
656 =item  *
657
658 How to release and distribute a module.
659
660 If possible, register the module with CPAN. Follow the instructions
661 and links on:
662
663    https://www.cpan.org/modules/04pause.html
664
665 and upload to:
666
667    https://pause.perl.org/
668
669 and notify <modules@perl.org>. This will allow anyone to install
670 your module using the C<cpan> tool distributed with Perl.
671
672 By using the WWW interface you can ask the Upload Server to mirror
673 your modules from your ftp or WWW site into your own directory on
674 CPAN!
675
676 =item  *
677
678 Take care when changing a released module.
679
680 Always strive to remain compatible with previous released versions.
681 Otherwise try to add a mechanism to revert to the
682 old behavior if people rely on it.  Document incompatible changes.
683
684 =back
685
686 =back
687
688 =head2 Guidelines for Converting Perl 4 Library Scripts into Modules
689
690 =over 4
691
692 =item  *
693
694 There is no requirement to convert anything.
695
696 If it ain't broke, don't fix it! Perl 4 library scripts should
697 continue to work with no problems. You may need to make some minor
698 changes (like escaping non-array @'s in double quoted strings) but
699 there is no need to convert a .pl file into a Module for just that.
700
701 =item  *
702
703 Consider the implications.
704
705 All Perl applications that make use of the script will need to
706 be changed (slightly) if the script is converted into a module.  Is
707 it worth it unless you plan to make other changes at the same time?
708
709 =item  *
710
711 Make the most of the opportunity.
712
713 If you are going to convert the script to a module you can use the
714 opportunity to redesign the interface.  The guidelines for module
715 creation above include many of the issues you should consider.
716
717 =item  *
718
719 The pl2pm utility will get you started.
720
721 This utility will read *.pl files (given as parameters) and write
722 corresponding *.pm files. The pl2pm utilities does the following:
723
724 =over 10
725
726 =item *
727
728 Adds the standard Module prologue lines
729
730 =item *
731
732 Converts package specifiers from ' to ::
733
734 =item *
735
736 Converts die(...) to croak(...)
737
738 =item *
739
740 Several other minor changes
741
742 =back
743
744 Being a mechanical process pl2pm is not bullet proof. The converted
745 code will need careful checking, especially any package statements.
746 Don't delete the original .pl file till the new .pm one works!
747
748 =back
749
750 =head2 Guidelines for Reusing Application Code
751
752 =over 4
753
754 =item  *
755
756 Complete applications rarely belong in the Perl Module Library.
757
758 =item  *
759
760 Many applications contain some Perl code that could be reused.
761
762 Help save the world! Share your code in a form that makes it easy
763 to reuse.
764
765 =item  *
766
767 Break-out the reusable code into one or more separate module files.
768
769 =item  *
770
771 Take the opportunity to reconsider and redesign the interfaces.
772
773 =item  *
774
775 In some cases the 'application' can then be reduced to a small
776
777 fragment of code built on top of the reusable modules. In these cases
778 the application could invoked as:
779
780      % perl -e 'use Module::Name; method(@ARGV)' ...
781 or
782      % perl -mModule::Name ...    (in perl5.002 or higher)
783
784 =back
785
786 =head1 NOTE
787
788 Perl does not enforce private and public parts of its modules as you may
789 have been used to in other languages like C++, Ada, or Modula-17.  Perl
790 doesn't have an infatuation with enforced privacy.  It would prefer
791 that you stayed out of its living room because you weren't invited, not
792 because it has a shotgun.
793
794 The module and its user have a contract, part of which is common law,
795 and part of which is "written".  Part of the common law contract is
796 that a module doesn't pollute any namespace it wasn't asked to.  The
797 written contract for the module (A.K.A. documentation) may make other
798 provisions.  But then you know when you C<use RedefineTheWorld> that
799 you're redefining the world and willing to take the consequences.
800
801 =cut
802
803 read_only_bottom_close_and_rename($out);