----- Original Message ----- From: "Eric Wilhelm" <[EMAIL PROTECTED]>
> > Could you tie() it? If there's one thing I comprehend more poorly than 'pack' and 'unpack', it's 'tie'. >(What you've got is almost a blessed object (just > uc(destroy). and bless in init()) Then your accessor methods would all > be perlish. (that would be great for the cookbook!) > Yeah - I initially did have it blessed and with a DESTROY(), but changed it just before I posted .... not sure why .... probably because it wasn't relevant to the question of "how do I get at the contents ?" - or at least that was my thinking. But if blessing the object (or tieing) could somehow lead to the packed contents being more readily accessible then please let me know. By way of explanation: (This probably won't make much sense unless you've read the fyi in the other thread .... and even then ...... who knows how much sense it will make. I'm not suggesting that anyone *should* read these fyi's, btw .... but the option is there .... ) The other thread (Object Oriented Inline C) refers to GMP objects created by the 'mpz_array_init' function, and the difficulty I was having in getting them cleaned up automatically. So - I was thinking that, instead of returning those GMP objects individually, I would return an object that had those GMP objects packed into it. ie, in the example I provided with my first post in this thread, array_init() returned an object packed with an array of unsigned long ints - in "real life" array_init() would return an object packed with GMP objects created by 'mpz_array_init'. The beauty of that approach is that the existing DESTROY() function copes perfectly with the cleaning up of that "object packed with GMP objects" and the problem with memory management simply ceases to exist. The downside is that I didn't (and still don't) know how to access from perl those GMP objects that are packed into the object returned by the "real life" array_init() function. I think it was another blind alley. I envisage that one needs to know something of the internal structure of the GMP objects before one can unpack them out of another object (someone let me know if that's not so) - and it's not a good idea to be doing that. Cheers, Rob