[html-formfu] migration to new version [was: Losing default value
on update]
Charlie Garrison
garrison at zeta.org.au
Thu Feb 10 05:18:34 GMT 2011
Good afternoon,
On 10/02/11 at 12:30 PM +1100, Charlie Garrison
<garrison at zeta.org.au> wrote:
>After the HTML::FF update, I've got a number of problems with
>custom Elements and Plugins. Is there any sort of migration
>guide or other docco I can look at to know what the fundamental
>changes are?
Replying to myself in case it helps others...
I needed to use Moose-style inheritance to extend functionality
with roles, eg:
use Moose;
extends 'HTML::FormFu::Element';
with 'HTML::FormFu::Role::Element::Field';
I'm not sure if Element::Field is the best role to extend my
Element::Anchor, but it's working for me so good enough for now.
And rather than using `mk_item_accessors` I created Moose
attributes instead; eg:
has icon => ( is => 'rw', traits => ['Chained'] );
has tag => ( is => 'rw', traits => ['Chained'] );
I replaced `sub new` with `after BUILD`, eg:
after BUILD => sub {
my $self = shift;
$self->tag('a');
return;
};
There were a few other changes I needed to make which were
probably specific to my code requirements, eg:
use HTML::FormFu::Util qw( xml_escape append_xml_attribute
process_attrs );
and
around render_data_non_recursive => sub { ... }
Overall it was pretty easy to convert Elements, Plugins,
Defalators and Inflators.
Thanks for your effort on all the moosey goodness with this
latest version of HTML::FF.
Now onto applying my patches for H::FF::Model::DBIC &
Constraint::Unique; hopefully I won't get stuck with those.
Thanks,
Charlie
--
Ꮚ Charlie Garrison ♊ <garrison at zeta.org.au>
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠 http://www.ietf.org/rfc/rfc1855.txt
More information about the HTML-FormFu
mailing list