Chapter 4
First, h2xs encourages you to be explicit about the version of Perl required by
your code:
use 5.006;
If this module were used in a version of Perl older than 5.6.0,
8
an error message
would be generated stating that a newer version of Perl is required. Actually, as
you'll see later, it's better to put this check in Makefile.PL, but the intent is the same.
Next h2xs includes the following use lines:
use strict;
use warnings;
So far, I've avoided the strict and warnings pragmas in order to keep the
examples simple, but the buck stops here. All CPAN modules should include use
strict and use warnings, and Data::Counter won't be an exception! By using these
two pragmas, your module will be free from the most common problems occurring in
Perl programs. For more information on these most useful of pragmas, see the
documentation for strict and warnings as well as the coverage in most good intro
ductory Perl books.
The next section of code deals with using the Exporter correctly. It not only
sets up @ISA but also includes helpful commentary about how to use the various
package variables employed by Exporter @EXPORT, @EXPORT_OK, and %EXPORT. This
might seem like overkill, but there was once a time when Exporter abuse was
rampant throughout CPAN. If you don't need to export any symbols, then you can
delete the entire section, until the $VERSION line.
The next line sets up $VERSION:
our $VERSION = 0.01 ;
This variable is needed by all CPAN modules. Without it, the CPAN module won't
know which version of your module to install, and make dist (discussed later) won't
be able to create a distribution archive. By convention most CPAN modules start
their lives at version 0.01, but you are free to use any number you like.
8. So why doesn't it say use 5.6.0 ? Support for X.Y.Z format numbers, called v strings, is itself
a feature of modern versions of Perl. Since the purpose of this line is to produce a sensible
error message in old versions of Perl, it can't use a v string to express the version number.
102
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved