Re: first cgi

by "Mike Kear" <choicemag(at)hotmail.com>

 Date:  Tue, 22 Feb 2000 13:31:37 EST
 To:  c-newton(at)ihug.co.nz,
hwg-techniques(at)mail.hwg.org
  todo: View Thread, Original
Peter Newton you rotten so-and-so!!!!   Where were you when I was sweating 
through my scripts trying to make them work?????

What a neat idea, and I wish you'd said that 3 years ago.

Cheers,
Mike Kear
AFP Web Development
Windsor, NSW, Australia
http://www.afp.zip.com.au


>Hi Roger,
>
>After youv'e picked up on the greate advice from Brian I'de like
>  to add one more tip that I was shown from this list when I was
>starting out with cgi/perl and thats this.
>
>The error message you received is one that you will probably
>see many times and it is quite frustrating especially when you
>have a large script because it does not tell you WHAT went
>wrong.
>
>The system error logs is one way to find out but if you cannot
>access them here is another:-
>
>put the following code at the start of your script like so:-
>
>#!/usr/bin/perl
>
>BEGIN {
>open (STDERR, ">error.txt");      #redirect Error Messages to file
>$localtime=localtime;                   #get local time/date
>print STDERR "\n$localtime\n";  #time stamp error msgs
>}
>
>The rest of you script as normal
>
>What this does is redirect the STDERR output to a file in this
>case called error.txt but you can call it whatever suits you. As
>perl processes your script it sends its error messages to
>STDERR which is now being conveniently stored into this file.
>
>So then when you get that error display again simply use your
>WS ftp to read this file and it will tell you WHAT it found wrong
>even on what line number. 2ndly the line number it displays does
>NOT take account of any line Wrapping so you may need to
>turn "word wrap" off in your text edditor if you can.
>
>NB.
>You actually only need the
>open ( ..... etc  line the next 2 lines just put a time stamp into
>the file which may be useful.  It does demonstrate another
>live example of using localtime mentioned by Brian so I left it in.
>
>I hope this saves you heaps of time.
>
>Peter Newton
>
>
>
>
>-----Original Message-----
>From: Roger Harness [SMTP:muagic32(at)jps.net]
>Sent: Monday, February 21, 2000 11:19 AM
>To: hwg-techniques(at)mail.hwg.org
>Subject: first cgi
>
>Ok technique gurus, I have a question for you. I'm trying to do just a
>basic cgi (script?). I'm using my "HTML 4 In a Week" book, along with the
>tips from my hosting service. (hostsave.com, thank you Shelley!)
>
>Using arachnophilia, I typed this:
>
>#!/usr/bin/perl
>
>echo Content-type: text/plain
>echo
>
>usr/bin/date
>
>I saved this as getdate.cgi then uploaded it into my cgi-bin using WS_FTP
>95 le as ASCII. That's correct, right??
>
>I then made a basic html page called getthedate.html with this code:
>
><html>
><!-- Copyright (c) 2webslingers -->
><head>
><title>practice cgi</title>
></head>
>
><A href="http://www.2webslingers.com/cgi-bin/getdate.cgi">display the
>date</A>
></body>
></html>
>
>
>so when I click on "display the date" I *should* get today's date, correct?
>(BTW, hostsave does NOT allow telnet, so I can't just go to the command
>prompt and try typing date :)
>
>Instead of today's date showing up, I get:
>
>**********************************
>Internal Server Error
>The server encountered an internal error or misconfiguration and was unable
>to complete your request.
>Please contact the server administrator, webmaster(at)2webslingers.com and
>inform them of the time the error occurred, and anything you might have
>done that may have caused the error.
>
>More information about this error may be available in the server error log.
>**********************************
>
>the server log doesn't give me any helpful info, and hostsave doesn't give
>any tech support for cgi scripting.
>
>Does anyone have any advice/suggestions here? I've used the cut and paste
>FormMails before, and I can usually get stuff like that to work, but I'm
>just not having any luck with this simple, stupid date thing. I've tried
>just about everything (changing parts of code, where I put the files etc,
>but no luck. Any help would be greatly appreciated!!!
>
>
>Sincerely,
>
>Roger Harness
>
>
>
>

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA