On Fri, Oct 20, 2000 at 02:40:58PM +1100, John Ferlito wrote:

>       I'm assuming asking perl questions isn't OT :)

Not unless you're asking about Perl on Windoze :-)

> what I want to be able to do is the equivelant of this
> 
> $format = "png";
> 
> print IMG $my_graph->plot(\@data)->$format;
> 
> that of course doesn't work. 

Programming Perl 2nd ed p297 has this to say on the subject:

    Sometimes you want to call a method when you don't know the
    method name ahead of time.  You can use the arrow form, replacing
    the method name with a simple scalar variable (not an expression
    or indexed aggregate) containing a method name:

        $method = $fast ? "findfirst" : "findbest";
        $fred->$method(@args);

so you *should* be able to do what you want.  The only real difference I can
see between the example and your code is the argument list, so try adding an
empty list, like this:

    $format = "png";
    print IMG $my_graph->plot(\@data)->$format();
    

Cheers,

John
-- 
whois [EMAIL PROTECTED]


--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug

Reply via email to