I've done a bit of investigating and here's what I make of this problem:
In your generated Makefile, there is a line like this:
$(PERL) -Mblib -MInline=NOISY,_INSTALL_ -MRabbit -e1 0.14 $(INST_ARCHLIB)
The way I figured Inline works is as such: each time it is 'use'd with
the DATA keyword, it stores an reference to an object describing the
Inline section in question in a list. Later, inside an INIT block, it
loops through the list and "glues" each section.
In the above scenario, it is used twice with DATA: once with Rabbit
and once with Turtle. So when in compares the correct version with
$ARGV[0], it's good for Rabbit but not for Turtle.
Basically I see only one way of fixing this: in _INSTALL_ mode, stop
everything after having processed the first Inline section.
During these tests I also noticed such a message popping up:
One or more DATA sections were not processed by Inline.
This basically happens sometimes because depending when/how Inline is
loaded, the INIT block never gets run so the gathered Inline section
never get processed.
I'm thinking one should expect this to work:
require Turtle ;
Turtle->relative_speed() ;
But it doesn't unless you say "use Turtle"? Is this a known/documented
bug/feature?
On Apr 6, 2005 7:59 AM, Nicholas Wehr <[EMAIL PROTECTED]> wrote:
> Actually, this code is just an example of my code... Turtle is just a
> Inline::C module that I wrote months ago, and would like to use some of it's
> functions in Rabbit. The header part is virtually the same. So, Turtle
> could be...
>
> #!/usr/bin/perl
> package Turtle;
> my $VERSION = '1.17';
> use Inline C => 'DATA',
> VERSION => '1.17',
> NAME => 'Turtle',
> OPTIMIZE => '-g',
> CLEAN_AFTER_BUILD => 0,
> ;
>
> use 5.008;
> use strict;
> use warnings;
>
>
> sub relative_speed {
> my ($self, $arg) = @_;
> return _relative_speed($arg);
> }
>
> 1;
>
> __DATA__
> int _relative_speed(int arg) {
> int speed;
> speed = arg * 0.25;
> return speed;
> }
>
> -------------------------------------------------
>
> thank you!
>
>
> Patrick LeBoutillier wrote:
> Nicholas,
>
> Can you send the code for Turtle.pm (or at least the "use Inline" part)?
>
> Patrick
>
> On Apr 5, 2005 2:15 PM, Nicholas Wehr <[EMAIL PROTECTED]> wrote:
>
>
> Sorry I wan't clearer. Here's an example of what I'm doing. Rabbit is
>
> the new module version 0.14. It is trying to 'use' an installed module
> 'Turtle' version 1.17. They both use Inline::C. Inline is generating
> this error during make:
>
>
>
> The version '0.14' for module 'Turtle' doe not match
> the version '1.17' for Inline section 'Turtle'.
>
> Here's the example Inline module:
>
> #!/usr/bin/perl
> package Rabbit;
> my $VERSION = '0.14';
> use Inline C => 'DATA',
> VERSION => '0.14',
> NAME => 'Rabbit',
> OPTIMIZE => '-g',
> CLEAN_AFTER_BUILD => 0,
> FILTERS => 'Strip_POD',
> ;
>
> use 5.008;
> use strict;
> use warnings;
> use Turtle; # <-- the problem happens here during compile
>
> sub gauge_speed {
> my $self = shift;
> $self->proc_speed();
> my $turtle_result = Turtle->relative_speed($self->speed);
> die $! unless $turtle_result;
> return $turtle_result;
> }
>
> Thanks!
>
>
>
>
>
>
>
--
=====================
Patrick LeBoutllier
Laval, Qu�bec, Canada