GaijinPunch has asked for the wisdom of the Perl Monks concerning the following question:

This is so lame, I could not come up with a better title. I'm starting to work myself in a frenzy.

Basically, I want to keep up with timestamps of some files. I'm using File::stat, and it works just fine. What DOESN'T work just fine, is that I'm running another script that outputs a few lines, and I'm trying to print out those few lines. When I run the script from a terminal, they print out no problem. However, they do not show up in the web browser when I run it there. The tags *should be* okay.

Don't mind the rsh and other junk -- I'm checking files on other machines, but that's not the issue. Doesn't work locally either.

#!/usr/bin/perl use strict; use CGI; my @nodes = qw|node1 node2|; my $query = CGI->new(); print $query->header( "text/html" ), $query->start_html(-title => "doesn't work"), $query->h1( "Here we go!" ); foreach my $node ( @nodes ) { open ( IN, "rsh -l cmtd $node /path/to/script.pl |" ) || die "de +ad $!"; while ( <IN> ) { print $query->h1($node); print $query->h1($_); } } $query->end_html;
As before, the script works on a terminal, as do the remote scripts. They're just not passed to the browser for some goofy reason. The "Here we go" string prints out, so there's no funky header or tag business going on.

The reason I'm calling the other script in the first place and not just running File::stat on the main script is b/c I can only access them on other machines. NFS isn't an option at the moment.

Replies are listed 'Best First'.
Re: General CGI problem.
by Roger (Parson) on Dec 10, 2003 at 05:42 UTC
    The first thing I would do is to check the web server log.

    Have you tried to hardcode the path to the rsh program in your open statement, instead of providing a relative path?

    ... And you do know that when the script is run under the Webserver, it actually has the UID of the webserver (eg. httpd), not yourself (when you run from the command-line).

      Dang, I think you are right. I do have some errors in the log from today. I did something almost the exact same, but ran it on the machine locally and got nothing as well... I guess it was a different error. :( I'll try again --- good information on the UID. I completely forgot that whoever ran the script would be rsh'ing.