$ cat Maps.pm
package Island::Plotting::Maps;
It looks good so far. The module automatically starts with an
appropriate package directive. Following that, you
see:
use 5.008;
use strict;
use warnings;
Now you're declaring that the module is compatible
with Perl 5.8.0 or later and that the compiler restrictions and
warnings are enabled automatically. Good practices are encouraged
here. Obviously, you're free to delete or modify
anything inappropriate.
require Exporter;
our @ISA = qw(Exporter);
These lines support the import method call needed
to make use work. This is fine for a
nonobject-oriented module, but for an object-oriented module
inheriting from a parent (base) class, you'll want
to replace them with:
use base qw(Our::Parent::Class);
Resulting in more Exporter control:
our %EXPORT_TAGS = ( 'all' => [ qw(
) ] );
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
our @EXPORT = qw(
);
Now you're past the header information and down to
the core of your module. In the template, it is indicated by a simple
comment:
# Preloaded methods go here.
What? You didn't think the h2xs
tool would even write the module for you, now did you? Anyway, this
is where the code goes, usually as a series of subroutines, possibly
preceded by some shared module data (using my
declarations), and perhaps a few package variables (using
our declarations in recent Perl versions).
Following the code, you'll find your necessary true
value:
1;