You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by pubert na <pu...@gmail.com> on 2007/06/28 02:40:46 UTC
newbie questions
I've been trying to convert our app over to mod_perl. Everything went
smoothly except the cookies. When I load the page, some frames load and
other don't. Below is the Perl function which prints out the headers. It's
called before any template is printed. If I comment out the cookie lines,
and print out an empty header the frames load perfectly, albeit without any
session support. I'm sure this is a big time newbie question, but I'd
appreciate some help... I've been googling around for quite a while. Thanks
in advance. --Pubert
my $bDidHeader;
my $_cookies={};
#########################################################################################################
sub printHeader {
#########################################################################################################
my $contentType = shift;
$contentType = 'text/plain; charset=utf-8' if(!$contentType);
my $cgi;
my $sessCookie;
if(!$bDidHeader) {
my $objVP = VirtualPlant::getInstance();
if(! $objVP) {
use CGI;
$cgi = new CGI;
$sessCookie = '';
} else {
$cgi = $objVP->Cgi;
$sessCookie = $cgi->cookie( CGISESSID => $objVP->Session()->id
);
}
if($sessCookie) {
VirtualPlant::Util::setCookie($sessCookie);
print $cgi->header(
-cookie => values
%{VirtualPlant::Util::getCookies()}
);
}
$bDidHeader = VirtualPlant::TRUE;
}
}
Re: newbie questions
Posted by Perrin Harkins <pe...@elem.com>.
[ Please keep it on the list ]
On 6/28/07, pubert na <pu...@gmail.com> wrote:
> No luck with that suggestion either. Printing the header with
> $r->send_http_header; seems to result in the exact same issue.
I can't tell what you tried from this description. Can you show some code?
> I commented
> out the cookie part to simplify things.
Wasn't the cookie part the only thing that was giving you trouble?
> It seems as though mod_perl is
> caching something which affects the urls. Are there any known issues with
> HTML::Template?
No. It's possible you have a scoping problem with a variable that you
use to store the results from HTML::Template.
- Perrin
Re: newbie questions
Posted by Perrin Harkins <pe...@elem.com>.
On 6/27/07, pubert na <pu...@gmail.com> wrote:
> print $cgi->header(
> -cookie => values
> %{VirtualPlant::Util::getCookies()}
> );
You need to send your cookie header with err_headers_out(). See
http://perl.apache.org/docs/2.0/user/coding/cooking.html#Sending_Cookies_in_REDIRECT_Response__ModPerl__Registry_
- Perrin
Re: newbie questions
Posted by Dondi Stroma <ds...@verizon.net>.
Try using PerlResponseHandler ModPerl::PerlRun, or ModPerl::PerlRunPrefork
(if you use the preforking Apache MPM) and see what happens. You might have
to install it first if it wasn't already installed.
----- Original Message -----
From: pubert na
To: modperl@perl.apache.org
Sent: Thursday, June 28, 2007 1:48 PM
Subject: Re: newbie questions
I made a little progress on my own, but I'm still stuck.
If I do an $r->assbackwards(1); before I send the header, the first time the
page loads, everything is perfect. If I reload, some of the frames get
shifted around, or the entire page reloads inside a single frame. Keep in
mind that without mod_perl I don't have this problem.
Here's a link to an unresolved thread which raises the same issue.
http://mail-archives.apache.org/mod_mbox/perl-modperl/200005.mbox/%3C392926AE.451A7190@neptuneweb.com%3E
Here's my setup:
<Location /cgi-bin>
PerlSendHeader off
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions -ParseHeaders
Options +ExecCGI
PerlOptions -SetupEnv
</Location>
Thanks in advance.
Re: newbie questions
Posted by pubert na <pu...@gmail.com>.
I made a little progress on my own, but I'm still stuck.
If I do an $r->assbackwards(1); before I send the header, the first time the
page loads, everything is perfect. If I reload, some of the frames get
shifted around, or the entire page reloads inside a single frame. Keep in
mind that without mod_perl I don't have this problem.
Here's a link to an unresolved thread which raises the same issue.
http://mail-archives.apache.org/mod_mbox/perl-modperl/200005.mbox/%3C392926AE.451A7190@neptuneweb.com%3E
Here's my setup:
<Location /cgi-bin>
PerlSendHeader off
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
PerlOptions -ParseHeaders
Options +ExecCGI
PerlOptions -SetupEnv
</Location>
Thanks in advance.