jamroll has asked for the wisdom of the Perl Monks concerning the following question:

okay. i've been around the globe, not literally, trying to figure this module thing out. I have a basic understanding. I have been coding in perl for years, and modules have always confused me somewhat, cuz they don't seem to behave like .H files in C or .TPU files in pascal - their equivalent to .PM files.

anyway, i went to stackexchange to ask my question - what are the relationships between modules - how do they interact with each other. CAN they? etc. etc. They are NOT helpful in the slightest. The post gets flagged, and most responses are responses I already know about - cuz they've done the same searches on google i have. other say buy a book! I'm not looking to be berated, or belittled.

I'm seeking real advice on the RIGHT way to use modules in a real-world environment.

I have several .pm files stored:

bc_*.pm are "base code" files, i like to call them. the intent is for these particular modules to do only what they appear to do - one does JUST sql stuff, another does just cookie stuff (that's bc_chef).

so, where's my problem? you see, most of my modules need to make sure it's handing the correct data back to the client. this means that some subroutines need access to so i put "use pm::security;" at the top of my "" file. all's good so far, i think. building on my setup, i eventually come across things like "subroutine banned(...) is not defined". I'm like thinking how can that be. I STARE at my code and just can't figure out how "use pm::security;" in my "" module can say that "banned($$)" is not defined, when it's right here in the file! makes NO SENSE! So, I get clever, you see, and I remove "use pm::security;" clause from "" and update all the references to subs in security by adding "pm::security::" to those calls. SAME error!

I clearly am missing something very fundamental to modules, but I can't, for the life of me, figure out why this is going on.

I can post some of the code (i'd have to redact a few things in many subs), but i'm willing to post code in order to gain insight into the intricacies of modules.

unless i have the concept down without knowing it, i'm feeling so lost, guys. pls don't be like stackexchange guys and flag this as "too broad" and pls don't tell me to get a dang book. none of that stuff is at all helpful.

i have scoured every site and document i can find on google, and here, and there and everywhere. most just talk about a single module. never do they say whether other modules can interact with each other, or what the relationships are.

i do understand, however, perl modules are collections of subs - related, and/or unrelated to each other. like subs, though - can a module include another module. the simple answer is yes. but, i don't understand how that relationship works.

Bottom line - i'm lost on modules and could really use some input on the finer details of modules.

thank you very kindly


edit: (wow! what happened to my "paragragphs"? why did this thing take away my line spacing? it looks awful, drat)

edit: there, i fixed the paragraph bit, after i noticed i have to add that silly p tag