1

In this question about creating a new perl module, it was suggested to use Module::Build for any new packages.

I'm unable to find any examples using Module::Build that also compile c/c++ code.

I find this surprising is this really is the goto package for future development. Am I just blind?

Community
  • 1
  • 1
mmccoo
  • 8,386
  • 5
  • 41
  • 60
  • I wrote one ([`Sys::CpuAffinity`](http://search.cpan.org/perldoc?Sys::CpuAffinity)), though I wouldn't necessarily recommend studying it or emulating it. – mob Feb 13 '12 at 22:25
  • Looking through my `~/.cpan` cache, I also see [`Params::Classify`](http://search.cpan.org/perldoc?Params::Classify) and [`Params::Validate`](http://search.cpan.org/perldoc?Params::Validate). – mob Feb 13 '12 at 22:28

1 Answers1

6

That question is dated and the level of unrestrained enthusiasm that Brian shows for Module::Build isn't really warranted — it works, and may be better for your situation, but it has its own share of problems, and currently is receiving only limited maintenance.

But to answer your specific question: if you have XS files, all you need to do is put the .xs files in the top-level of your distribution, and they will be built, without you having to tell Module::Build anything.

If you have additional .c or .h files (including Devel::PPPort's ppport.h) that should be built together with your module, put them in a directory and specify that directory as the c_source parameter to the new constructor from Module::Build.

daxim
  • 39,270
  • 4
  • 65
  • 132
hobbs
  • 223,387
  • 19
  • 210
  • 288