[html-formfu] Unable to create a Callback constraint via populate()

Michele Beltrame mb at cattlegrid.info
Fri May 9 19:55:08 BST 2008


Hi Carl!

Me again. ;-)

> However, I've now changed element() so it does a shallow clone ( using
> $hashref = {%$hashref} ) instead of dclone().
> This avoids the immediate butchering by element(). Whether this has
> any unwanted side-effects further down the line, we'll just have to
> wait and see.

As arleady noted, this works perfectly for single elements. However, I
now discovered that something like this:

my $empty_to_undef = sub {
    [...]
};

[...]
    element_defaults => {
        Text    => {
            transformers => [{
                type        => 'Callback',
                callback    => $empty_to_undef,
            }],
        }
    },
[...]

triggers the:

Can't store CODE items at /u/www/cheiron/cryo/Cryo/script/../lib/HTML/FormFu/ObjectUtil.pm line 108.

error as before. It seems that coderefs are accepted if I place constraints
or transformers or whatever inside single elements, but not if I place
them as element_defaults.

Thanks,
Michele.

-- 
Michele Beltrase
http://www.cattlegrid.info/
ICQ 76660101 - MSN mb at italpro.net



More information about the HTML-FormFu mailing list