Querying Filesystem Usage

Given the methods of controlling filesystem usage we’ve just explored, it is only natural to want to keep track of how well they work. To end this chapter, let’s look at a method for querying the filesystem usage on each of the operating systems found in this book.

MacOS is the operating system for which this task is hardest. MacOS does have a Macintosh Toolbox routine (PBHGetVInfo) to retrieve volume information, but at the current time there is no MacPerl module available to make calling this function easy. Instead, we have to take a roundabout approach and ask the Finder to query this information for us. This is easy in practice thanks to a glue module, but the setup needed for this method makes MacOS the more difficult operating system to deal with.

All the materials for the following involve work by Chris Nandor and can be found at http://pudge.net or on CPAN. Bear with me as we go over this setup step by step:

  1. Install the cpan-mac bundle. cpan-mac includes the CPAN.pm module by Andreas J. König and other handy modules we mentioned in Chapter 1. Even if you don’t want to query filesystem usage from MacOS, you’ll still be well served by installing this bundle. When you install this bundle, be sure to follow all of the directions found in the README file.

  2. Install the latest Mac::AppleEvents::Simple module by dropping the distribution file on top of the installme droplet.

  3. Install the Mac::Glue module. The installme droplet decompresses and unpacks the ...

Get Perl for System Administration now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.