Surely this has been handled long ago and far away. Maybe I didn't notice, maybe I forgot, I am getting old.
So, is it bad practice to have multiple packages at different paths implementing the same methods according to the configuration of the requiring package?
Say, I have some application which needs auth methods, search and such and can be configured to either use some X500 implementation (e.g. LDAP, AD) or database stuff. Is it sensible to
if($config{X500}) { require Users::LDAP; } elsif ($config{DB}) { require Users::DB; } elsif (...) { ... } else { die "no suitable User handling module found\n"; }
and have Users/{LDAP,DB,...}.pm which all implement Users via package Users; ?
Which each sport:
package Users;
Well, I could have a "Users" package which gets the configuration object passed in upon import and does what it should. What do you think is best? Glove this or that way turned in or out?
Well yes, polymorphism, signatures and such... how would you handle that case?
In reply to packages (Classes) and file names by shmem
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |