in reply to Making Inline::C modules fit for CPAN
Okay, I got a little further. Along the way, various issues of varying potential to make me really sick came up. Supposing I release Module::Inline::C to CPAN, here's the recipe for converting your Inline::C-based CPAN distribution to use Module::Inline::C. This works for MakeMaker-based distributions only at this point.
# use Inline C => '<<HERE'; # becomes use Module::Inline::C <<'HERE'; ... HERE
(Similarly if you prefer use vars '$VERSION'.)# our $VERSION = '0.01'; # becomes our $VERSION = '0.01'; BEGIN {$VERSION = '0.01'};
The dist => ... part specifies that before tar-ing up the distribution file, the Inline::C to XS conversion should take place. The MANIFEST of the generated distribution is updated automatically.use ExtUtils::MakeMaker; my $module_file = 'lib/Foo/Bar.pm'; WriteMakefile( NAME => 'Foo::Bar', VERSION_FROM => $module_file, PREREQ_PM => { 'Module::Inline::C' => '0', # instead of Inline }, ($] >= 5.005 ? (ABSTRACT_FROM => $module_file, AUTHOR => 'Your Name <and@e.mail>') : ()), dist => { PREOP => "perl -MModule::Inline::C::MM=\$(DISTNAME)-\$(VERSION +) -c $module_file", }, );
That should be mostly it. Afterwards, anybody downloading and installing your distribution should be able to do the usual
perl Makefile.PL make # compiles XS => so/dll into blib/ make test # doesn't use Inline! make install # no more Inline for this module, ever.
Of course, the user is free to delete the .xs files from the distribution and use Inline instead. Using Inline::C can be much more enjoyable for development (IMHO).
There's still a lot of cleaning up to do as well as adding documentation and implementations for Module::Build and Module::Install. Additionally, if you have a distribution with several XS (or rather: Inline::C) modules, you might run into trouble with this. But you're welcome to read up on the issue. It's not specific to this but rather common to all XS distributions.
Steffen
Update: I forgot one item in the list.
|
|---|