$r->header_out / $r->header_in / $m->log - all not defined!

Jason Vas Dias <[email protected]> Wed, 26 May 2010 16:05:14 +0100
Newsgroups gmane.comp.web.mason.devel,gmane.comp.web.mason.user
Message-ID <[email protected]>
Hi - 
Being very pleased to find HTML::Mason purporting to provide everything I'd 
expect from a Web-Programing framework (and alot more!) I was disappointed
to find that many of the "$src/samples/*" or documentation code example
snippets can be made to work only with major modication - for example 
the "samples/dump-request" sample code produces the error:

System error
error:  	Can't locate object method "header_in" via package 
"Apache2::RequestRec" at /home/jason/public_html/cgi-bin/dump-request.mcgi 
line 18.
context:  	
...  	
14:  	$r-><a href="#uri">uri</a>(&nbsp;[$uri]&nbsp;)&nbsp;=&nbsp;<% $r->uri() 
%><BR>
15:  	$r-><a href="#filename">filename</a>(&nbsp;
[$filename]&nbsp;)&nbsp;=&nbsp;<% $r->filename() %><BR>
16:  	$r-><a href="#path_info">path_info</a>(&nbsp;
[$path_info]&nbsp;)&nbsp;=&nbsp;<% $r->path_info() %><BR>
17:  	$r-><a href="#args">args</a>&nbsp;=&nbsp;<% $r->args %><BR>
18:  	$r-><a href="#header_in">header_in</a>(&nbsp;$header_name,&nbsp;
[$value]&nbsp;)&nbsp;=&nbsp;<% $r->header_in("Content-type") %><BR>
19:  	$r-><a href="#get_remote_host">get_remote_host</a>&nbsp;=&nbsp;<% $r-
>get_remote_host %><BR>
20:  	$r-><a href="#requires">requires</a>&nbsp;=&nbsp;<% $r->requires %><BR>
21:  	$r-><a href="#auth_type">auth_type</a>&nbsp;=&nbsp;<% $r->auth_type 
%><BR>
22:  	$r-><a href="#auth_name">auth_name</a>&nbsp;=&nbsp;<% $r->auth_name 
%><BR>
...  	
code stack:  	/home/jason/public_html/cgi-bin/dump-request.mcgi:18
raw error

This happens under both Fedora Core 12:
httpd-2.2.14-1.fc12.x86_64
apr-devel-1.3.9-3.fc12.x86_64
and RHEL-5:
httpd-2.2.3-43.el5
apr-devel-1.2.7-11.el5_3.1
.

I'm trying to set a cookie value in a cgi script :

	my $Cookie = CGI::Cookie->new(-name=>'text2car_client', value=>$cookie);
	$r->header_out('Set-Cookie' => $Cookie );

How is one meant to do this in Mason without use of the header_out() routine -
attempts to print a header even with '(CGI->new())->header(...)' end up 
including the header in the document data.

Also, there is no $m->log object, as documented at
        http://www.masonhq.com/docs/manual/Devel.html#logging

Is HTML::Mason being maintained ?

Is there any up-to-date documentation for it that contains working examples ?

I'm beginning to conclude that the answer to both questions is "NO" and that I 
should use the raw  mod_perl / CGI.pm interfaces instead.

I hope someone can disabuse me of this conclusion - as documented, Mason looks
great, but it is currently not behaving as documented .

Thanks in advance,
Jason.

------------------------------------------------------------------------------