> On Tuesday 23 July 2002 08:27 am, [EMAIL PROTECTED] wrote:
> > We do not want CGI.pm to return XHTML ...
> > So in Apache::Registry executed scripts we use:
> >     use CGI qw( -no_xhtml );
> > But on the first invocation it returns normal HTML.  On second invocation
> > it ignores this directive and returns XHTML.  We started a dev server
> > with -X to confirm this.  It would appear CGI resets its globals
> > somewhere.
...
> > Some versions: Apache 1.3.26, perl 5.6.1, mod_perl 1.27, CGI 2.81

On Tuesday 23 July 2002 12:47 pm, Lincoln Stein wrote:
> I'm aware of the problem, but I haven't been able to track it down.  Any
> help is welcome.

Lincoln, Greg, mod_perl list:

The problem appears to be that the -no_xhtml option is only processed in
_setup_symbols. This is called only during import() and compile(), and sets 
$XHTML appropriately.

However, $XHTML is reset to 1 in initialize_globals(). _reset_globals() is an 
alias for this as well. initialize_globals() is called only once in the 
startup  execution (has a comment "Make mod_perl happy") of the module.

However, _reset_globals is called during new(), and is registered with 
mod_perl as a cleanup handler.

What this means is that after the first execution, the cleanup handler fires 
and _reset_globals() is called, which calls initialize_globals(), which then 
sets the global $XHTML to 1. QED.

It looks like -nosticky suffers from the same fate as well, and I would 
venture to guess that all of the variables reset in initialize_globals() are 
not being set properly according to the values parsed in _setup_symbols().
e.g. $NPH, $NOSTICKY, $DEBUG, $HEADERS_ONCE, etc.

I think the 'undef $NPH' in new() was an attempt to address this for that 
variable. But it still leaves the rest out in the cold.

Because _setup_symbols eats the parameters (the options passed in on the 'use' 
line), there's no way to call it again later in new() since it ran at compile 
time.

One might "preserve" the options passed in to _setup_symbols() and then
have new() call it again with those options to make sure that the new instance 
retains the options set on the 'use' line. LDS, You might want to separate 
the option parsing from the autoload magic in _setup_symbols(), and just call
the option parsing part with the saved options from the 'use' line in the 
cleanup handler.

Mike808/
-- 
() Join the ASCII ribbon campaign against HTML email and Microsoft-specific
/\ attachments. If I wanted to read HTML, I would have visited your website!
Support open standards.

Reply via email to