unclescrooge wrote:

On Sep 1, 8:29 am, [EMAIL PROTECTED] (Dr.Ruud) wrote:

unclescrooge schreef:

#!/usr/bin/perl
Missing:

  use strict;
  use warnings;

use CGI::Carp qw(fatalsToBrowser);
require "subparseform.lib";
What is that?

&Parse_Form;
Don't put a & in front of a sub-call, unless you know why.
If you meant Parse_Form(@_), then write it like that.
(see `perldoc perlsub`)

$data_file="trouble.cgi";
open(DAT, $data_file) || die("Could not open file");
@raw_data=<DAT>;
close(DAT);

That way wastes memory, there is often no need to slurp all the lines
into an array.
And use a lexical variable to hold the filehandle.

print "Content-type: text/html\n\n";
print "<HTML><BODY>";
foreach $site(@raw_data)
{
 chop($site);

s/chop/chomp/

($reporter,$problem,$mrttech)=split(/\|/,$site);
print "$reporter $problem $mrttech ";
print "<BR> \n";
}

Whitespace is cheap, improve on your indentation.

print "</BODY></HTML>";

So try to make it look more like this

#!/usr/bin/perl
  use strict;
  use warnings;
  use CGI::Carp qw(fatalsToBrowser);

  require "subparseform.lib";
  Parse_Form();

  my $data_file = "trouble.cgi";
  {
      open my $fh_data, "<", $data_file
          or die "Could not open '$data_file': $!";

      print "Content-type: text/html\n\n";
      print "<html>\n<body>\n";

      while (<$fh_data>) {
          chomp;
          my ($reporter, $problem, $mrttech) = split /\|/;
          print "r[$reporter] p[$problem] m[$mrttech]";
          print "<br />\n";
      }
      print "</body>\n</html>\n";
  }
__END__

(untested)

--
Affijn, Ruud

"Gewoon is een tijger."


fyi---this is what the errors in the server log file show...i have
shared hosting and do not have SU access...the ip has been redacted to
protect the innocent.

[Sat Sep 01 10:30:32 2007] [error] [client x.x.x.132] failed to open
log file /var/log/httpd/suexec_log
[Sat Sep 01 10:30:32 2007] [error] [client x.x.x.132] fopen:
Permission denied
[Sat Sep 01 10:30:32 2007] [error] [client x.x.x.132] Premature end of
script headers: atest.cgi

thank you both for your insight...but structurally did it seem legit?
would any of these issues cause a "premature end of script error?"

i see on the server error logs that it won't fopen a suexec file and i
suspect that this might be the culprit.

- Are you sure that /usr/bin/perl is the correct location for Perl on the 
server?

- Have you set your script to have permissions 0755?

- Try removing everything from the require down and adding

print "Content-type: text/html\n\n";
print "<html>\n<body>\n";
print "TEST";
print "</body>\n</html>\n";

and get this going first. Then add the require, then the call to Parsed_Form()
and so on, making sure your script continues to work at each step.

- Show us the contents of subparseform.lib, and apply the advice you have 
already
 been given before you post here again if you need to

HTH,

Rob


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to