Geeze, thank you! I must have looked over that about 10 times, character by character, and did not see that. Thanks for spotting that for me. :o)
Strange that all I did was ask a question, and people downvoted it ;o) Wow, I guess it does not pay to ask questions ;o)
Anyways, I have another...
With regards the part that says "redefined", it did not do that until I added this:
BEGIN {
if (defined($in{bus}) && $in{bus} =~ /frhb$/i) {
use MyModule::PckgName;
} elsif (defined($in{bus}) && $in{bus} =~ /frhb2$/i) {
use MyModule2::PckgName;
} elsif (defined($in{bus}) && $in{bus} =~ /frhb3$/i) {
use MyModule3::PckgName;
} elsif (defined($in{bus}) && $in{bus} =~ /frhb4$/i) {
use MyModule4::PckgName;
} elsif (defined($in{bus}) && $in{bus} =~ /frhb5$/i) {
use MyModule5::PckgName;
} elsif (defined($in{bus}) && $in{bus} =~ /frhb6$/i) {
use MyModule6::PckgName;
} elsif (defined($in{bus}) && $in{bus} =~ /frhb7$/i) {
use MyModule7::PckgName;
} elsif (defined($in{bus}) && $in{bus} =~ /frhb8$/i) {
use MyModule8::PckgName;
}
}
Of course as usual for security, I changed the module names, since this is on a shared server. I also push the location to @inc at the top of the script.
Why would it do that if it is actually NOT executing the "use" statement, since only one can be true?
The actual modules are identical, like I said earlier, they are only different with regards to the username and password for MySQL access. Each different module is for a different site, all on the same server.
I'd appreciate any thoughts on that.
thx,
Richard
| [reply] [d/l] [select] |
In your original post, you say that the code within the modules is the exact same except for the mysql authentication. That sets off red alerts all around within my head. What happens if you need to change the code for one or more of the subroutines within these modules? You'll have to go tyhrough every single one, making the changes. My question to you is why you are using a separate module if all that differs is usernames/passwords? Use only one module. When you load it, either pass the username and password pair to the module to make the connection, or make the module retrieve this information itself, based on a parameter passed to it. Please please please don't copy the same module to a separate file just to change two variables. Find a way to pass the authentication information to the module. This will narrow everything down to one module, which will make readability, coding-friendly, and maintainable/manageable code. Besides, I bet that doing so will eliminate or narrow down the problem with the double-declared subroutine.
If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, reply to this node or /msg me to tell me what is wrong with the post, so that I may update the node to the best of my ability. If you do not inform me as to why the post deserved a downvote, your vote does not have any significance and will be disregarded.
| [reply] |
Well, I made them all different, because they are all different sites and different databases.
Plus, I made the modules owned by the user:user of each domain, since they are all seperate domains.
I guess that would not matter though.
Is it possible in a *module* to do a if/then statement, using variables defined in the script "using" the module?
If so, I might be able to re-do how I have these modules.
Thanks for the input.
thx,
Richard
| [reply] |