do you have some examples of the output of
printstatus? (you can change the names/ips to protect your network, we just want the formatting).
If the output is a single line per printer you can use my previous example, otherwise there might be some work involved :)
Update:if the output is something along the lines of
name display toner level
-----------------------------------
printer1 toner low 25%
printer2 toner low 1%
printer3 etc etc etc
then this should work ok..
#!/usr/bin/perl -w
use strict;
use CGI;
my $main=new CGI;
print $main->header;
print $main->start_html("Printer Status");
open(STATUSFILE," your_outfile") || die "Cannot open logfile!: $!\n";
while(<STATUSFILE>) {
chomp;
if (! ($_=~ /-----------------------------------/)) {
#my ($printer,$display,$toner,$level) = split(/ /, $_)
+;
my @status = split(/ /, $_);
if (($status[0] eq "name") && ($status[1] eq "display"
+)) {
print "<center><table width=250 border=1><tr a
+lign=center>\n";
for (@status) {
print "<td><b>$_</b></td>\n";
}
print "</tr>\n";
} else {
for (@status) {
print "<td>$_</td>\n";
}
print "</tr>\n";
}
}
}
print "</table>\n";
close(STATUSFILE);
exit;
-p
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.