Now that I have CGI working with apache on my server, I am experimenting.
Anyhow, I wrote the following script and was wondering how to capture the
output of a system call. I am trying to capture the output so that I can
format it for the browser.

#!/usr/bin/perl -w
use strict;
use CGI qw(:standard);

print header(), start_html("Online Manpage Accessor"), h1("Online Manpage
Accessor");
if (param()) {
        my $manpage = param("manpage");
        my @output = system("man $manpage"); #trying to capture,
                                             #but it goes to the browser
} else {
        print hr, start_form;
        print p("Enter manpage: ", textfield("manpage"));
        print p(submit("lookup"), reset("clear"));
        print end_form, hr;
}
print end_html();

Thanks,
Patrick

Reply via email to