in reply to calling methods using a variable

Try using eval() instead, since you are trying to also pass a few arguments to the GraphViz methods:
use GraphViz; my $g = GraphViz->new(); foreach $command (@commands) { eval('$g->'.$command); }
I'm sure this should work as I did try something similar on CGI module. Here's the code that I used to test it on:
use strict; use CGI; my @comm = ("header('first')","header('second')"); my $cgi = new CGI; foreach my $comm (@comm) { eval('print $cgi->'.$comm); }
The output would be:
Content-Type: first Content-Type: second
This also works...
my $comm = "header"; print $cgi->$comm('third');
however, this won't work:
my $comm = "header('third')"; print $cgi->$comm


Cause the last "'" character in the $comm string is considered by Perl to be equivalent to '::' package separator. Therefore, perl is attempting to locate method ")" via package "header('third')" ;-)

"There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith