Conversation
TODO (if agreed on):
|
Great work! This is 90% of the way there - I'd like to see libdontpanic.h be in the ->Inline's https://metacpan.org/pod/Inline::C#auto_include , and that the test actually calls a function in the lib rather than one supplied here, probably using https://metacpan.org/pod/Inline::C#autowrap . |
I think that might be tricky. How does edit having trouble with Boolean logic today. |
I would prefer not to automatically include them all. Instead, what do we think of a ->auto_include method that in AB returns empty string, and can be over-ridden? |
I think the default really should be not to automatically include anything. edit for clarity |
I don't mind an alien_ option in AB::MB to force the behavior that you are talking about though. |
The default certainly should be to not include anything. I'm seeking discussion on the technique for changing the default:
|
Ah I see what you are saying. Let me play with it some more. I think I like the |
Tried adding a C++ test for this as well, but it is dumping when it calls answer().
use strict;
use warnings;
use Test::More;
BEGIN {
eval { require Inline; require Inline::CPP; } || plan skip_all => 'test requires Inline and Inline::CPP';
eval { require Acme::Alien::DontPanic; } || plan skip_all => 'test requires Acme::Alien::DontPanic';
}
use Acme::Alien::DontPanic;
use Inline with => 'Acme::Alien::DontPanic';
use Inline CPP => 'DATA';
is Foo->new->string_answer, "the answer to life the universe and everything is 42";
done_testing;
__DATA__
__CPP__
#include <libdontpanic.h>
#include <stdio.h>
class Foo {
public:
char *string_answer()
{
static char buffer[1024];
sprintf(buffer, "the answer to life the universe and everything is %d", answer());
return buffer;
}
}; changing If anyone can see what I am doing wrong please let me know. |
Added autowrap with the test. as for auto include, I think I sort of changed my mind. I am thinking more along the lines of the third option:
Just because, you can do most things from the
For those that want control at XS build time, as apposed to Alien build time. I will sleep on it. If anyone has any thoughts on this, let me know. |
I haven't looked at the failure yet, but I would like to suggest that the regular expression, "return if I notice this is undocumented, and probably should just be deprecated and removed eventually. But for now, it would would be wise for the regex to look like this: return if Case-insensitivity wouldn't be a good approach because some case-variations are not covered by the existing aliases. |
Seems like the language passed into
|
...and of course it doesn't dump core with a debugging perl...
|
For me it consistently fails, on non-debugging Perls. I've only tested it so far on Linux. I did this I will take another look this week when I get a chance too. To at least figure out if it is something with my environment or not. |
Fixed the travis build in this branch. I am still getting a failure with 5.8 and https://travis-ci.org/plicease/Alien-Base/jobs/35895848 pretty sure this must be a AB rather than Inline issue though. |
On Perl 5.8 if $! already has an error then system will not reset it first
Turns out the test wasn't borken, the user was!
nevermind, this looks as though it is in fact due to the C++ unfriendly header file as I originally suspected. I can get the dump consistently by declaring
|
I prefer #78 to this PR, but failing consensus on that I would vote aye for this PR. |
@plicease, I vote "aye" on whichever you think is better. |
Closing as it seems agreed preference is on #78 |
I am not 100% sure this is what was intended by #71, but it does make Inline / Alien integration easy, as can be seen by the .t file included in this patch.