This may entail a lot of work for you, but you asked ;-)

I would suggest implementing the interface as a tied hash. As others have pointed out in this thread, you're exporting many sub names by default. Since all these values are logically related, it makes sense (to me, anyway) to collect them into a single data structure. That is, your caller would do something like this:

use AIX::Sysinfo; # depending on your decision to rename it tie %sysinfo, 'AIX::Sysinfo'; my $aix_hostname = $sysinfo{hostname}; # for example my $aix_version = $sysinfo{aix_version}; # for example
It may be less work than it appears; your module would only have to implement the "reading" functions of the hash, not the "writing" ones. Also, remember you can inherit from Tie::Hash to take care of a lot of the work.

Another suggestion is to cache up the values from the various exernal calls. As it stands, every time I ask for the aix_version, for example, the code will fork and exec to retrieve the same value. But if you make some room in the modeul, you can save the returned values once and re-use them for the life of the program. (It's OK to save these values once since none of them can change without at least rebooting the machine.)

Note that you can cache the values regardless of whether you use the tied-hash interface, but IMHO it would be nice to combine the two.

HTH

Update 7/2/01: Better link to man page courtesy of tye.


In reply to Re: please review my first module by VSarkiss
in thread please review my first module by blueflashlight

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.