Exposing PowerShell Module Scope
In the previous article, I demonstrated how to take advantage of the module scope. This is what allows you to have functions and variables available to commands in your module, but not exposed to the user. I take advantage of this in almost all of my PowerShell modules. To make it clear in my code, I make sure my internal functions use a non-standard name. I haven't worried too much about the variable name. I typically call it what I need it to be. But, I can see a benefit in adding a prefix or some indication to the variable name to make it clear that it is an internal variable.
[version]$__Version = '1.0.0'
I opted for the double underscore so I wouldn't mistake it for the pipelined variable $_
Then, in my functions, I can reference this variable.
Want to read the full issue?