On Nov 12, 2005, at 8:02 AM, Xavier Noria wrote:
Say a distribution has a regular Perl module
Foo::Bar::Baz
and another Perl module, used by the former, that is a loader:
Foo::Bar::Baz::XSModule
so we have something like this:
lib/Foo/Bar/Baz.pm
lib/Foo/Bar/Baz/XSModule.pm
lib/Foo/Bar/Baz/XSModule.xs
Makefile.PL
MANIFEST
...
Try it with the .xs file in the root directory of the distro -- the
same directory as Makefile.PL.
What are MODULE and PACKAGE set to?
For the above config, set...
MODULE = Foo::Bar::Baz::XSModule PACKAGE = Foo::Bar::Baz
Foo::Bar::Baz::XSModule should contain the XSLoader::load command.
Foo::Bar::Baz should "use Foo::Bar::Baz::XSModule;", but should *not*
contain an XSLoader::load command, or you'll get redefinition
warnings. The effect is the same as if Foo::Bar::Baz::XSModule
looked like this:
package Foo::Bar::Baz::XSModule;
use strict;
use warnings;
our $VERSION = 0.01;
package Foo::Bar::Baz
use strict;
use warnings;
sub pollute { }
sub the { }
sub foo_bar_baz { }
sub namespace { }
1;
Best,
Marvin Humphrey
Rectangular Research
http://www.rectangular.com/