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

On Mon, 12 Mar 2001, Robert Klep wrote:

 >>   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).


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

Right, similar to what I need from Perl-space...

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__ :)

Sadly for a Perl module that anyone can use I can't force compilers on
anyone, and it's a pretty much required feature. I'll stick to globals.

Daniel, you didn't respond to my (admittedly hidden) question about
whether xmlInitParser created a mutex until the parse phase ends? If so,
the global doesn't matter too much.


    /||    ** Founder and CTO  **  **     **
   //||    ** Ltd   **  ** XML Application Serving **
  // ||    ** **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources:  **
    //  \\

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