I want a form where a user can input a printer name (ie. STL-001) and get the status of that printer.
I can do the following by hard coding the printer name and it does return a status to a web page. My question is how can I make the printer name a variable to pass into the unix command of `lpstat -p STL-001`
#!/usr/bin/perl
$|= 1;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use Fcntl;
use Shell;
use strict;
# print html header, doc root, PERL verions and module info
print "content-type: text/html \n\n";
my $prnt_stat = `lpstat -p STL-001`;
print "<br><br>";
print "<b>Printer Status: </b> $prnt_stat";
# print "<br><br>";
# my $foo = echo("howdy", "funny", "world");
# print $foo;
# print "<br><br>";
# my $passwd = cat("/etc/passwd");
# print $passwd;
exit;
Returns to my webpage:
Printer Status: printer STL-001 is idle. enabled since Jul 15 15:27 2003. available.
I can do the following by hard coding the printer name and it does return a status to a web page. My question is how can I make the printer name a variable to pass into the unix command of `lpstat -p STL-001`
#!/usr/bin/perl
$|= 1;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use Fcntl;
use Shell;
use strict;
# print html header, doc root, PERL verions and module info
print "content-type: text/html \n\n";
my $prnt_stat = `lpstat -p STL-001`;
print "<br><br>";
print "<b>Printer Status: </b> $prnt_stat";
# print "<br><br>";
# my $foo = echo("howdy", "funny", "world");
# print $foo;
# print "<br><br>";
# my $passwd = cat("/etc/passwd");
# print $passwd;
exit;
Returns to my webpage:
Printer Status: printer STL-001 is idle. enabled since Jul 15 15:27 2003. available.