[html-formfu] content_xml => \&coderef

Carl Franks fireartist at gmail.com
Thu Feb 24 14:03:44 GMT 2011


On 24 February 2011 12:58, Ben Vinnerd <ben-formfu at vinnerd.com> wrote:
> Hi,
>
> I'm looking for a way to set some content in a Block element, easy if
> the content is static, but i'd like to be able to pass a code ref
> instead that returns a text string, based on the type of user
> currently logged in (some field in a DBIx::Class row) . e.g. <below>

>     content_xml => '+Myapp::FormFu::Content',

It sounds useful, but the interface need a bit more thought.
content_xml() here is just receiving a string - how does it know it's
meant to be a package-name?
Following the convension used for other methods, it would be something like:

    content_callback_xml => 'Myapp::FormFu::Content::return_string'

If HTML::FormFu::Attribute::mk_output_accessors() were extended to
provide the new methods
*_callback()
*_callback_xml()
*_callback_loc()
then anything that uses mk_output_accessors() to create methods would
benefit from it.

A patch for this would be welcome!

Cheers,
Carl



More information about the HTML-FormFu mailing list