Chapter 9
Getting Started with XS
The same tool used in Chapter 4, h2xs, is used to generate the module skeleton for
an XS module. As you can probably guess from the name, this was its original
purpose. The difference between the use of h2xs in Chapter 4 and here is in the
options employed. In Chapter 4, I created a Perl only module using the following
h2xs line:
h2xs XA n Data::Counter
To create an XS module, I just need to drop the X option. I'll still keep the A
option to remove support for the Autoloader. The n option naming the module is
always required. To create the skeleton for Gnome::MIME, you use the following:
h2xs A n Gnome::MIME
This creates all of the same files examined in Chapter 4 with one addition, MIME.xs
(see Table 9 1 for a listing of files created). For the most part, the files are the same
as those created for a Perl only module, with the exception of the module file,
MIME.pm, and Makefile.PL.
Table 9 1. Files Generated by h2xs X n Gnome::MIME
File
Description
MIME.pm
The module file itself, which contains Perl code and POD
documentation
MIME.xs
The XS file itself, which contains XS and C code
Makefile.PL
A script that uses ExtUtils::MakeMaker to generate a Makefile
test.pl
A test script run when a user types make test or installs your
module with the CPAN module
README
A quick description of your module and how to install it
Changes
A change log in which you can describe differences between
versions of your module
MANIFEST
A list of all the files in your distribution
206
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