It depends on how you are connected to the internet.

if its dialup, you could do this:
my @bob = `ipconfig/all`;
my $jim="";

foreach $jim @bob {
 if($jim=~m/ppp/i){
  last;
  }
}

if its not dialup, you can do something similar looking for the field
"IP Address" and checking if the stuff after the colon and space is an
appropriate address and not 0.0.0.0 or 169.254.x.x.

Hope this helps.

Cheers,
John 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Michael D. Smith
> Sent: Wednesday, November 02, 2005 7:23 AM
> To: [email protected]
> Subject: Checking for internet connection
> 
> 
> 
> Is there a right way/best way to check for an internet connection?
> 
> Now I'm using LWP simple to retrieve a webpage, if that 
> fails, just assuming no connection. It's fast when it works. 
> I like fast, but that assumption is 
> not always
> correct and causes the script to fail inelegantly when it 
> isn't. I hate 
> inelegant :)
> 
> 
> Must be a better way. Any thoughts appreciated.
> 
> ms
> 
> _______________________________________________
> Perl-Win32-Users mailing list 
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
> 

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to