From alaricravenhall at hotmail.com Tue Nov 13 18:03:57 2001 From: alaricravenhall at hotmail.com (Alaric Ravenhall) Date: Thu Aug 5 00:07:19 2004 Subject: [Memphis.pm] getting an ip address from a router/device with webpage config Message-ID: Hrm. Here's a way. Assuming your WAN IP starts with 24.24. Also assuming it needs no username/password combo, for which you'd use UA's get_basic_credentials() in some fashion. This script could be further extended to email the ip address somewhere, or input it through a webpage interface. If you are inputting into a webpage, you could trim out the file I/O and just make a tidy log file at the end of the script. I wrote this off the cuff, haven't had time to sit down and test it AT ALL, so expect bugs. Ravenhall -------------------------------------------------- #!/usr/bin/perl use beer; Begin script: --------------- #!/usr/bin/perl -w require LWP::UserAgent; my $ua = LWP::UserAgent->new(env_proxy => 1, keep_alive => 1, timeout => 30,); my $response = $ua->get('http://router-ip-address-here/'); my $old = "/tmp/myip"; my $new = "/tmp/oldip"; rename($old, $new) or die "can't mv $old to $new !!"; open(FH, "+> /tmp/myip") or die "Can't open new file /tmp/myip!"; while () { $response =~ \24.24.[1-255].[1-255]\; (print FH $_) or die "can't write to $new: $!"; } close(FH) or die "Can't close the file!"; _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp ---------------------------------------------------------------------------- To unsubscribe, please send email to majordomo@pm.org with 'unsubscribe memphis-pm-list' in the body of the message. ---------------------------------------------------------------------------- From philarete at mindspring.com Wed Nov 14 18:20:52 2001 From: philarete at mindspring.com (Brock Sides) Date: Thu Aug 5 00:07:19 2004 Subject: [Memphis.pm] Re: [Golum-nontech] lwp::simple on OSX In-Reply-To: <20011113221837.A8478@midsouth.rr.com>; from jgreer@midsouth.rr.com on Tue, Nov 13, 2001 at 10:18:37PM -0600 References: <20011113221837.A8478@midsouth.rr.com> Message-ID: <20011114182051.A18072@harmless.yellowsnow.org> * Jim Greer [011114 17:56]: > So it's off topic... shoot me. > > A friend is attempting to get the LWP::Simple module installed under > OSX. Have any of you tried this and been successful? > > Jim G If I'm not mistaken, LWP is 100% pure Perl, so there shouldn't be any platform-relative issues installing it. What's kind of problem is he having? I'll assume he's installing via "perl -MCPAN -e shell" and "install Bundle::LWP": that's the easiest way to get all the dependencies right for packages like libnet and LWP. If the version of perl is < 5.6.1, he should do an "install CPAN" and "reload cpan" before installing any of the bundles, otherwise it'll try to upgrade perl itself to 5.6.1. Assuming he's following the above instructions, what kind of problems is he having? -- Brock Sides philarete@mindspring.com One OS to rule them all, one OS to find them, One OS to bring them all and in the darkness bind them, In the land of Redmond, where the shadows lie. ---------------------------------------------------------------------------- To unsubscribe, please send email to majordomo@pm.org with 'unsubscribe memphis-pm-list' in the body of the message. ----------------------------------------------------------------------------