On Fri, Feb 04, 2000 at 12:02:48AM +0000, Ross Lynch wrote:
>> Well, I've made some modifications to the script (ie. got it working)
> and translated it to PERL too. It works fine now, and new ISP's are easy
> to add.
Can I make a few suggestions about this code without sounding like an
I can tell you from personal experience that it is a nightmare to
support a Perl script that does not check the success of /all/ system
calls. If Perl cannot open the file you want, it will run merrily on
without so much as a whisper, only to fail at a later stage when you
rely upon the existance of the filehandle you think you got earlier.
People will e-mail you with reports of your script throwing an exception
miles away from and seemingly unrelated to the actual problem, which
becomes a nightmare to figure out. So do it like this:
open (RESOLV, ">>/etc/resolv.conf")
or die "Couldn't open resolv.conf: $!";
Also, what is going to happen to the length of this file if this
script is run again and again? You might want to check for the
preexistance of the lines you are going to append.
A more general issue is that you might always want to catch all if ...
elsif blocks with a final else. Otherwise a user that enters `?'
instead of `y' or `n' may get bizzare results, which will be reported
back to you in cryptic ways.
You could make it even easier to add new ISP's if you were to abstract
all of the ISP-specific data out of the code, and put it in a __DATA__
block at the end, but that may be more work than you want to do on this
How about checking for the existance of /dev/modem before prompting for
a serial port? You might look at the way wvdial handles this issue,
which is very cool.
Thanks for this; I still have not managed to get Surf No Limits working
properly for me, so I am in no position to comment on the technical
I am off now to see if I have caller-id disabled! (or should I have it
enabled? Oh well ...)
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!