in reply to Re^3: Web-based LDAP User Accounts System
in thread Web-based LDAP User Accounts System
Just a general comment (nothing to do with the original question): unless you're being paid by 'lines of code'... ;) I'd suggest you factor out the common code (the parts wrapped within "if ($choice == X) {...}") into a subroutine, which you then call with the uncommon part(s) - such as $location - as parameter(s). (You might even simply pass $choice, and do the mapping to location within the routine (using a hash or array), in which case you would no longer need the if-chain.)
This would not only make the code shorter, but also - and more importantly - easier to maintain. Just suppose you needed to modify the "if ($choice > 0) { unlock(); }" fragment for whatever reason, you'd only have to do it once, and not all over the place...
|
|---|