in reply to Detecting dial-up connections

If you have auto-dial set to off, you can simply ping the gateway machine, using Net::Ping. If the ping comes back, you are connected. The Cable Modem Check program by Ozymandias does more or less what you want then - but it uses the ping command which is available under Win32 as well but has slightly different output. The program also tries to reconnect the cable modem, which you don't want to do either. But it should be easy to modify the script to suit your needs.

The problem starts if auto-dial is enabled. Then that ping will connect you, which is what you wanted to avoid in the first place. I haven't found a good way yet to detect a modem connection. You could try to open COM2 or whatever port your modem is connected to, and if an error occurs, you "guess" that you are connected, you can then try the above ping.

Update: KM posted the method to go by if you want to open the serial port(s). And jcwren posted the ipconfig trick, which will show you a NDISWAN adapter for the remote connection.