c has asked for the wisdom of the Perl Monks concerning the following question:
I'm back to adding features in a script that I've been hacking on for quite a while now that deals with net::snmp. The module has a few method that use the standard format of $object->method(-argument => $value);
Since a method can have quite a number of -argment options passed to it at once, is there a method of passing them to the object through an array or an array reference? or perhaps I should be asking about passing them through a hash/hash reference. It seems as though I've read this as being a possibility with other modules, but I don't believe its present in net::snmp. Is this something that is module-specific or a standard that I can work on?
I guess my hypothesis is...
my %arguments = ( argument1 => "value1", argument2 => "value2" ); $object->method(%arguments);
Would equate to...
$object->method( -argument1 => "value1", -argument2 => "value2" );
Is this just wishful thinking?
thanks very much on this one -c
|Replies are listed 'Best First'.|
Re: pass Array/Hash reference to a module method?
by erikharrison (Deacon) on Jun 26, 2002 at 23:06 UTC
Back to Seekers of Perl Wisdom