Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
36 lines (26 sloc) 1.77 KB


Baby XS to get you started


I am no expert in XS, nor am I am expert in C, but events conspired to force me to learn. What I found is that while XS can be used as a language all its own, it can also look and feel very much like C.

In this talk I will present a minimal subset of XS needed to get started. I will present some "easy" idioms and rules-of-thumb to keep XS from becoming overwhelming. Best of all, its still real XS, so you can add all the full-power XS you want later!

If you would like to learn enough to start a small XS project, come see this talk.


This is in the beginning or intermediate level, specifically geared to people with Perl and C experience but who are afraid of XS. In truth I knew little C, and this project helped me learn it.

Many Perl users see XS as black magic and too hard to get into. I thought this too, but had to get over the hump in order to write PerlGSL::DiffEq. In doing so I learned that while XS can be powerful and magical, you actually NEED very little of it. I imagine my talk might show a simple example case of wrapping some C code into Perl using "baby XS". I term "baby XS" as XS with no TYPEMAPs and just stubs below the MODULE line. I will recommend (to start) to not play with the stack, and to return an array reference when needed. I would avoid h2xs and probably even ExtUtils::MakeMaker, opting instead for Module::Build. I don't reject more XS-y style, but it can be too much to just jump into, I hope that this talk can encourage more people to reuse good C code when needed.

I may use my Text::AsciiTeX as a base, or some other simple library or even C function too. At the end users should be able to write a fully functioning Perl module which wraps a C level function.

Jump to Line
Something went wrong with that request. Please try again.