My friend doesn't have SSH access to his crappy hosted web server, and he doesn't know which Perl modules are installed. So...I wrote a simple CGI script that I thought would allow him to check for installed modules:
#!/usr/bin/perl
use strict;
use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser';
my $module = param('module');
my $result;
checkForModule();
showPage();
sub checkForModule
{
$result = `/usr/bin/perl -M$module -e 1`;
}
sub showPage
{
print
header,
start_html({-onload => "document.moduleForm.module.focus()", title
+ => "Module Checker"}),
qq(
<br /><br />
$result $module
<br /><br />
<form method="post" action="have.pl" name="moduleForm">
<input type="text" name="module" id="module" maxlength="50">
<input type="submit" value="Check for Module" name="submitButt
+on" id="submitButton">
</form>
),
end_html();
}
However, the $result scalar never has a value. Why not?