=head2 Packages
Perl provides a mechanism for alternative namespaces to protect packages
-from stomping on each others variables. In fact, apart from certain
+from stomping on each other's variables. In fact, apart from certain
magical variables, there's 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
refer to variables and filehandles in other packages by prefixing the
identifier with the package name and a double colon:
C<$Package::Variable>. If the package name is null, the C<main> package
-as assumed. That is, C<$::sail> is equivalent to C<$main::sail>.
+is assumed. That is, C<$::sail> is equivalent to C<$main::sail>.
(The old package delimiter was a single quote, but double colon
is now the preferred delimiter, in part because it's more readable
The symbol table for a package happens to be stored in the associative
array of that name appended with two colons. The main symbol table's
-name is thus C<%main::>, or C<%::> for short. Likewise the nested package
-mentioned earlier is named C<%OUTER::INNER::>.
+name is thus C<%main::>, or C<%::> for short. Likewise symbol table for
+the nested package mentioned earlier is named C<%OUTER::INNER::>.
The value in each entry of the associative array is what you are referring
to when you use the C<*name> typeglob notation. In fact, the following
*dick = *richard;
causes variables, subroutines and file handles accessible via the
-identifier C<richard> to also be accessible via the symbol C<dick>. If
+identifier C<richard> to also be accessible via the identifier C<dick>. If
you only want to alias a particular variable or subroutine, you can
assign a reference instead:
=head2 Perl Modules
-A module is a just package that is defined in a library file of
+A module is just a package that is defined in a library file of
the same name, and is designed to be reusable. It may do this by
providing a mechanism for exporting some of its symbols into the symbol
table of any package using it. Or it may function as a class
the F<.ph> files made by B<h2ph> will probably end up as extension modules
made by B<h2xs>. (Some F<.ph> values may already be available through the
POSIX module.) The B<pl2pm> file in the distribution may help in your
-conversion, but it's just a mechanical process, so is far from bullet proof.
+conversion, but it's just a mechanical process, so is far from bulletproof.
=head2 Pragmatic Modules
Pragma to request less of something from the compiler
+=item ops
+
+Pragma to restrict use of unsafe opcodes
+
=item overload
Pragma for overloading operators
Pragma to predeclare sub names
+=item vars
+
+Pragma to predeclare global symbols
+
=back
=head2 Standard Modules
load functions only on demand
+=item Safe
+
+Creation controlled compartments in which perl code can be evaluated.
+
=item Socket
load the C socket.h defines and structure manipulators
=back
-Some of the reguster CPAN sites as of this writing include the following.
+The registered CPAN sites as of this writing include the following.
You should try to choose one close to you:
=over
=back
For an up-to-date listing of CPAN sites,
-see http://www.perl.com/perl/ or ftp://ftp.perl.com/perl/ .
+see F<http://www.perl.com/perl/CPAN> or F<ftp://ftp.perl.com/perl/>.
=head1 Modules: Creation, Use and Abuse
Let the objects look after themselves! Generally, avoid hardwired
class names as far as possible.
-Avoid $r->Class::func() where using @ISA=qw(... Class ...) and
-$r->func() would work (see perlbot man page for more details).
+Avoid $r-E<gt>Class::func() where using @ISA=qw(... Class ...) and
+$r-E<gt>func() would work (see perlbot man page for more details).
Use autosplit so little used or newly added functions won't be a
burden to programs which don't use them. Add test functions to
$no_caps_here function scope my() or local() variables
Function and method names seem to work best as all lowercase.
-E.g., $obj->as_string().
+E.g., $obj-E<gt>as_string().
You can use a leading underscore to indicate that a variable or
function should not be used outside the package that defined it.
short or common names to reduce the risk of name clashes.
Generally anything not exported is still accessible from outside the
-module using the ModuleName::item_name (or $blessed_ref->method)
+module using the ModuleName::item_name (or $blessed_ref-E<gt>method)
syntax. By convention you can use a leading underscore on names to
informally indicate that they are 'internal' and not for public use.
split out some of the sections into separate files: INSTALL,
Copying, ToDo etc.
+=over 4
+
=item Adding a Copyright Notice.
How you choose to licence your work is a personal decision.
=back
+=back
+
=head2 Guidelines for Converting Perl 4 Library Scripts into Modules
=over 4
perl -e 'use Module::Name; method(@ARGV)' ...
or
- perl -mModule::Name ... (in perl5.002?)
+ perl -mModule::Name ... (in perl5.002)
=back