You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Geoffrey Young <gy...@laserlink.net> on 2001/04/06 09:13:42 UTC

RE: Apache::Request problem (possible bug)

 this was fixed in cvs this past month.  check out the archive of the
apreq-dev list (if there is one somewhere) to see the details.  basically it
was because using param() to set a variable was calling Apache::Table->set,
which stringifies its arguments.  Now it calls Apache::Table->add and does
some undef'ing, allowing you to set multiple values from a ref.


--Geoff

-----Original Message------
From: Cees Hek
To: modperl@apache.org
Sent: 4/6/01 11:07 AM
Subject: Apache::Request problem (possible bug)


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