I'm hesitant to make this post, I seem to lack the ability to distinguish between "good" and "bad" posts. I've made one really good one, and one totally moronic one. But I digress....
I've been trying to get the information via the unix finger command outputed to HTML. So far I've only had success by using system () to create an empty file, then using system again to send the output of the finger command to that file. Then, I read in the file, get rid of any spaces greater than 2 (since HTML ignores it anyway) and print it out on seperate lines. Here's what I've got:
use CGI;
$cgi = new CGI;
$cgi->use_named_parameters;
$name = $ENV{'QUERY_STRING'};
$thefile = "/u/sdrupert/public_html/cgi-bin/tempout.finger";
$create = "/usr/bin/touch " . $thefile;
$run = "/.software/local/.admin/bins/bin/finger " . $name . "\@math >>
+ " . $thefile;
$gone = "rm " . $thefile;
system ($create);
system ($run);
open (INFO, "<$thefile");
@ffile = <INFO>;
close (INFO);
system ($gone);
print $cgi->header;
print $cgi->start_html(-title=>'Finger ' . $name . '@math',-bgcolor=>'
+white');
foreach $line (@ffile)
{
$line =~ s/[ ]{2,}/!/g;
@new = split (/!/, $line);
foreach $newline (@new)
{
print $newline . "<br>";
}
}
print $cgi->end_html;
This works, but a) doesn't look great; and b) I'm sure there's a better way out there.
So, if you tried this before, or have any suggestions, or you even think this post makes up for the last one, please leave a comment/response/suggestion/flame. Thanks.