Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the modern way of creating an XS module from scratch?

Tags:

perl

perl-xs

I need to write an XS module for Perl. It is my understanding that h2xs is pretty much deprecated today, what is the preferred method for starting an XS module today? I looked at Module::Starter, but it only handles pure Perl modules.

like image 687
Chas. Owens Avatar asked Apr 07 '09 14:04

Chas. Owens


2 Answers

No, h2xs is not deprecated. Module::Starter is certainly more convenient if you create many pure Perl modules, but there's no reason to avoid h2xs. I would recommend reading all the way through its doc before using it, though, so that you know what all you might want it to do or not do.

like image 157
ysth Avatar answered Dec 04 '22 21:12

ysth


Personally I just use Module::Starter and add the .xs file myself. It depends on what your aim is: if you're making a one-on-one mapping to a C api then h2xs can do a lot of boilerplate for you, but if you're making a completely new interface, or when you're only doing things with perl itself (and not some external library) it doesn't add much but trouble IMHO.

like image 27
Leon Timmermans Avatar answered Dec 04 '22 20:12

Leon Timmermans