Subject: | HTML::FormHandler Broken on upgrade |
I have a problem rendering forms - there is an error on an anon class
(which is a HTML::FormHandler child class instance) not being able to
find the element_attr method.
It may be that the HFH universe has changed, and I am now doing the
wrong thing (actually, this is quite likely ;) ). However, there seems
to be an assumption made in
HTML::FormHandler::Widget::Form::Role::HTMLAttributes that everything is
a field, based on the following assumption:
Form classes have element_attr . My reading of a form class is that it
has form_element_attr - but these methods appear (to the lay reader) to
be equivalent. As always when making such assumptions, I am showing a
probable ignorance; as there is almost certainly a good design decision
for having one for fields and another for forms. However, it is this
that is breaking the rendering of the form.
I've attached a patch ( diff -e ) that makes things work on my
installation. Hopefully I haven't just committed a heresy. I hope this
helps!
( sudo patch -e
/usr/local/share/perl/5.12.4/HTML/FormHandler/Widget/Form/Role/HTMLAttributes.pm
HTMLAttributes.patch )
Thanks for all your work on HTML::FormHandler. It really has become one
of my favourite packages. Life is so much better for it!
Subject: | HTMLAttributes.patch |
18c
# make the element_attr a safe default
my $element_attr = {};
# Assuming that self is a form
$element_attr = { %{$self->form_element_attr} } if ( $self->can( 'form_element_attr' ) );
# Assuming that self is a field
$element_attr = { %{$self->element_attr} } if ( $self->can( 'element_attr' ) );
.