You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jason Terry <jt...@cartmanager.net> on 2001/05/08 01:13:07 UTC
really odd XML + CGI.pm + mod_perl + Macintosh + IE 4.5 problem
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
<?xml version="1.0" encoding="utf-8"?>
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 <?xml----- tag that is fragging 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 <?xml.... tag
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?
Re: really odd XML + CGI.pm + mod_perl + Macintosh + IE 4.5 problem
Posted by Bjoern Kriews <bk...@mobile.de>.
> Well after pouring through the "perldoc CGI" I found that if you
> use CGI(:all -no_xhtml);
>
> then you will not get the <?xml----- tag that is fragging the browsers...
> 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
Re: really odd XML + CGI.pm + mod_perl + Macintosh + IE 4.5 problem
Posted by Matt Sergeant <ma...@sergeant.org>.
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
> <?xml version="1.0" encoding="utf-8"?>
>
> 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 <?xml----- tag that is fragging 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 <?xml.... tag
>
> 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.
--
<Matt/>
/|| ** 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 **
\\//
//\\
// \\