Chapter 4
Sometimes it's possible to take advantage of newer features while maintaining
backwards compatibility. For example, if your module is intended to work with
5.003, then you'll need to avoid using File::Spec
26
since it wasn't included with Perl
until 5.004_05. On the other hand, it's hard to support MacOS and VMS without
using File::Spec. To solve this problem, you might conditionally include File::Spec
if the version of Perl you're using is high enough. For example:
if ($] > 5.00405) {
require File::Spec;
$path = File::Spec >catfile($foo, $bar, $baz);
} else {
$path = join( / , $foo, $bar, $baz);
}
The key to maintaining compatibility with older versions of Perl is testing. Perl
has changed greatly over the years, and it's not easy to keep up with all those
changes. If you're serious about supporting older versions of Perl, then you'll need
to keep versions around to test your module against. It's either that or release it,
and sit back and wait for the bug reports!
Choosing a License
In the first part of the chapter, you saw that the README file generated by h2xs con
tains a section to indicate the copyright and license information for your module.
You should include license information with your module so that people know
what they're allowed to do with your module. It's a good idea to include your copy
right and license information in your module's POD documentation as well as in
your README.
The success of the entire open source and free software movements, in which
CPAN exists, is founded on licenses. Free software and open source licenses grant
the user the right to view, modify, and redistribute the code for a given piece of
software. Contrast this to the licenses that come with proprietary products where
you are neither allowed to see the source code nor redistribute it if you did. Clearly,
CPAN can only function within the context of open source and free software.
26. Okay, you could put it in your PREREQ_PM setting in Makefile.PL, but let's imagine you don't
want to do that because you're a kind and giving person who believes in playing along with
an author's examples.
126
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