Re: An Inline question, and a user's experience: Fwd: Using Inline::CPP and Math::Primes::FastSieve

[email protected] ("Sisyphus")
Newsgroups perl.inline
Message-ID <E311709D8123462A91E6B6B0A6F88412@desktop2>
----- Original Message ----- 
From: "David Oswald"

>
> Then Dana's message presents another problem, here:
>
> ----------------------------------------------------<message follows>
>
> However .... when I do:
>
> if (eval { require Math::Prime::FastSieve; 1;}) {
> # ... use MPFS
> } elsif (eval { require Math::Prime::XS;
> Math::Prime::XS->import(qw(primes is_prime)); 1; }) {
> # ... use MPXS
> } elsif (....) {
> # ... use DBXS
> } else {
> # pure perl
> }
>
> I get the Inline M51 warning (DATA section not used) if anyone does a
> require on my module. I realize this is a harmless warning, but I
> really don't want it happening to my module when I don't even use
> Inline. So for now I've disabled use of MPFS to avoid it.
>
> <snip>------------------------------------------------
>
> That message is coming from Inline, but I can't figure out how one
> might squelch it.  Are there any suggestions that might help here?

This can perhaps be addressed from within Inline.pm - though I'm not yet 
sure what would be entailed in doing that.

David, if you wanted to come up with a workaround for this in 
Math::Primes::FastSieve, you could try putting the code inside:

use Inline CPP => <<'EOCPP';
<code>
EOCPP

instead of putting it in a __DATA__ section.
I think that would eliminate the warning, but I was unable to test that 
because I couldn't get it to compile. My attempts kept getting hammered 
with:
"Can't install an Inline extension module with AUTONAME enabled."

Maybe you know how to get around that - I don't ... and I don't have time to 
go digging right now.
Perhaps it's not trivial to do, and is therefore an unsatisfactory approach.

Another workaround that I *have* been able to check, and which appears to 
work fine is as follows:

Once the module has been compiled, the following 3 lines in FastSieve.pm are 
no longer needed:
use Inline CPP      => 'DATA',
           VERSION  => '0.07',
           NAME     => 'Math::Prime::FastSieve';

If you get rid of those 3 lines from FastSieve.pm, then you no longer get 
the warning of which Dana has complained.
It would therefore be a matter of having 'make install' remove (or comment 
out) those 3 lines from the FastSieve.pm that gets installed.

Maybe there's other workarounds that are easier to implement.
That's all I could think of "off the top". I'll look in more depth over the 
coming few days.

In the meantime, any other ideas/observations are welcome.

Better, of course, if we can get it fixed satisfactorily in Inline.

Cheers,
Rob
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.