package Test::Dir; use warnings; use strict; use Exporter; use Test::Builder; use base 'Exporter'; our @EXPORT = qw( dir_exists_ok dir_not_exists_ok ); =head1 NAME Test::Dir - test directory attributes =cut our $VERSION = do { my @r = (q$Revision: 1.2 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; =head1 SYNOPSIS Quick summary of what the module does. Perhaps a little code snippet. use Test::Dir; my $foo = Test::Dir->new(); ... =cut my $Test = new Test::Builder; =head1 FUNCTIONS =head2 dir_exists_ok Ok if the directory exists, and not ok otherwise. =cut sub dir_exists_ok { my $sDir = shift; my $sName = shift || "dir $sDir exists"; my $iOK = -d $sDir; if ($iOK) { $Test->ok(1, $sName); } else { $Test->diag(qq{directory [$sDir] does not exist}); $Test->ok(0, $sName); } } # dir_exists_ok =head2 dir_not_exists_ok Ok if the directory does not exist, and not ok otherwise. =cut sub dir_not_exists_ok { my $sDir = shift; my $sName = shift || "dir $sDir does not exist"; my $iOK = ! -d $sDir; if ($iOK) { $Test->ok(1, $sName); } else { $Test->diag(qq{directory [$sDir] does not exist}); $Test->ok(0, $sName); } } # dir_not_exists_ok =head1 AUTHOR Martin 'Kingpin' Thurn, C<< >> =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. =head1 SUPPORT You can find documentation for this module with the perldoc command. perldoc Test::Dir You can also look for information at: =over 4 =item * RT: CPAN's request tracker L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPAN Ratings L =item * Search CPAN L =back =head1 ACKNOWLEDGEMENTS =head1 COPYRIGHT & LICENSE Copyright (C) 2007 Martin 'Kingpin' Thurn This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut 1; __END__