I've been busy over the past week producing four new Test::* modules.
These are a bit different from most other Test::* modules, which are normally written to help you test your code. These, however, are designed to help you test the environment that your code is going to be running in.
Test::Symlink lets you easily verify that a symlink exists, and that it links to the correct location.symlink_ok($src => $dst);
Test::Unix::Group and Test:::Unix::User let you verify that a user, group, and home directory exist.
user_ok({ name => 'nik', uid => 1000}, 'nik has uid 1000'); homedir_ok({ name => 'nik', group => 'staff' }, "nik's homedir is owned by the staff group"); group_ok({ name => 'wheel', members => [qw(root nik)]}, "'wheel' has the correct members");
Finally, there's Test::Net::Connect, which lets you make sure that you can make a network connection to a particular host.
connect_ok({ host => 'www.example.com', port => 80 }, "Web server is reachable from here");
Wouldn't it have been slightly better to have made Test::User with Test::User::Unix, Test::User::Win32, etc child classes...sorta like File::Spec?
Six of one, half a dozen of the other I guess. Working out which order to put the 2nd and 3rd level namespaces in Perl modules is always a bit subjective. FWIW, I did get feedback from the perl-qa mailing list which suggested that Test::Unix::User/Group was appropriate.