I worked on something similar to this, there are some suggestions that I would make. First is to use the Sys::Hostname module and the Socket module to grab the ip, rather than pipe the output of ipconfig:
use strict;
use Sys::Hostname;
use Socket;
my $host = hostname();
my $ip = inet_ntoa(scalar(gethostbyname($host)));
print $ip;
This works as long as the host name is correct (at least on linux the hostname has to be proper - windows didn't really seem to matter).
Second suggestion is obviously minor, but change the "public_html" to $htm_dir or something along those lines, not everybody uploads to public_html.
Third and quite possibly most important
use strict always. It is a big deal, it can save so much useless troubleshooting in the long run. I used to not - ever, but I have seen the wisdom, after spending a couple hours trying to find the bug in a largish script, finally realized that one of my variables was badly named. Use strict and -w and you will be happier in the future.
Now for extra credit (grin) - rewrite this so that it changes one or many pre-existing web-pages, some people have a lot of links that point back to their home box from their isp's web page. And of course makes sure that it can pick up where it left off (ie, program hasn't been running for a few days for whatever reason, maybe IP has changed a couple of times since the last update). Fun fun.
Cheers
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.