Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old January 25th, 2001, 08:15 PM
robotboy robotboy is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Location: Chicago, ILL
Posts: 16 robotboy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to robotboy Send a message via AIM to robotboy Send a message via Yahoo to robotboy
Unhappy

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!


Reply With Quote
  #2  
Old January 25th, 2001, 10:18 PM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
This line -> print "Content-type: texthtml";

should be print "Content-type: text/htmlnn";

Reply With Quote
  #3  
Old January 29th, 2001, 02:05 PM
dsb dsb is offline
PerlGuy
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2001
Posts: 714 dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level)dsb User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 2 Days 15 h 44 m 20 sec
Reputation Power: 36
Send a message via AIM to dsb
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

Reply With Quote
  #4  
Old February 10th, 2001, 12:29 PM
Adrian2 Adrian2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Location: London, England
Posts: 251 Adrian2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
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!


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > script problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway