dpippen has asked for the wisdom of the Perl Monks concerning the following question:
that I want to use as method invokers in a loop like this:@commands = ("add_node('W1')", "add_node('W2')", "add_edge('W2' => 'W1 +')");
It doesn't seem to be working so I was wondering if there is something I have to do to dress up $command. I'm getting and error message like this:use GraphViz; my $g = GraphViz->new(); foreach $command (@commands) { $g->$command; }
Can't locate object method ")" via package "add_node('W1')"
Edited 2002-03-21 by Ovid
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
(Ovid) Re: calling methods using a variable
by Ovid (Cardinal) on Mar 22, 2002 at 00:23 UTC | |
by Kanji (Parson) on Mar 22, 2002 at 00:48 UTC | |
|
Re: calling methods using a variable
by dws (Chancellor) on Mar 22, 2002 at 00:13 UTC | |
|
Re: calling methods using a variable (FORMATTED)
by vladb (Vicar) on Mar 22, 2002 at 00:37 UTC | |
|
Re: calling methods using a variable
by belg4mit (Prior) on Mar 22, 2002 at 07:00 UTC |