Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: please review my first module

by wog (Curate)
on Jul 01, 2001 at 08:22 UTC ( [id://92984]=note: print w/replies, xml ) Need Help??


in reply to please review my first module

I see a few minor problems. First require 5.6.0 is not a good idea. You probably want something like use 5.006 instead. The require should execute after the use warnings, not what you want. Also the ability to use 1.2.3 type version strings was not avialable till perl version 5.6.0. You might want to consider even trying to make your module work on perl 5.005.

As for your hardware_info function, I think you could improve it by caching the hardware info, only computing it once, rather then recomputing the same info three times if someone calls model_type, processor_arch, and processor_speed in succession.

I wonder if you really want to call your module AIX::SysInfo, or similar.

As for your export list, it's not a good idea to export so much by default. Try to limit or eliminate your default export list. You also have declared an export tag which does nothing. Best to get rid of it if its going to do nothing. </p.

Additionally, Sys::Hostname already exists and is standard. Your hostname function is not worth much.

If you want to be paranoid, you should be checking the return values of the various programs you are calling after the close of their pipes, in case something goes horribly wrong, and maybe checking if something goes wrong with your backticks.

Replies are listed 'Best First'.
Re: Re: please review my first module
by blueflashlight (Pilgrim) on Jul 02, 2001 at 09:23 UTC
    Thanks for the hints! I've taken some of your advice, and I've got a few questions/comments on your other points.

    I've changed the module so that it now runs on several older versions; the oldest I've got installed anywhere is 5.001, and it's got a problem there, but its fine now on 003 and 005.

    I've also gotten rid of the "%EXPORT_TAGS" and "@EXPORT_OK" vars, as they were empty. I'm not clear on how I would reduce the number of items exported, since I want to provide access to the functions that I am exporting.

    I plan on keeping the 'hostname' function in there, cause I thought people would like to have that function available without having to load another module. It adds very little overhead (as far as I can tell.)

    Thanks for the suggestions! -s-

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://92984]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (2)
As of 2024-03-19 10:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found