Re: really odd XML + CGI.pm + mod_perl + Macintosh + IE 4.5 problem

2001-05-08 Thread Matt Sergeant

On Mon, 7 May 2001, Jason Terry wrote:

> OK I have ben RTFMing for about 5 hours now and I did find a fix for part of my 
>problem
> 
> It seems that Mac browsers (IE 4.5 and an old AOL that I know of) are having trouble 
>viewing our HTML producing CGI scripts that use
> a function called &CGI::start_html()
> 
> Apparently (recently in CGI.pm) there has been a change where the CGI::start_html 
>includes the following
> 
> 
> This tag is reaking havoc on some browsers on Mac and possibly others.
> 
> Well after pouring through the "perldoc CGI" I found that if you
> use CGI(:all -no_xhtml);
> 
> then you will not get the  browsers... unfortunately in mod_perl, It only seems to work on *some*
> of the children
> 
> here is what I have in my mod_perl_startup.pl script
> use CGI ();
> CGI->compile(qw(:all -no_xhtml));#used to optimize CGI.pm memory consumption for 
>forked processes
> 
> and I have this in the 2 scripts that I actually use in mod_perl
> use CGI qw(:all -no_xhtml);
> 
> my problem is that in mod_perl... it still occasionally prints the  
> Does anybody have any suggestion as to why?  Or, how I can get the damn thing to 
>stop printing the xml tag... short of changing the
> 100's of times I use CGI::start_html?

Just stop using CGI.pm to produce HTML. Use templates instead. Sorry, I
know that sounds like harsh advice, but you won't regret it in the long
run.

-- 


/||** Founder and CTO  **  **   http://axkit.com/ **
   //||**  AxKit.com Ltd   **  ** XML Application Serving **
  // ||** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources: http://take23.org  **
 \\//
 //\\
//  \\




Re: really odd XML + CGI.pm + mod_perl + Macintosh + IE 4.5 problem

2001-05-07 Thread Bjoern Kriews

 > Well after pouring through the "perldoc CGI" I found that if you
> use CGI(:all -no_xhtml);
> 
> then you will not get the  unfortunately in mod_perl, It only seems to work on *some*
> of the children

We had the same problem with -oldstyle_urls.

Below is what I did because I didn't know better. Enlightenment welcome.


from startup.pl (you would use $XHTML):

use CGI qw(-compile -oldstyle_urls :all);
#
# override CGI::initialize_globals to avoid the default for 
# $CGI::USE_PARAM_SEMICOLONS (we always use -oldstyle_urls)
#
# Caution:
# This works as long as NO script explicitly uses -newstyle_urls. 
#
# Background:
# CGI.pm registers an Apache cleanup handler to call reset_globals,
# which in turn uses initialize_globals. Since _setup_symbols
# (which handles the -oldstyle_urls option) runs only once
# for every httpd-instance under mod_perl this option works  
# only for the first ~MaxServers invocations of the script.
#
my $real_initialize_globals = \&CGI::initialize_globals;
undef *CGI::initialize_globals;
*CGI::initialize_globals = sub {
&$real_initialize_globals();
$CGI::USE_PARAM_SEMICOLONS = 0;
};

Regards, Bjoern

-- 
Bjoern Kriews - mobile.de GmbH - Softwareentwicklung
Bueschstr. 7 - D-20354 Hamburg
Tel.: +49 (0) 40 / 879 77-406; Fax: +49 (0) 40/43 18 23-55
Web: http://www.mobile.de