Michael G Schwern wrote:
On Sat, Dec 20, 2003 at 08:19:27PM -0800, Stas Bekman wrote:

Consider a module Foo:

#Foo.pm
package Foo;
$VERSION = '2.0';

use XSLoader;
XSLoader::load __PACKAGE__, $VERSION;
1;

% perl-blead-ithread -MExtUtils::MakeMaker \
 -le 'print MM->parse_version(shift)' Foo.pm
2.0

Now if I put this module as a PREREQ_PM, MM fails to satisfy it, since it fails to parse the version number unless I nuke this line:

XSLoader::load __PACKAGE__, $VERSION;


As you illustrated above, MM->parse_version is working.  MM is parsing
the version number.  Something else is going wrong.  Also, the PREREQ_PM
logic does not use parse_version().  Its used for VERSION_FROM.

When you say MM fails to satisfy it I presume you mean MM fails to recognize that you have this module installed when you run the Makefile.PL. The logic for this is in ExtUtils::MakeMaker->new about lines 385-405. Fire up
your Makefile.PL in the debugger and step through it. Its possible the
module had an error when MM tried to load it.

Thanks Michael. That's right, it fails to load the module. That module can't be loaded from the command line, it requires a running mod_perl (unsatisfied symbols), just like most other Apache:: modules. Is this something new or has been like this forever and nobody has ever complained?


Why not use parse_version() instead of trying to load the module?

It seems that the following workaround happens to make the module successfully load w/o mod_perl.

# so that it can be loaded w/o mod_perl (.e.g MakeMaker requires this
# file when Apache::Scoreboard is some other module's PREREQ_PM)
if ($ENV{MOD_PERL}) {
    require XSLoader;
    XSLoader::load(__PACKAGE__, $Apache::Scoreboard::VERSION);
}

p.s. ddd rules! it debugs/displays perl just like it does C!

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Reply via email to