On Sun, 11 Feb 2001, Brian Ingerson wrote:

> Stas Bekman wrote:
> >
> > Hello, Brian
> >
> > I've sent this to the list a week ago, with no replies.
> >
> > This issue is quite urgent, since I'm authoring a mod_perl book for ORA,
> > (at the completing stage) and I try to use Inline in examples instead of
> > XS. If the below problem doesn't get resolved, I'll have to fall back to
> > XS examples :(
>

Brian,

> Sorry, to not CC you. Your email started a sizable thread. You can read
> read the archive at http://www.mail-archive.com/[email protected]/

I was looking for this archive, but couldn't find it. I guess it'd help to
add this URL to the manpage :)

> I have a patch to allow Inline to work with -T. It seems to work OK, but
> doesn't yet work for all test cases. I was going to work on it some more
> before releasing it to the mailing list for testing. But since you're in
> need, I'll release it now.
>
> Whether the patch gets released this week or not, you should be able to
> finish your book, because I've decided on the syntax for taint issues.
> See http://www.mail-archive.com/[email protected]/msg00084.html for
> details, but basically I'm adding "UNTAINT" and "SAFEMODE" options. The
> patch implements "UNTAINT", and "SAFEMODE" will follow later (since it's
> more involved).
>
> With the patch you can say:
>
> perl -MInline=Untaint -Tle 'use Inline C=>q{SV*JAxH(char*x){return
> newSVpvf("Just Another %s Hacker",x);}};print JAxH+Perl'
>
> FYI, this patch was a bear to create. I had to rewrite functions from
> File::Path which appears to not be taint safe. Also I got some extremely
> hard to debug behaviour that for the moment has mysteriously
> dissappeared. It seemed to be coming from Carp.pm. Untainting a normal
> situation works fine. But if the Inline code is generating errors, and
> the error messages seem bogus, try comparing without -T.

Sorry about that, but I think it's very essential thing to have. I'm glad
you made it :)

> Let me know if that works. I'll keep working on the code.

It works fine for me now. This is my little module that throws SIGSEGV :)

package Apache::Segv;

use strict;
BEGIN {
    $Apache::Segv::VERSION = '0.01';
}

use Inline Config => UNTAINT => 1;
use Inline C => <<'END_OF_C_CODE';
  void segv(){
      int *p;
      p = NULL;
      printf("%d",*p); // cause a segfault
  }

END_OF_C_CODE

1;

much simpler to show in the book, than writing and explaining all the XS
code :)

BTW, I present all three in the book: XS, Inline and SWIG, so the readers
could pick the best ;)

> BTW, I'm happy that you are promoting Inline in your book. I would
> gladly proof the applicable texts for you. And again, sorry for not
> noticing your comment about not being on the list. You can always jump
> on temporarily by emailing [EMAIL PROTECTED] . It's fairly low
> traffic at this point.

Too many lists to be at, too many emails to catch on :(

> The patch now works with all tests. This does not mean the patch is
> ready for primetime, only that it passed my measly test harness. I would
> appreciate anybody who wants to use Inline in -T mode, to please test.

Please tell me what will be the final syntax, so my book will have it
right when you release a next version. Is the one I've shown above is
fine?

I'm also not clear about the SAFEMODE, does it mean that it uses Safe.pm?
Does it uses it during the build time only?

I also was wondering about the overhead of runtime check. Writing in XS
might be a pain, but then you have no overhead at runtime. With Inline,
for each invocation there is MD5 compilation of the code and verification.
If I understand correctly, this happens at compile time, so if I preload
modules under mod_perl I get no run-time overhead. Is that correct?

Thank you again! Keep up on working on this great module!

BTW, if you are searching for marketing info, I've first heard about
Inline.pm at YAPC::Europe in Sep, 2000 :)

[please CC me on replies. sorry for the inconvenience.]

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://logilune.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/


Reply via email to