Thanks for the advice and comments on my previous question on arrays in modules. I have that working, but of course, I have another question :) I'm wondering just how necessary it is to use a qualifier on a module-declared variable or array.
I understand (to some extent) qualifying the names of variables and arrays declared in modules, when accessed in a script. It seemed awfully cumbersome to me to use the qualified names, but I went at it.
While making those changes to a script, I used a module variable reference to access a module array, but forgot to add the qualifier. I didn't notice the missing qualifier until going over the script to add comments. I checked through the script and module and didn't find it malfunctioning.
So I got to thinking : would it work without the qualifier in other situations ? So far, it does.
As a test case, I modified a short script without the qualifiers, instead using an abbreviation of the subroutine name, like this:
OpenFileFillWeeklyTimeArray::$WeeklyTimeArrayRef
became
$OFFWTA_WeeklyTimeArrayRef
So far, in testing, it works. The abbreviation-prefixed name tells me right off this isn't a local variable - don't modify it or the array it references. This type of name also takes up half the space of the qualified name. And I find it easier to read the script, without the cumbersome qualified name.
But I know enough to know I don't know what I don't know.
So I'm asking here: Am I letting myself in for considerable grief down the road using this naming convention for module variables and arrays ?
In reply to Qualified module variables and arrays by DarrenSol
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |