Retract #10003 and update the IDE descriptions a bit.
[p5sagit/p5-mst-13.2.git] / pod / perlmod.pod
index 676940e..01056f1 100644 (file)
@@ -8,7 +8,7 @@ perlmod - Perl modules (packages and symbol tables)
 
 Perl provides a mechanism for alternative namespaces to protect
 packages from stomping on each other's variables.  In fact, there's
-really no such thing as a global variable in Perl .  The package
+really no such thing as a global variable in Perl.  The package
 statement declares the compilation unit as being in the given
 namespace.  The scope of the package declaration is from the
 declaration itself through the end of the enclosing block, C<eval>,
@@ -61,8 +61,8 @@ as a pattern match, a substitution, or a transliteration.
 Variables beginning with underscore used to be forced into package
 main, but we decided it was more useful for package writers to be able
 to use leading underscore to indicate private variables and method names.
-$_ is still global though.  See also L<perlvar/"Technical Note on the
-Syntax of Variable Names">.
+$_ is still global though.  See also
+L<perlvar/"Technical Note on the Syntax of Variable Names">.
 
 C<eval>ed strings are compiled in the package in which the eval() was
 compiled.  (Assignments to C<$SIG{}>, however, assume the signal
@@ -96,6 +96,12 @@ table lookups at compile time:
     local *main::foo    = *main::bar;
     local $main::{foo}  = $main::{bar};
 
+(Be sure to note the B<vast> difference between the second line above
+and C<local $main::foo = $main::bar>. The former is accessing the hash
+C<%main::>, which is the symbol table of package C<main>. The latter is
+simply assigning scalar C<$bar> in package C<main> to scalar C<$foo> of
+the same package.)
+
 You can use this to print out all the variables in a package, for
 instance.  The standard but antiquated F<dumpvar.pl> library and
 the CPAN module Devel::Symdump make use of this.
@@ -139,7 +145,7 @@ Another use of symbol tables is for making "constant" scalars.
 
     *PI = \3.14159265358979;
 
-Now you cannot alter $PI, which is probably a good thing all in all.
+Now you cannot alter C<$PI>, which is probably a good thing all in all.
 This isn't the same as a constant subroutine, which is subject to
 optimization at compile-time.  A constant subroutine is one prototyped
 to take no arguments and to return a constant expression.  See 
@@ -233,7 +239,7 @@ being blown out of the water by a signal--you have to trap that yourself
 (if you can).)  You may have multiple C<END> blocks within a file--they
 will execute in reverse order of definition; that is: last in, first
 out (LIFO).  C<END> blocks are not executed when you run perl with the
-C<-c> switch.
+C<-c> switch, or if compilation fails.
 
 Inside an C<END> subroutine, C<$?> contains the value that the program is
 going to pass to C<exit()>.  You can modify C<$?> to change the exit
@@ -304,6 +310,10 @@ create a file called F<Some/Module.pm> and start with this template:
     }
     our @EXPORT_OK;
 
+    # exported package globals go here
+    our $Var1;
+    our %Hashit;
+
     # non-exported package globals go here
     our @more;
     our $stuff;