Hi,

* [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2002-07-23 11:26]:
> We are implementing mod_perl here for internal intranet use.  We have
> discovered a possible buglet in CGI.pm.
> 
> We do not want CGI.pm to return XHTML as it upsets Verity indexing
> (long story).

So sorry to hear about that.

> 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.
> 
> Can someone confirm this?

Yes:

  From CGI.pm, version 2.81:

     35 # >>>>> Here are some globals that you might want to adjust <<<<<<
     36 sub initialize_globals {
     37     # Set this to 1 to enable copious autoloader debugging messages
     38     $AUTOLOAD_DEBUG = 0;
     39 
     40     # Set this to 1 to generate XTML-compatible output
>>   41     $XHTML = 1;
     42 
     43     # Change this to the preferred DTD to print in start_html()
     44     # or use default_dtd('text of DTD to use');
     45     $DEFAULT_DTD = [ '-//W3C//DTD HTML 4.01 Transitional//EN',
     46                      'http://www.w3.org/TR/html4/loose.dtd' ] ;
     47 

Judging from line 35 you might want to adjust some of those globals.

If you are using CGI in the OO way, you can just subclass CGI:

  package My::CGI;

  use base qw(CGI);
  sub initialize_globals {
      CGI::initialize_globals();
      $CGI::XHTML = 0;
  }

And then:

  my $q = My::CGI->new;

Of course, I haven't tested this.

Another option is to call:

  CGI->import("-no_xhtml");

at the top of your Registry script, which will be executed every time,
whereas the "use CGI qw( -no_xhtml );" is only being called at compile
time.

(darren)

-- 
You can put a man through school, but you cannot make him think.
    -- Ben Harper

Reply via email to