Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

nik (3476)

nik
  nikc@cpan.org
AOL IM: nikclayton (Add Buddy, Send Message)

Journal of nik (3476)

Saturday July 09, 2005
05:59 AM

4 new Test::* modules

[ #25599 ]

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");

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • It appears that the CPAN Ratings is having issues, so here goes....

    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?

    As it stands now, we would have to make a Test::Win32::User, which would turned out slightly dirty namespace wise for all of the possibilities...

    Just a thought...

  • 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.