我有一个非常简单的问题,但我不知道发生了什么。我无法调试。
这是问题
我有一个perl CGI脚本,它将从HTML页面获取系统名称的输入。我使用Net::OpenSSH
模块登录到该机器并执行命令,我已将输出捕获到变量。
但是在打印变量时,我无法在HTML页面中看到变量的值
#!/usr/bin/perl -w
use CGI;
use Data::Dumper;
use strict;
use CGI::Carp qw(fatalsToBrowser);
use Net::OpenSSH;
my $query = CGI->new();
my $mach_name = $query->param('mach_name');
my $ssh = Net::OpenSSH->new($mach_name);
my $mem_info = $ssh->capture("machinfo | grep -i memory");
print "Content-type: text/html\n\n";
print "<html><head><title>test page</title></head>\n";
print "<body><p>Dicovering Machine Please wait....</p>\n";
print "<p>$mach_name</p>"; # Here the machine name get's printed
print "<p><b>Swap Memory :$mem_info </b> </p>"; # Here the value that is obtained doesn't get printed
print "</body></html>";