You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Michael Lazzaro <ml...@learning.net> on 2001/04/05 04:02:15 UTC

[BUG?] CGI::Cookie->parse() deletes $r->content()

I'm looking to see if anyone can verify whether the following behavior is a 
Feature or a Bug.  From within a PerlRequestHandler:

	my $content = $r->content();
	my $cookie = CGI::Cookie->parse( $r->headers_in->get('Cookie') );

works fine, but the reversed code:

	my $cookie = CGI::Cookie->parse( $r->headers_in->get('Cookie') );
	my $content = $r->content();
	
... sets $content to undef.  I'm aware you can only call $r->content() 
once; but it seems odd that Cookie->parse would squish it too.(?)  Note 
that this code:

	my $cookie = $r->headers_in->get('Cookie');
	my $content = $r->content();
	my $cookie_parsed = CGI::Cookie->parse( $cookie );

... is OK, implying it's the ->parse() that's undef'ing $content, not the 
call to headers_in().

-- using
	(Apache/1.3.19 (Unix) mod_perl/1.25 Perl5.6.0 CGI::Cookie/1.12) undef Red 
Hat i686-linux:
-- the behavior doesn't happen on similarly configured older system,
	(Apache/1.3.12 mod_perl/1.24 Perl5.005_03 CGI::Cookie/1.06))

Anyone else see this / can verify?

MikeL