Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Find Ethernet Card Manufacturer

by DrZaius (Monk)
on Jul 16, 2001 at 22:45 UTC ( #97127=note: print w/ replies, xml ) Need Help??


in reply to Find Ethernet Card Manufacturer

I find myself saying this a lot, but look into Getopt::Long and Pod::Usage for command line scripts. It cleans up a lot of logic for you and using pod is nicer for manpages than comment blocks :)

Also, when a global is also a constant, use constant instead. This makes it easy to maintain your code as you know what is constant and what the script will probably modify.

I see you aren't using LWP. What's wrong with you? You can use LWP::Simple if you don't feel like messing around with user agents and such. Not to mention you'll be able to handle far more errors :)

Also, consider changing this into a module. It seems more useful in that state than a command line script. You could put the mac address database into the __DATA__ section of the module or specify and arg to check a webpage.

Just some thoughts.


Comment on Re: Find Ethernet Card Manufacturer
Select or Download Code
Re: Re: Find Ethernet Card Manufacturer
by mvaline (Friar) on Jul 16, 2001 at 23:07 UTC

    Thank you for the good advice; I had never before heard of use constant, Pod::Usage, or LWP. They will be very useful to me... especially LWP. I have a lot of scripts that grab stuff from the web and I always go through the rigamarole I did in this script.

    I'm going to try creating a module as you suggested. I've never tried that before, so it will be a good learning experience.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (11)
As of 2014-08-20 16:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (119 votes), past polls