On 9/26/05, Michael G Schwern <[EMAIL PROTECTED]> wrote:
> On Sun, Sep 25, 2005 at 06:00:04PM +0200, demerphq wrote:
> > Is there a proper way to test both parts of dual implementation modules?
> >
> > In a pinch i came up with
> >
> >   use DynaLoader;
> >   sub DynaLoader::bootstrap{1};  # Don't dynaload anything please.
> >
> >   use Scalar::Util qw(refaddr); #pure perl implementation
> >
> > to disable an XS implementation of a module that used DynaLoader, but
> > im wondering if there is an approved generic way to do this in a more
> > targetted way?
>
> Since there's very few XS modules which don't use DynaLoader (Swig?), the
> above should be fine.  And as the author of the module you know the guts
> of your module.

Actually the initial motivation here was to test other peoples
modules. Specifically Scalar::Util, which seems to have some bugs in
the pure-perl implementation that are not present in the XS
implementation. I can only assume that the reason these bugs are
present is because the module isnt actually properly tested in Non-XS
mode, which to my mind puts this issue to a certain degree in the
problem domain that the testing infrastructure is meant to support.

So the point is that it if the build process could flag that the
module is dual implementation then the test framework could
automatically test the code in both modes. Which would mean that when
you install Scalar::Util the code would be tested to work properly,
whether or not the XS was used.

Anyway, ill leave this to you Test boffins, just thought it was worth
a mention, as if Perl has been shipping with partially broken
implementations of core functionality then this must be a fairly
general problem with this type of code.

yves





--
perl -Mre=debug -e "/just|another|perl|hacker/"

Reply via email to