LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Perl and apache (https://www.linuxquestions.org/questions/linux-newbie-8/perl-and-apache-850863/)

dexznrl 12-17-2010 08:13 AM

Perl and apache
 
Hello everybody,

I have a small problem with Perl and Apache.

If I use "#!/usr/bin/perl" in the beginning of a perl script the script won't work if the script is at all complicated. Simple scripts like "Hello World" works.

But if I use "#!/usr/bin/perl -w" in the beginning all scripts work?

If I don't use the -w this is whats in the logs:

(2)No such file or directory: exec of '/home/test.net/html/cgi-bin/uh/meny.pl' failed

Premature end of script headers: meny.pl

When I use the -w in the script the error-log shows me this.

meny.pl: Name "main::http_path_cgi" used only once: possible typo at /home/test.net/html/cgi-bin/uh/meny.pl line 24.

I have no perl knowledge.

Best regards

Johan Skott

TB0ne 12-17-2010 08:38 AM

Quote:

Originally Posted by dexznrl (Post 4194696)
Hello everybody,
I have a small problem with Perl and Apache. If I use "#!/usr/bin/perl" in the beginning of a perl script the script won't work if the script is at all complicated. Simple scripts like "Hello World" works.

But if I use "#!/usr/bin/perl -w" in the beginning all scripts work? If I don't use the -w this is whats in the logs:

(2)No such file or directory: exec of '/home/test.net/html/cgi-bin/uh/meny.pl' failed
Premature end of script headers: meny.pl

When I use the -w in the script the error-log shows me this.
meny.pl: Name "main::http_path_cgi" used only once: possible typo at /home/test.net/html/cgi-bin/uh/meny.pl line 24.

I have no perl knowledge.

If you're just starting to learn Perl, you should read up on it. The "-w" option says "use warnings". If your 'complicated' script gets a warning (and you're running WITHOUT the -w), it'll die. If you ARE running with it, you (surprise!), get a warning message about line 24.

So...either run with -w, or fix your code.


All times are GMT -5. The time now is 02:21 PM.