I am using the TT bindings to GD to create graphs in Bugzilla, with Template Toolkit 2.08c. See
http://bugzilla.mozilla.org/query.cgi?format=report-graph
and http://xsls.com?224 (you will need a Bugzilla login) for examples.


However, I'm having a problem with the set_legend method of the Graph object. It expects a list, and internally turns it into a list reference like this:

sub set_legend # List of legend keys
{
    my $self = shift;
    $self->{legend} = [EMAIL PROTECTED];
}

However, from a template, I can't pass it a list, only a list reference.
[% graph.set_legend(row_names) %]
passes a list reference.

So, I have to work around it in this ugly way:

# Workaround for the fact that set_legend won't take row_names
# directly,because row_names is an array reference rather than an array.
graph.set_legend(row_names.0, row_names.1, row_names.2, row_names.3,
                 row_names.4, row_names.5, ...);

I've tried all sorts of things, including reading the manual and the mailing list archives, a vmethod to return a list given a list reference (I think TT just converts it back), and inserting $ signs all over the place. Of course, in an ideal world set_legend() would take a list or a list reference, but it would be good if I could fix this in my code, because fixing it in GD::Graph would mean waiting for the next release and getting everyone to upgrade to it.

Does anyone have any idea how I can make this happen?

Gerv

(This problem is http://bugzilla.mozilla.org/show_bug.cgi?id=185474)


_______________________________________________ templates mailing list [EMAIL PROTECTED] http://lists.template-toolkit.org/mailman/listinfo/templates

Reply via email to