Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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


In reply to pass Array/Hash reference to a module method? by c

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2024-04-25 01:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found