On 2/22/06, Dave Howorth <[EMAIL PROTECTED]> wrote: > Yeah, I make pretty heavy use of accessor_name. What I need to know is > that I won't be committing to an endless cycle of minor upgrades because > of some less-than-well-developed feature in the minor releases. > > Cheers, Dave >
Yeah. We really need to be sure of new features before we release and
document everything good. Dont worry. The SVN version is still rough
and needs a lot cut out (where aaron pasted my code in in hopes I
would work on it i think :) ) Mainly there are a lot of great but
simple and uobtrusive improvements like hooks and error reporting and
such.
I have not been able to help in last 2 weeks so Aaron has been on his
own i think.
I can mainly speak of what I added . However Most significant things I
think are refactored handler_guts and handler. More nice hooks. A few
new helper methods in CDBI. And Form handling which we still have to
finalize. The CGI::Untaint and FromCGI issue is the main thing. I
think we still need to figure where to place that code in Maypole.
While your here I'll tell you about what I added and you can tell us
if it conflicts,.
CDBI.pm --
related_class("r", $col) -- now returns class for any relationship,
not just has_a and has_many
related_meta("r", $col) -- returns the meta info hash ref for this column
Maypole::Model::CDBI::AsForm.pm -- refactored like crazy
Only documented interface is :
to_cgi([EMAIL PROTECTED]); # get hash of elements
and
to_field($col, $how, $args_hash_ref);
Notable is that any "_to_*" method will be called. So you can make
you own. and say:
sub _to_my_element { ...}
to_field($col, "my_element");
And the _to_* methods are ivariably called like
$self->_to_select($col [, $args] );
Also, the decision making in to_field has been factored into
overrideable methods called in a chain of command fashion:
_field_from_how | _field_from_relationship | _field_from_column_type |
_to_textfield($col)
This makes to_field easily overrideable . Also, you can override
_field_from_* . if you want say column "address" to be a Text Box
rather than a textfield or get a select box for a field rather than
textboxyou can override the appropriate decision maker:
sub BeerDB::Beer:;_field_from_column_type {
my ($self, $col, $args) = @_;
my $type = $self->column_type($col);
return $self->to_field($col, 'bool_select', { items => ['Ale',
'Lager'] } ) if $col eq 'class';
...
}
I'm not really happy with names of methods. SHould they be public?
Should they be named "input_from_*" ??
But I do feel with the above documented interface, You can pretty much
get AsForm to do anything you want very simply which I like. I need
to document examples of that still.
I'm gonna document AsForm and send it out later this week. Here is a
rough version attached. I was supposed to get this out to Aaron. I'd
appreciate if you took a look at it and gave any feedback.
The designing of the interface is harder than coding the features.
thanks,
--
pjs
AsForm.pm
Description: Perl program
