On Fri, 23 Apr 1999 11:30:27 PDT, Dick Hardt wrote:
Oh.... Hmmm.... So Graham's point about wanting to know the context of the
caller is important then.
For example, the Win32::* modules can be updated so that depending on
whether utf8 was set or not, W or A calls to the OS would be made. To do
this, the subs will need to know the context of the caller.
wantutf8() should be easy to write as an XSUB. Here's an untested version:
bool
wantutf8()
CODE:
I32 cxix = cxstack_ix;
PERL_CONTEXT *cx;
RETVAL = 0;
while (--cxix >= 0) {
cx = &cxstack[cxix];
if (CxTYPE(cx) == CXt_SUB) {
RETVAL = (cx->blk_oldcop->op_private & HINT_UTF8);
break;
}
}
OUTPUT: RETVAL
Sarathy
gsar(_at_)activestate(_dot_)com