You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Sean P Quinlan <se...@quinlan.org> on 2007/01/10 06:53:49 UTC

No output to browser with no errors!?

OK, this is probably just a dumb programmer error on my part, but it is
now almost 1am for me and I can't find anything in the docs.
I have a mod_perl (Apache & mod_perl 2 on SuSE 10.1) module destined to
handle a requests for a set of possible URLs under a location.

	SetHandler modperl
	PerlResponseHandler CAS::Apache



The first one I'm working on is a simple login form; Here's the relevant
chunk from CAS::Apache::handler:

	$r->content_type('text/html');
	
	my $html = $forms->$page();
	print $html;
	
	warn "HTML printed";
	return OK;

I go to the appropriate url, the page refreshes, but is completely
blank. View source shows nothing in the page also. However the tail of
my error logs does indeed show:

HTML printed at /usr/lib/perl5/site_perl/5.8.8/CAS/Apache.pm line 70.


As well as a few other bits. And I have added $HTML to the warn text and
it all looks correct. I even tried just returning '<h1>Hello
World!</h1>', but to no avail! Looking at the into and guides, it seems
like I have the basic handler correct, the browser refreshes, and there
are no errors in the log, but yet no body (header?!?) appears to have
been returned to the browser.

Thanks!
-- 
Sean P Quinlan <se...@quinlan.org>

Re: No output to browser with no errors!?

Posted by Geoffrey Young <ge...@modperlcookbook.org>.
Sean P Quinlan wrote:
> On Wed, 2007-01-10 at 00:53 -0500, Sean P Quinlan wrote:
> 
> 
>>OK, this is probably just a dumb programmer error on my part, but it
>>is now almost 1am for me and I can't find anything in the docs.
>>I have a mod_perl (Apache & mod_perl 2 on SuSE 10.1) module destined
>>to handle a requests for a set of possible URLs under a location. 
>>
>>	SetHandler modperl
>>	PerlResponseHandler CAS::Apache
> 
> 
> 
> Turns out you need to SetHandler to perl-script ... even if you aren't
> using any perl 'scripts'. 

that's not true - you need to set the handler to perl-script if you want
the tied print() interface to work:

> 	my $html = $forms->$page();
> 	print $html;

see

  http://perl.apache.org/docs/2.0/user/config/config.html#C_SetHandler_

specifically this part about perl-script:

"STDIN and STDOUT get tied to the request object $r, which makes
possible to read from STDIN and print directly to STDOUT via
CORE::print(), instead of implicit calls like $r->puts()."

HTH

--Geoff

Re: No output to browser with no errors!?

Posted by Sean P Quinlan <se...@quinlan.org>.
On Wed, 2007-01-10 at 00:53 -0500, Sean P Quinlan wrote:

> OK, this is probably just a dumb programmer error on my part, but it
> is now almost 1am for me and I can't find anything in the docs.
> I have a mod_perl (Apache & mod_perl 2 on SuSE 10.1) module destined
> to handle a requests for a set of possible URLs under a location. 
> 
> 	SetHandler modperl
> 	PerlResponseHandler CAS::Apache


Turns out you need to SetHandler to perl-script ... even if you aren't
using any perl 'scripts'. Changed that in the config and am now seeing
the expected xhtml.

-- 
Sean P Quinlan <se...@quinlan.org>