Jeffrey W. Baker wrote:
> I have read all of the messages in regarding the zygotic
> HTML::Forms/FormGen project, and I like the idea.  However, I hope that
> the inplementation of such a beast isn't in Perl.  To ensure that a
> quality product results, I propose that this library be written in C, and
> also in an object-oriented fashion.
> 
> What I propose is an object interface to the various form input types, as
> well as some higher level functionality that encapsulated what people
> frequently do with HTML forms.  For example, I would expect the C
> interface to look something like this:
> 
> myInput = hfTextInputNew();
> myInput->addAttr(myInput, "name", "first_name");
> myInput->addAttr(myInput, "value", "Jeffrey");
> printf("%s\n", myInput->render(myInput));
> myInput->destroy(myInput);
> 
> I would expect a similar interface with more methods for a select box,
> e.g. mySelect->addOption(mySelect, myOption), and myOption->select.

Where do you store those attributes before you do the rendering? If you tie
yourself to Apache, you could use tables. If you tie yourself to perl, you can
use hashes. Otherwise you have to do your own hashes. Blech, especially if you
then use the library with Apache and/or perl - wasted effort.

Bear in mind that it's nice to be able to support arbitrary attributes for
things like onMouseClick and the like, horrible though they are. This means
that you can't just define structs with members dedicated to specific
attributes.

> The Perl wrapper around this library is pretty obvious, and can use the
> object-oriented approach also.  We can build upon that with an
> enhanced-for-mod_perl interface.
> 
> I expect that a C implementation will be ideal from the standpoint of
> speed and also memory.  I have taken the liberty of implementing the
> neccessary code for the text input type, and the object code is a whopping
> 2116 bytes, which is mostly base class logic that won't be duplicated for
> the other types.  The implementation is also quite fast, rendering 100000
> simple text inputs to /dev/null in .78 seconds, without optimizations.

Sounds good.

> If people think this is the way to go, I will write up a Makefile and
> release the code.

I'd like to see it, or at least an explanation of the issues mentioned above.

-- 
        Peter Haworth   [EMAIL PROTECTED]
Everything can be filed under "miscellaneous."
        --Dilbert's Laws

Reply via email to