Re: [xml] document() and import() handlers



  match() should not need it
It doesn't need it if implementing in C space, but Perl is a dynamic
language, so I want to be able to set the match conditions in Perl space.
Without any sort of context pointer I can't do that (because I have no
way of knowing what Perl sub to call from within C-space).

Matt,

As you already stated yourself, you can use a global variable for this.

If you want thread-safety (which I wanted), however, you'll have to resort
to something more obscure: in my case, I used an extension of gcc called
'nested functions' (defining functions in functions). These functions are
scoped within their 'parent', and can access all of its variables and
arguments.

I know it's not portable (in fact, I stumbled upon an internal gcc bug
implementing it), but I use gcc as the only compiler for my project, and
the code is surrounded with a big #ifdef __GNUC__ :)

                                                                     robert




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]