Hi,
Has anyone here had any experience with Perl and Apache2 not working as expected?
The problem I am talking about is when and undefined variable is used, the apache server sits there for ages before eventually returning a timeout.
# Example code
#!/usr/bin/perl
my $blah = 0;
# have not defined $result
if ($blah == 1) { $result == "true" }
if ($result eq "true") { print "True" }
Code like this will work if called from the command line but not through the apache2 server.
Now I know you are going to say "Define your variables / use strict..." but this is old code that is in the process of being rewritten and it is not worth the hassle of going through the old stuff and fixing it up.
The code used to work with Apache 1.3.
Anyone have any ideas?
Cheers,
Reagen
Update: Actually "use strict" doesnt even kill the script. It still sits there doing something for ever... nothing in the error logs either.
Update 2: Trying to narrow down this prob and it seems that you can "use strict" and declare a variable but if that variable is used later in a context where its value is nothing, the server will do its timeout thing. Setting the value of that var to "" makes it work.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.