Day 18. Perl and the Operating System

Throughout this book I've been focusing on those features of Perl that behave the same whether you're running your scripts on a Unix system, under Windows, or on a Mac (or at least I've been letting you know about the differences where they exist). Fortunately, as far as the core language is concerned, there aren't too many issues surrounding writing cross-platform scripts; a hash is a hash is a hash, regardless of where you're looking at it.

There are other features of Perl, however, that are not portable. Some of these are historical—because Perl was developed for Unix, many of its built-in features relate to features of Unix that simply don't exist on other platforms. Other features are contained in platform-specific modules, and relate to features of those platforms, like the Windows Registry. If you're certain your scripts will only run on a single platform, you can take advantage of these features to solve platform-specific problems. Or, if you've been given a script to port from one platform to another, it'll help if you know which features are specific to which platform.

In this lesson we'll look at some of the features of Perl available to specific platforms, both in the built-in language and in some of the modules. In particular, today we'll explore

  • Unix features such as back quotes and the system function

  • Creating Unix processes with fork and exec

  • Functions for handling various Unix system files

  • Windows compatibility with Unix features

  • Using the Win32 group of modules, including the Win32::Process and Win32::Registry modules

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset