Greets,
I'm working on Convert::Lucene, Convert::Lucene::InputStream, and
Convert::Lucene::OutputStream, modules which deal with the search
engine library Java Lucene's primitive data types (which include
VInt, a "variable integer" similar to the BER compressed integer,
pack template letter 'w').
Originally there was just Convert::Lucene, which implemented packle()
and unpackle() -- analogous to pack and unpack. Now I need to give
the other modules access to the same engine, but using different
conventions -- packle() might tolerate a mismatch between TEMPLATE
and ITEMS, but lu_read() from InputStream will throw an error.
My preferred refactoring solution is to move the engines into helper
subs, and have. The problem is, if I set up do_packle() (the packle
() engine) in the C section of my XS file, it no longer has access to
stack macros such as ST.
From the XS documentation, I see that I can add aliases and do case
switching based on the value of ix, keeping everything in one giant
XSUB. However, that would get really messy; what I want to do is
pass an error number from the engine back to the caller and have the
caller decide what to do with it. I don't want to have a zillion
repetitive cases cluttering up the XSUB.
So the question is, how can I give my helper sub access to the Perl
stack?
Thanks,
Marvin Humphrey
Rectangular Research
http://www.rectangular.com/