You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Matt Sergeant <ms...@startechgroup.co.uk> on 2001/11/01 10:58:39 UTC

RE: inconsistency between CGI.pm and Apache::Request

> -----Original Message-----
> From: Tatsuhiko Miyagawa [mailto:miyagawa@edge.co.jp]
> 
> There is some inconsistency between CGI.pm and Apache::Request's
> param() method, especially in handling of multivalued parameter.
> 
>   $q = CGI->new;
>   $q->param(foo => qw(a b c));
>   @foo = $q->param('foo');         # ('a', 'b', 'c')
>   $q->param(bar => [ qw(a b c) ]);
>   @bar = $q->param('bar');         # (['a', 'b', 'c'])
> 
>   $r = Apache::Request->new(Apache->request);
>   $r->param(foo => qw(a b c));     # die with an error
>   $r->param(bar => [ qw(a b c) ]);
>   @bar = $r->param('bar');         # ('a', 'b', 'c')
> 
> Am I the only one who wants consistency between the two?

I guess so. Your above is equivalent to:

  $r->param(foo => 'a', b => 'c');

(foo => qw(a b c)) doesn't do what it looks like it does, and that's a bad
thing.

Matt.

_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.

Re: inconsistency between CGI.pm and Apache::Request

Posted by Tatsuhiko Miyagawa <mi...@edge.co.jp>.
On Tue, 6 Nov 2001 15:52:20 -0500
Lincoln Stein <ls...@cshl.org> wrote:

> I'm amazed that CGI.pm does this, but you're right.  What's bad is
> that this style doesn't work as expected:
> 
>      p $r->param(foo=>[qw(a b c)])

That's it! Any plan to fix this *strange* behaviour?

--
Tatsuhiko Miyagawa <mi...@bulknews.net>


Re: inconsistency between CGI.pm and Apache::Request

Posted by Lincoln Stein <ls...@cshl.org>.
I'm amazed that CGI.pm does this, but you're right.  What's bad is
that this style doesn't work as expected:

     p $r->param(foo=>[qw(a b c)])

Lincoln

Tatsuhiko Miyagawa writes:
 > On Thu, 1 Nov 2001 09:58:39 -0000 
 > Matt Sergeant <ms...@startechgroup.co.uk> wrote:
 > 
 > > I guess so. Your above is equivalent to:
 > > 
 > >   $r->param(foo => 'a', b => 'c');
 > > 
 > > (foo => qw(a b c)) doesn't do what it looks like it does, and that's a bad
 > > thing.
 > 
 > I know! but CGI.pm does it, so what I want is interface
 > consistency. CGI.pm also has a named parameter style which
 > Apache::Request doesn't support, like
 > 
 >   $q->param(-name => 'foo', -value => [ qw(a b c) ]);
 >   print join '/', $q->param('foo');  # a/b/c
 > 
 > 
 > 
 > --
 > Tatsuhiko Miyagawa <mi...@bulknews.net>

-- 
========================================================================
Lincoln D. Stein                           Cold Spring Harbor Laboratory
lstein@cshl.org			                  Cold Spring Harbor, NY

NOW HIRING BIOINFORMATICS POSTDOCTORAL FELLOWS AND PROGRAMMERS. 
PLEASE WRITE FOR DETAILS.
========================================================================

Re: inconsistency between CGI.pm and Apache::Request

Posted by Tatsuhiko Miyagawa <mi...@edge.co.jp>.
On Thu, 1 Nov 2001 09:58:39 -0000 
Matt Sergeant <ms...@startechgroup.co.uk> wrote:

> I guess so. Your above is equivalent to:
> 
>   $r->param(foo => 'a', b => 'c');
> 
> (foo => qw(a b c)) doesn't do what it looks like it does, and that's a bad
> thing.

I know! but CGI.pm does it, so what I want is interface
consistency. CGI.pm also has a named parameter style which
Apache::Request doesn't support, like

  $q->param(-name => 'foo', -value => [ qw(a b c) ]);
  print join '/', $q->param('foo');  # a/b/c



--
Tatsuhiko Miyagawa <mi...@bulknews.net>