Re: modules and pragmas - part II
On Sep 24, 2002 at 23:14:02 +0200, [EMAIL PROTECTED] wrote: > > At the first request each instance prints out the no_xhtml-header, but > at the second call the no_xhtml-pragma is forgotten and the > xhtml-header is printed out. > > Is this a problem in the CGI-module or is there a deeper reason for > this in mod_perl ? The problem lies in CGI.pm itself. It installs a cleanup handler which resets $CGI::XHTML to 1 after each request... sub new { Apache->request->register_cleanup(\&CGI::_reset_globals); } sub _reset_globals { initialize_globals() }; sub initialize_globals { $XHTML = 1; } So you'll need to set $CGI::XHTML=0 every time you call CGI->new to get it to work right. --rick
Re: modules and pragmas - part II
On Wed, Sep 25, 2002 at 12:29:12AM -0400, Perrin Harkins wrote: > > Are you setting $CGI::XHTML to 0 somewhere? > No I posted the whole script: #!/usr/bin/perl -w use CGI qw(standard -no_xhtml); my $q=new CGI; print $q->header,$q->start_html,"\n"; print $$,"\n"; thnx, peter -- mag. peter pilsl IT-Consulting tel: +43-699-1-3574035 fax: +43-699-4-3574035 [EMAIL PROTECTED]
Re: modules and pragmas - part II
[EMAIL PROTECTED] wrote: > At the first request each instance prints out the no_xhtml-header, but > at the second call the no_xhtml-pragma is forgotten and the > xhtml-header is printed out. Are you setting $CGI::XHTML to 0 somewhere? > btw and OT : in the previous thread there have been rumours about > better things than the CGI-module. What could you recommend instead ? > (compatible modules prefered cause I really use the sticky- and > nostickyfeatures :) There are many. The most compatible is CGI::Simple. If you need CGI stuff but not the HTML generation, you can use Apache::Request or CGI_Lite. - Perrin
modules and pragmas - part II
Thnx for all the people contributing in the previous thread which gave me deeper insight and a very easy solution ($CGI::XHTML = 0;) But now I played around and found out that if loading a modules with pragmas this pragma only is valid for the first call and not valid for all further call. I wrote a tiny script to show this: -- #!/usr/bin/perl -w use CGI qw(standard -no_xhtml); my $q=new CGI; print $q->header,$q->start_html,"\n"; print $$,"\n"; -- At the first request each instance prints out the no_xhtml-header, but at the second call the no_xhtml-pragma is forgotten and the xhtml-header is printed out. Is this a problem in the CGI-module or is there a deeper reason for this in mod_perl ? btw and OT : in the previous thread there have been rumours about better things than the CGI-module. What could you recommend instead ? (compatible modules prefered cause I really use the sticky- and nostickyfeatures :) thnx, peter -- mag. peter pilsl IT-Consulting tel: +43-699-1-3574035 fax: +43-699-4-3574035 [EMAIL PROTECTED]