note
tomhukins
I would deal with quite this differently to you. For example:
<ul>
<li>Write your documentation in POD, not as comments. That way you can run <code>perldoc scriptname</code> to see the purpose, requirements, etc.</li>
<li>Put your global variables such as <code>$cmdname</code> and <code>$thread</code> in a singleton object. That means if someone happens to use a local variable called <code>$thread</code> your code won't break.</li>
<li>Put all the code in a separate module, or at least a file that you can <code>require</code>. This makes your scripts more readable because you don't have to wade through the common code in each separate script. If you find a bug, you only have to change it once.</li>
<li>Consider using modules such as [cpan://Log::Log4perl] and [cpan://Email::Send] to replace your home-grown equivalents. Less code means less bugs.</li>
</ul>
489898
489898