[Petal] [PATCH] quicker attributes

Fergal Daly fergal at esatclear.ie
Wed Jun 18 01:31:59 BST 2003


When dealing with attributes, Petal currently produces code like this

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

The patch below make it produce code like this

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

so $hash->get is only called once instead of 3 times. This patch will only 
apply is you have applied the the patches I posted last week,

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


More information about the Petal mailing list