Chapter 22. Modular Script Programming


Throughout this book, I advocate the use of functions and subs to encapsulate useful script routines. This type of encapsulation makes it easy to cut and paste functions and subs into future scripts, allowing you to easily reuse script code that may have taken you a while to write and debug. I’ll start this chapter with a methodical look at modularization.

Looking for Modules

Modularization can sometimes seem like a lot of extra work. It’s really a matter of training yourself, though: I generally find that writing my code in modules doesn’t take any extra time if I do so to begin with (obviously, converting ...

Get VBScript, WMI, and ADSI Unleashed: Using VBScript, WMI, and ADSI to Automate Windows® Administration now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.