Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: CGI question

by 7stud (Deacon)
on Feb 08, 2013 at 18:15 UTC ( #1017873=note: print w/ replies, xml ) Need Help??


in reply to CGI question

I can run scripts from one book but I can't from the other book.

That should be pretty easy to troubleshoot. What are the differences in the html between the two books? Specifically, you should examine the form's action attribute in the html. Any differences in the paths listed there? Can you use one book's html with the other book's working perl script?

What are the differences in the perl scripts between the two books? Do both books use script names that have the same extension: .cgi v. .pl? Your server may look at a file's extension to decide whether a file is a perl script and should be executed or whether the file should be returned as text.

What server are you using?

Did you make both your perl scripts executable? $ chmod a+x prog.pl

You might need this shebang line:

#!/usr/local/env perl

When you are testing any cgi script, you should send errors to the browser by adding this line:

use CGI::Carp qw(fatalsToBrowser);

Otherwise, your perl script will fail silently, and you will have to check your server's logs to discover the error.

What does your server's log file say? Find out where it is located, and look at the last 20 lines or so.

You should always post what error you got, or if you didn't get an error, you should state what you expected to happen, and what actually happened. Do not say, "My program doesn't work. Help!"


Comment on Re: CGI question
Select or Download Code
Re^2: CGI question
by MidLifeXis (Prior) on Feb 08, 2013 at 18:51 UTC

    As a note to the grandparent node, a little bit of emphasis on what 7stud said:

    When you are testing any cgi script, you should send errors to the browser by adding this line: (emphasis added)
    Just make sure it does not go into production with errors to the browser :-)

    --MidLifeXis

Re^2: CGI question
by Anonymous Monk on Feb 08, 2013 at 19:29 UTC

    O.K. I'm on it. No sleep till Brooklyn

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017873]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2014-08-27 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (234 votes), past polls