perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cees Hek <c...@sitesuite.net>
Subject Apache::Request problem (possible bug)
Date Fri, 06 Apr 2001 15:07:11 GMT

Either I've found a problem with Apache::Request, or I don't know what I'm
doing :)

Setting variables with $r->param() doesn't seem to work for array
references.  ie the following line from the man page doesn't work
correctly

$r->param('foo' => [qw(one two three)]);

When you look at foo afterwards it returns the string 'ARRAY(0x8c04fd8)'
instead of an actual reference to the array.  

I have include a basic handler that demostrates this on my machine
(Apache/1.3.17 mod_perl/1.24 perl 5.005_03)


package Apache::Test;
# File: Apache/Test.pm

use strict;
use Apache::Constants qw(:common);
use Apache::Request ();

sub handler {
	my $r = new Apache::Request(shift);

	$r->content_type('text/html');
	$r->send_http_header();

	my @list = $r->param('list');

	$r->param('newlist' => [qw(one two three)]);

	my @newlist = $r->param('newlist');

	my $list = join ', ', @list;
	my $newlist = join ', ', @newlist;
	print <<"EOM";

<HTML>
<BODY>
list - $list<BR>
newlist - $newlist<BR>
<BR>
<FORM>
<SELECT NAME="list" MULTIPLE>
  <OPTION>Blue
  <OPTION>Green
  <OPTION>Red
  <OPTION>Yellow
</SELECT>
<INPUT TYPE="submit">
</FORM>
</BODY>
</HTML>
EOM

return OK;
}

1;



-- 
Cees Hek
SiteSuite Corporation
cees@sitesuite.net


Mime
View raw message