I think that
Win32::RASE is right up your street
RasEnumConnections(), (RasHangUp() | HangUP()) look like the methods you'll need for this.
$code or die
Error: Keyboard not attached. Press F1 to continue.
Update: If you know what functions you need in WININET.DLL, then you could use
Win32::API to access those functions in perl.