[html-formfu] default_args for base classes

Carl Franks fireartist at gmail.com
Fri May 7 15:00:06 GMT 2010


On 5 May 2010 00:12, Daniel Hilton <danhiruton at gmail.com> wrote:
> Hello,
>
> I've just begun using HTML::FormFu, and have some suggestions for
> default_args.  I'd like to be able to apply defaults to any base
> class, not just the actual blessed name of the object.

Thanks, I've applied this in svn.

I made a slight change, so that it doesn't require Class::ISA, and
made handle_defaults() more efficient.

Rather than iterating through the objects ISA, then checking for a
match in the default_args data, I swapped it round, so we iterate
through the default_args data, then check for a match using
$object->isa()

I've also added support for the old, non-derived behaviour - you just
need to prefix the type with '+'.
e.g.:
    default_args:
        elements:
            +Block:
                auto_id: '%n'

This'll be included in the next cpan release.

Cheers,
Carl



More information about the HTML-FormFu mailing list