No such thing as a small change | |
PerlMonks |
Re^4: Trying to Insert Alt Tags Programmaticallyby GrandFather (Saint) |
on Apr 03, 2011 at 01:17 UTC ( [id://897134]=note: print w/replies, xml ) | Need Help?? |
I strongly recommend that you keep the scope of lexical variables as small as possible. Generally you should only declare variables where they are initialised. Removing the block declaration of variables in the visit call back sub, then adding my where each variable is first initialised turns up the following dubious code:
I also note the use of nested named subroutines which almost certainly is a mistake. Aside from that, writing the same dozen lines of code four times should be a strong clue to use a sub. Using named subs for the visit and broken link call backs would help clarify program flow and make the function of the various parts of the code clearer.
True laziness is hard work
In Section
Seekers of Perl Wisdom
|
|