Embeding Perl into C++ Applications - Update Report


Leon Timmermans writes:

As you may have noticed I've been out of the running for some time (due to health reasons), but I'm back at the project now for a few weeks and things seem to be going pretty ok. Here's an overview of where I'm currently standing.

  • Documentation: Right now this is where I think most work remains. I've been working on it recently, and will continue doing that in the next couple of weeks.
  • Unit testing: I've covered almost everything that I can cover. I'd like to cover more, but many things aren't really testable in C++, sadly. I've been spoiled by Test::*.
  • Regexp support: I may have to give up the idea of natively using perl's regexp engine, and access it through perlspace. perl is strongly resisting this part of it being used by outsiders. To be a bit more precise, qr// is working perfectly fine, but m// is failing unit tests and s/// currently segfaults. Given the amount of time I've put into it that would suck a lot, but right now I'm not seeing alternatives :-(.
  • Building process: I've recently started a new more portable build script based on ExtUtils::CBuilder and works pretty well for me so far. It's not finished yet, but it seems to be a fruitful approach. E::C's C++ support is being improved as we speak (see http://www.dagolden.com/index.php/735/do-you-use-perl-and-c/), and other issues with it seem quite solvable. E::C is quite neat.
  • Exportation: I guess I'm done. I'm specially happy of the user-definable conversions: it's capable of doing reasonably complex type conversions like std::vector to arrayref and back.
Reblog this post [with Zemanta]


As far as Regexp support goes: If the m// and s/// C intrfaces are buggy, have you filed bug reports? Or maybe even tried to fix them? A better C API would benefit a lot of people (including myself). I'm sure patches could go in for 5.14 and considering that the pace of releases has picked up, 5.14 is not *that* far away.
If you have code that needs review before going into core for 5.14, send me email about it.

The main problem is rather simple: the API (see perlreapi) is so low level that it's barely usable. I ended up importing pp_match and pp_subst into the project and adapting that to my needs, but that turns out to be rather problematic. I also considered calling them directly, but they make too many assumptions about their environment (specially about the PMOP they're attached to).

About TPF

The Perl Foundation - supporting the Perl community since 2000. Find out more at www.perlfoundation.org.

About this Entry

This page contains a single entry by Alberto Simões published on March 28, 2010 2:26 PM.

Grant Update: Improvements to Dist::Zilla was the previous entry in this blog.

Last Day To Submit Talk For YAPC::NA 2010 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.


OpenID accepted here Learn more about OpenID
Powered by Movable Type 6.2.2