On 28 Feb 2006 at 7:42, John Siracusa wrote:
> What I was talking about was a convenience method to fill a Rose::HTML::Form
> based on a CGI object. Then you'd use Rose::HTML::Form's existing
> object_from_form() method to fill in the arbitrary object. Something like:
Hmm, then I think it won't be that much shorter.
> $cgi = CGI->new;
> ...
> $form = MyPersonForm->new; # $form "isa" Rose::HTML::Form
> $form->init_fields_with_cgi($cgi);
> $person = $form->person_from_form;
>
> which would be a shorter form of:
>
> $form = MyPersonForm->new; # $form "isa" Rose::HTML::Form
> $form->params_from_cgi($cgi);
> $form->init_fields;
> $person = $form->person_from_form;
>
> which would be a shorter form of:
>
> $form = MyPersonForm->new; # $form "isa" Rose::HTML::Form
>
> my %params;
>
> foreach my $param ($cgi->param)
> {
> my @values = $cgi->param($param);
> $params{$param} = @values > 1 ? [EMAIL PROTECTED] : $values[0];
> }
>
> $form->params(\%params);
> $form->init_fields;
> $person = $form->person_from_form;
>
> -John
which could already be written as:
$form = MyPersonForm->new; # $form "isa" Rose::HTML::Form
$form->params($cgi->Vars);
$form->init_fields;
$person = $form->person_from_form;
which isn't longer or less clear than the new params_from_cgi(), IMHO.
I was hoping to bypass the whole Rose::HTML::Form stuff because it might be a
bit overhead
if all I want is to fill a DB object.
But I can also understand that you don't want to duplicate any code from
Rose::HTML to
Rose::DB.
So, I will continue to use my own conversion method -- at least until I am
ready for
Rose::HTML -- which might be not too far away after all ;-).
Thanks for the clarification
Michael
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object