|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
here is a copy of my script its purpose is to take input from a form put it into a log and then another script willl take it out and put it on a page but whenever i try totest my script on my virtual server (apache) i get this error:[Thu Jan 25 20:02:48 2001] [error] [client 127.0.0.1] Premature end of script headers:
here is the script:#!c:/perl/bin/perl.exe use CGI qw(:standard); print "Content-type: texthtml"; $size_of_form_information = $ENV{'CONTENT_LENGTH'}; read (STDIN, $form_info, $size_of_form_information); ($field_name, $name) = split(/=/, $form_info); open (LOGFILE, ">>c:ben1websiteicq.log"); print LOGFILE ("$namen"); close LOGFILE; print "<BODY BGCOLOR='BEIGE'><H1>Thank You."; print "Your entry has been added."; please i know there is stuff wrong with the script so please help me with that. Also if you could send any ideas they would be greatly apprectiated. feel free to icq me (my name may be the_pissed_reaper) Also im a newbie to cgi and perl and im only 15so please put stuff in terms i can understand(in other words think of me as being stupid) also any websites or books you could recommend to help me learn would be good. THANK YOU! |
|
#2
|
|||
|
|||
|
This line -> print "Content-type: texthtml";
should be print "Content-type: text/htmlnn"; |
|
#3
|
|||
|
|||
|
This line->open (LOGFILE, ">>c:ben1websiteicq.log");
First of all you'll want to append a: Code:
|| die "message\n"; to it for a little bit of error handling. Also, it looks like your missing a slash after your 'c:'. All together you'd want something like: Code:
open (LOGFILE, ">>c:\ben1websiteicq.log") || die "Couldn't open file\n"; As far as other resources go, you may want to look into the Oreilly Perl library,http://perl.oreilly.com/. Specifically look at "Learning Perl"(possibly for Win32 Systems), and "CGI Programming with Perl". Hope this helps
__________________
- dsb - ![]() Perl Guy |
|
#4
|
|||
|
|||
|
The correct content-type header should be:
Code:
print "Content-type: text/html\n\n"; but as you're already using the CGI module, you can do it simply as: Code:
print header; What could be easier? I think this board has some problem with backslashes as I can't believe freebsd would have got that wrong. Looking at the original poster's code, the backslashes are missing from the DOS pathname too. Remedy: always post your code using the [ c o d e ] tags. The book I recommend for new Perl/CGI programmers is Perl & CGI for the World Wide Web by Elizabeth Castro. http://www.amazon.com/exec/obidos/A...sr%5Fb%5F1%5F1/ Good luck with learning Perl! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > script problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|