Gossamer Forum
Home : General : Perl Programming :

Debugging CGI

Quote Reply
Debugging CGI
Hi There!

I've been playing around with DBman and have what I think is a general CGI question. What is the best way to identify an error and correct it? Here's what I did:

In an effort to customize DBman for our use, I thought I would use the script from your resourses page that returns a two tier display. I thought I followed the instructions to the letter, but I'm getting an error message that there is a missing closing bracket at line 1363 ( or something close to that). I tried counting the lines to that point, but found that was pretty much the end of the script and I had not made any modifications anywhere near there, so I am assuming the error is actaully elsewhere in the script.

Any suggestions or ideas?

------------------
BigBritchs
BigBritchs@IDunno4Recipes.com

Quote Reply
Re: Debugging CGI In reply to
If you are using telnet, you can use the following commands to identify the problems:

1) Connect to the directory where your files are located. Type in perl -c scriptname.pl. (Change the scriptname to the name of your script.) This will check the syntax of your script.

2) Then type in perl -w scriptname.pl to run the script from the command line.

3) When you have identify the line where the problems first exist, type in "vi scriptname". Then you can use some UNIX commands, such as :1363. This will take you to the line where you are experiencing problems. You should go to the line where the error messages first start appearing. Then you can use x to delete characters, i to insert codes, and esc to turn off the editor. To delete whole lines you can use dd.

If you are not using telnet to access your pages, then it may be a little bit tickier. There are debugging programs available that may help you. I believe ActiveState has a few listed. Their web site is

http://www.activestate.com/

Hope this helps.

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Debugging CGI In reply to
Just a couple of comments:

I wouldn't use the -w unless the program you are debugging uses the -w. Otherwise you will see a lot of warnings that probably aren't related to the problem you are having.

Also, instead of doing perl scriptname, just do ./scriptname as that will catch errors such as file not chmod'd properly, and path to perl wrong.

Cheers,

Alex
Quote Reply
Re: Debugging CGI In reply to
Thanks to both of you for responding. I am sure it is very good advice, but I don't understand any of it.

I guess I am in over my head! I don't have a UNIX server, I'm on a WindowsNT server. And I've only recently heard of Telnet, I'm not even sure what that is - LOL!

Anyway, I was able to solve this particular problem by reading some recent posts in the DBman forum and read about JPDeni's new version of the short display. I got it and put it up and it worked great the first time.

Again, thanks for trying to help, but I think the only thing that will help me is a couple of years to learn some of this stuff and then a couple more to catch up on what changed while I was doing that!

Sincerely,

------------------
BigBritchs
BigBritchs@IDunno4Recipes.com

Quote Reply
Re: Debugging CGI In reply to
I would suggest purchasing one of the Perl debugging software packages available at ActiveState -->

http://www.activestate.com/

These are extremely useful especially in Windows environments.

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Debugging CGI In reply to
Thanks Eliot. I'll take a look right now.


------------------
BigBritchs
BigBritchs@IDunno4Recipes.com