brian moseley wrote:
> On Wed, 17 May 2000, Vivek Khera wrote:
> 
> > I think the name CGI::Form is appropriate, since the
> > forms are part of the CGI protocol, not anything
> > mod_perl or Apache sepecific. CGI::Form seems to be an
> > abandoned module, so I'm sure you can get permission to
> > adopt it and extend it.
> 
> actually forms are specified in HTML, not CGI.
> 
> peter: i question why you want to subclass Apache::Request,
> rather than provide a helper class that maybe maintains a
> reference to an Apache::Request object, or some other weaker
> type of relationship.

Thanks to all the discussion, I'm coming round to the helper class idea. It was
really only that I hadn't thought of it myself, and that I thought I'd found an
omission in Apache::Request which didn't exist, which I could fix at the same
time.

> consider writing your forms library to depend on an
> interface, not a specific class, so that users can provide
> either a CGI object or an Apache::Request object. perhaps
> the only interface you need is $obj->param?

That's fairly likely. How about this kind of interface?

  my $form=CGI::Form->new($r); # Except for the name. See below
  # Or: my $form=CGI::Form->new($cgi);

  print $form->textfield(name => 'name', size => '60', default => 'Peter');


In light of the non-dependency on mod_perl, the Apache::Request::Form name is
also out. I'd still rather not use the CGI::Form name, in case there are any
current users whose interface would change, which is a shame, because that
seems like the most appropriate name. Erk, any ideas, or proof that no-one uses
the existing CGI::Form?

I'd prefer to stick with one style of interface, to keep things small and
simple. Named parameters as above seem most flexible, and allow for unexpected
things like omMouseOver attributes to be added easily. I'm inclined to only
allow method style calls, although I suppose there's nothing wrong with
allowing people to import the methods and call them like this:

  print textfield($form,name => 'name', ...);

-- 
        Peter Haworth   [EMAIL PROTECTED]
"The Feynman Problem       1) Write down the problem.
 Solving Algorithm:        2) Think real hard.
                           3) Write down the answer."

Reply via email to