Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: catching output

by vladdrak (Monk)
on Mar 04, 2001 at 14:04 UTC ( [id://62096]=note: print w/replies, xml ) Need Help??


in reply to catching output

I don't know about you guys, but my ifconfig output isn't all that clean.. how about:
#!/usr/bin/perl -w use strict; use LWP::Simple qw(get); my $acct="123"; my $pass="123"; my ($ip,$url); my $ifconfig=`/sbin/ifconfig eth0`; if ($ifconfig=~/inet addr\:((?:\d{1,3}\.){3}\d{1,3})/) { $ip=$1; print "ip: $ip\n" } else { die "Couldn't grab ip from: $ifconfig\n"; } print "Updating.."; if ($got=get("http://www.myip.org/cgi-bin/Update.py?id=$acct&pwd=$pass +&hostname=all&ip=$ip")) { if $got=~/SomeTextFromThePageThatWouldConfirmSuccess/) { print "success.\n"; } else { die "failed: $got\n"; } } else { die "failed: $!\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://62096]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-19 01:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found