I have a question about the module Net::SNMP (4.0.3). I'm currently using this module to query a compaq server, to gather temperature metrics from it's various onboard thermoresistors. Below is my current method:

foreach my $probe ( 1 .. $probe_count ) { my $location = "$thermbase.1.3.0.$probe"; my $temp = "$thermbase.1.4.0.$probe"; my $thresh = "$thermbase.1.5.0.$probe"; my $cond = "$thermbase.1.6.0.$probe"; my $result = $session->get_request( -varbindlist => [ $location, $temp, $thresh, $cond ] ); if ( !defined($result) ) { printf( "ERROR: %s.\n", $session->error ); $session->close; return; }

This loops $probe_count times, and pushes the results onto an array later in the script. I'm only grabbing 4 things out of a table that has 8 objects. My question is, Would it be more efficient to do a get_table in one go (and dig around in the returned hash), even though I do not want every piece of data in that table? Essentialy throwing out half the data I collect?

LR

Whip me, Beat me, Make me use Y-ModemG.

In reply to Net::SNMP method efficiency by LazerRed

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.