You already know that functions, cmdlets, variables, and aliases can be exported from modules, and you can control exactly what of these elements are exported with the Export-ModuleMember command and properties in the module manifest.
Recommendation
You already know that functions, cmdlets, variables, and aliases can be exported from modules, and you can control exactly which of these elements are exported with the Export-ModuleMember command and properties in the module manifest.
Section: 8.1.1 The using statement
States
You can see that using module is the method we should be using access classes defined in modules.
Recommendation
You can see that using module is the method we should be using to access classes defined in modules.
Section: 8.1.2.1 using module and versions
States
And we can’t try and be clever by dynamically creating a file path based on some criteria and passing a variable to it.
Recommendation
And we can’t try to be clever by dynamically creating a file path based on some criteria and passing a variable to it.
Section: 8.1.2.1 using module and versions
States
It just calls the modules’ functions like normal. A new version of the module was installed, which includes breaking changes to the classes. Our first script can’t use this new version without some significant refactoring to account for the changes, while our second script doesn’t care, the modules’ exported functions take care of these differences for us, so the script doesn’t need to.
Recommendation
It just calls the module's functions like normal. A new version of the module was installed, which includes breaking changes to the classes. Our first script can’t use this new version without some significant refactoring to account for the changes, while our second script doesn’t care . Because the module's exported functions take care of these differences for us, the script doesn’t need to.
Section: 8.1.3 Differences from #requires
States
One of those requirements could be that a specific module must be present and imported into the session before the script can execute. the code to do this would look something like this:
Recommendation
One of those requirements could be that a specific module must be present and imported into the session before the script can execute. The code to do this would look something like this:
Section: 8.4.1 Having a module references classes from another module
States
8.4.1 Having a module references classes from another module
Recommendation
8.4.1 Having a module reference classes from another module
Section: 8.4.1 Having a module references classes from another module
States
The previous example showed how, in a script, you could import a module with using module to access the class(s) defined inside, then extend those classes from outside the module.
Recommendation
The previous example showed how, in a script, you could import a module with using module to access the class(es) defined inside, then extend those classes from outside the module.
Section: 8.4.1 Having a module references classes from another module ("RequiredModules looks for modules in $env:PSModulePath" Callout)
States
To get PowerShell to find the Car module correctly, by sure to move or copy it to your Modules directory like so:
Recommendation
To get PowerShell to find the Car module correctly, be sure to move or copy it to your Modules directory like so:
Section: 8.5 The user experience of classes
States
There are still useful, and if you’ve read the bonus chapter all about classes themselves, you’ll see that they give you some powerful programming capabilities.
Recommendation
They are still useful, and if you’ve read the bonus chapter all about classes themselves, you’ll see that they give you some powerful programming capabilities
Chapter 8
Section: 8.1 Importing classes
States
Recommendation
Section: 8.1.1 The using statement
States
Recommendation
Section: 8.1.2.1 using module and versions
States
Recommendation
Section: 8.1.2.1 using module and versions
States
Recommendation
Section: 8.1.3 Differences from #requires
States
Recommendation
Section: 8.4.1 Having a module references classes from another module
States
Recommendation
Section: 8.4.1 Having a module references classes from another module
States
Recommendation
Section: 8.4.1 Having a module references classes from another module ("RequiredModules looks for modules in $env:PSModulePath" Callout)
States
Recommendation
Section: 8.5 The user experience of classes
States
Recommendation