On 14/09/2012 14:31, Rob Coops wrote:
On Fri, Sep 14, 2012 at 2:52 PM, <jmrhide-p...@yahoo.com> wrote:

I appreciate the helpful input.

It appears from my server stats that the script in question has only run a
couple of times a day on average, so that's fewer than a thousand
instances in
the past year. I ran LOTS of tests of the script, none of which hung or
produced
unexpected output.

If the output was as expected, then the script had to execute correctly to
the
end of the output stage at least. But the only thing after that is a brief
sub
that advises the user that they must enable cookies in order to use the
script.
If that code were executing, then the output I see when I run the script
would
not be as expected.

The While(1) loops all occur PRIOR to the output stage. All they do is
generate
a random integer, make sure it's not the same as the last one, and move on.

So I still don't get it!

Basically every one on this list has said the same. The script is a mess it
is hard to read hard to maintain and should be cleaned up before we can
really comment on this.

To not be to rude to you script it looks like it was run over by a
truck, repeatedly. You might have applied a good dose of ducktape and
staples but it is simply not really maintainable anymore. It actually is
bad enough for everyone to say please clean it up before asking for help as
we just can't read it. And these are for a large part perl professionals
writting code on a daily basis...

On top of that it could very well be that you script in your development
environment is running on a different version of Apache or Perl also it
could very well be that the modules installed in the production environment
Apache (mod_perl maybe?) are the cause of all these troubles.

In any case I would advise the same as every one else did before, clean up
the script first so it is a lot simpler to read.
After that figure out what modules you production Apache is running with
and identify their potential impact on your script by running these your
self or reading the documentation of course (though you will always have to
prove what you read in the documentation in the real world so a lot of us
are at least tempted to skip the boring reading bit). If none of that helps
(I am reasonably sure it will) have a look at the Perl version your
provider is using and make sure that you are using the same version as well
there might be a difference there.

Hi John

In my previous post I have given you a "perltidied" version of your code
which already is much easier to read. Please use it

As well as being courteous to those who you ask for help, it is an
obligatory start to remove the comments from `use strict` and `use
warnings` at the head of your program. `use diagnostics` is of little
use on its own. You should also remove the huge block of predeclarations
and declare your variables at the first point of use within the smallest
scope possible

You have a Jenga tower of code that will break if you make the slightest
change. This will not be the last bug you find, I am sure, so please do
yourself a favour and write something that is maintainable, otherwise
this will all keep happening over and over again

Rob



--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to