Re: Apache and Perl's -w
by brian_d_foy (Abbot) on Feb 15, 2005 at 23:40 UTC
|
It depends on how you have things set up. You can set perl options in the environment variable PERL5OPT, and if you can put that in .htaccess (or the equivalent) with a SetEnv directive.
If you are running things through mod_perl, you probably want the PerlWarn directive.
I don't enable warnings for production code though: I either know about the warnings already, or don't care. I don't need to fill up logs with the same warning over and over again. I turn on warnings for debugging and development and turn it off otherwise.
--
brian d foy <bdfoy@cpan.org>
| [reply] |
|
|
I wish it were a case of 'how you have things' instead of how the client's ISP has things. Since I always use warnings; until I'm happy with it, I view this as overkill at best. And since it crashes without the '-w' I also view it as a major pain in the posterior. I was hoping that there was some magical reason for this but it doesn't sound like it<sigh>
--hsm
"Never try to teach a pig to sing...it wastes your time and it annoys the pig."
| [reply] [d/l] |
|
|
Using my incredible magic powers, I shall guess that you are uploading a perl script with line endings in windows format, to a linux type machine, and not converting the line endings. Thus your shebang actually looks like
#!/usr/bin/perl^M and perl^M doesn't exist on the machine so it doesn't run. This of course has nothing to do with apache or perl, but when you add -w infront of the ^M, the kernel can find the appropiate interpreter and perl ignores the ^M.
| [reply] [d/l] |
|
|
Re: Apache and Perl's -w
by cowboy (Friar) on Feb 15, 2005 at 22:03 UTC
|
With newer (5.6+, and maybe before that), you can:
use warnings;
Enabling warnings helps you to catch many subtle bugs
in your code. | [reply] [d/l] |
|
|
Just to be clear, the code in question already had use warnings; This is some silly requirement imposed (I suppose) by the ISP. Code without '-w' does not run and generates bogus error messages in error.log. Hence my question about how and why.
--hsm
"Never try to teach a pig to sing...it wastes your time and it annoys the pig."
| [reply] [d/l] |
|
|
Sorry, I misunderstood the question.
As for the how, I'm not sure.
For the why, possibly some weird 'security' concern.
(Not that I can see any way that warnings would improve
security, when they are allowing you to execute arbitrary
code on their machines, but I've seen alot of such stupidity from less than knowlegable people)
| [reply] |
Re: Apache and Perl's -w
by BUU (Prior) on Feb 15, 2005 at 22:10 UTC
|
I'm pretty sure it's impossible, without rewriting mod_cgi, to make apache require a -w in the shebang. | [reply] |
|
|
Could you expand on this?
--hsm
"Never try to teach a pig to sing...it wastes your time and it annoys the pig."
| [reply] |
|
|
| [reply] |
|
|