[Petal] [Patch] prevent repeated evaluation of expression in _attr

Fergal Daly fergal at esatclear.ie
Sat Jul 19 18:17:04 BST 2003


current Petal turns

petal:attributes="a b"

into


    if (defined $hash->get ('b') and $hash->get ('b') ne '') {
        $res .= "a" . '="' . $hash->get ('b') . '"'
    }

This makes Petal 3 gets for the same expression.

The patch changes it to

    {
        my $value = $hash->get ('b');
        if (defined($value) and length($value)) {
            $res .= "a=\"$value\""
        }
    }

which is a little messier but only does 1 get.

F
-------------- next part --------------
A non-text attachment was scrubbed...
Name: attr.patch
Type: text/x-diff
Size: 1005 bytes
Desc: not available
Url : http://www.email-lists.org/pipermail/petal/attachments/20030719/6ad9e284/attr.bin


More information about the Petal mailing list