in reply to Re^2: Embedding Perl / C++ structure question
in thread Embedding Perl / C++ structure question

Just a general tip: there's a trade-off between passing a "pure perl" structure and using objects that are really C structs underneath (besides the general pros and cons about encapsulation of classes vs open structs etc):

If you're going to pass a couple of thousands of structs containing many properties in a list (or nested) and you only really want to query a few of those properties in your perl code, you may well spend much more time converting all the data than you really need, while if you use objects you generally convert the property from perl to C or vice versa each time you access it from perl (but you don't need to convert anything you're not actually accessing).

Using objects instead of complex nested hashes may also be more efficient when you're modifying the structures, since it's usually trivial to keep the C and perl side in sync when you're using objects, while otherwise you're have to inspect the complete structure each time you pass it from C to perl to C.

  • Comment on Re^3: Embedding Perl / C++ structure question

Replies are listed 'Best First'.
Re^4: Embedding Perl / C++ structure question
by TheGeniuS (Novice) on Nov 28, 2007 at 22:08 UTC
    I want to take the time to thank you for all of your help. We have figured everything out and all works fine. Note : we want to inspect the complete structure everytime but I will look into the objects instead of hashes. Thank you so much for everything, you have been very helpful.
      Good book is Extending and Embedding perl.