wfsp has asked for the wisdom of the Perl Monks concerning the following question:

I'm building a list of my ISP's IP addresses.
I want to run a script during WinXP startup that will connect to the internet and log the IP address. The following code only works if I download a page with OpenURL. i.e. the 'new' call doesn't actually connect (or die or return an error).

I'm quite happy with this (it does the job) but it doesn't seem very elegant. Any suggestions?

Thanks in advance.

#!/bin/perl5 use strict; use warnings; use Win32::Internet; use Socket; use Sys::Hostname; my $INET = new Win32::Internet() or die qq(Cannot connect to Internet); my @error = $INET->Error; print "@error\n"; my $URL; $INET->OpenURL($URL, "http://www.yahoo.com/"); my $host = hostname(); my $addr = inet_ntoa(scalar gethostbyname($host || 'localhost')); print "$addr\n";

Replies are listed 'Best First'.
Re: Launching a dialup connection with Win32::Internet
by ccn (Vicar) on Jul 28, 2004 at 11:38 UTC

    One can launch dialup connection using rasdial.exe on WinXP.
    see dialup tips

      That's more like it. Many thanks!
Re: Launching a dialup connection with Win32::Internet
by kral (Monk) on Jul 28, 2004 at 16:05 UTC
    I had a similar problem with an FTP client that I wrote times ago...
    I used Win32::RASE for the dialup connection...
    ----------
    kral
    (I apologise for my english!)
      Yes, that cropped up when I was super searching. I was unable to find it with ppm. Do you know if a binary install is available? Also, are there any windows version issues? Thanks for your reply.
        Afair, there was nothing to compile. Just download the .tar.gz package, run Makefile.PL and nmake...
        cheers,
        ----------
        kral
        (I apologise for my english!)