line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Test::Dir; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
23253
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
46
|
|
5
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
60
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my |
8
|
|
|
|
|
|
|
$VERSION = 1.15; |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
6
|
use base qw( Exporter Test::Dir::Base ); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
868
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT; |
13
|
|
|
|
|
|
|
push @EXPORT, qw( dir_exists_ok dir_not_exists_ok ); |
14
|
|
|
|
|
|
|
push @EXPORT, qw( dir_empty_ok dir_not_empty_ok ); |
15
|
|
|
|
|
|
|
push @EXPORT, qw( dir_readable_ok dir_not_readable_ok ); |
16
|
|
|
|
|
|
|
push @EXPORT, qw( dir_writable_ok dir_not_writable_ok ); |
17
|
|
|
|
|
|
|
push @EXPORT, qw( dir_executable_ok dir_not_executable_ok ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Test::Dir - test directory attributes |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Test::More ...; |
26
|
|
|
|
|
|
|
use Test::Dir; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 DESCRIPTION |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
This modules provides a collection of test utilities for directory attributes. |
31
|
|
|
|
|
|
|
Use it in combination with Test::More in your test programs. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 FUNCTIONS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 dir_exists_ok(DIRNAME [, TESTNAME] ) |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Ok if the directory exists, and not ok otherwise. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub dir_exists_ok |
42
|
|
|
|
|
|
|
{ |
43
|
3
|
|
|
3
|
1
|
1654
|
Test::Dir::Base::_dir_exists_ok(@_); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=head2 dir_not_exists_ok(DIRNAME [, TESTNAME] ) |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Ok if the directory does not exist, and not ok otherwise. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=cut |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub dir_not_exists_ok |
53
|
|
|
|
|
|
|
{ |
54
|
1
|
|
|
1
|
1
|
710
|
Test::Dir::Base::_dir_not_exists_ok(@_); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 dir_empty_ok(DIRNAME [, TESTNAME] ) |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Ok if the directory is empty (contains no files or subdirectories), |
60
|
|
|
|
|
|
|
and not ok otherwise. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub dir_empty_ok |
65
|
|
|
|
|
|
|
{ |
66
|
1
|
|
|
1
|
1
|
708
|
Test::Dir::Base::_dir_empty_ok(@_); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 dir_not_empty_ok(DIRNAME [, TESTNAME] ) |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Ok if the directory is not empty, and not ok otherwise. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub dir_not_empty_ok |
76
|
|
|
|
|
|
|
{ |
77
|
1
|
|
|
1
|
1
|
538
|
Test::Dir::Base::_dir_not_empty_ok(@_); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 dir_readable_ok(DIRNAME [, TESTNAME] ) |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Ok if the directory is readable, and not ok otherwise. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub dir_readable_ok |
87
|
|
|
|
|
|
|
{ |
88
|
1
|
|
|
1
|
1
|
663
|
Test::Dir::Base::_dir_readable_ok(@_); |
89
|
|
|
|
|
|
|
} # dir_readable_ok |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 dir_not_readable_ok(DIRNAME [, TESTNAME] ) |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Ok if the directory is not readable, and not ok otherwise. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub dir_not_readable_ok |
98
|
|
|
|
|
|
|
{ |
99
|
1
|
|
|
1
|
1
|
517
|
Test::Dir::Base::_dir_not_readable_ok(@_); |
100
|
|
|
|
|
|
|
} # dir_not_readable_ok |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head2 dir_writable_ok(DIRNAME [, TESTNAME] ) |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Ok if the directory is writable, and not ok otherwise. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub dir_writable_ok |
110
|
|
|
|
|
|
|
{ |
111
|
1
|
|
|
1
|
1
|
612
|
Test::Dir::Base::_dir_writable_ok(@_); |
112
|
|
|
|
|
|
|
} # dir_writable_ok |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 dir_not_writable_ok(DIRNAME [, TESTNAME] ) |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Ok if the directory is not writable, and not ok otherwise. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub dir_not_writable_ok |
121
|
|
|
|
|
|
|
{ |
122
|
1
|
|
|
1
|
1
|
486
|
Test::Dir::Base::_dir_not_writable_ok(@_); |
123
|
|
|
|
|
|
|
} # dir_not_writable_ok |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head2 dir_executable_ok(DIRNAME [, TESTNAME] ) |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Ok if the directory is executable, and not ok otherwise. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub dir_executable_ok |
133
|
|
|
|
|
|
|
{ |
134
|
1
|
|
|
1
|
1
|
530
|
Test::Dir::Base::_dir_executable_ok(@_); |
135
|
|
|
|
|
|
|
} # dir_executable_ok |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head2 dir_not_executable_ok(DIRNAME [, TESTNAME] ) |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Ok if the directory is not executable, and not ok otherwise. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=cut |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
sub dir_not_executable_ok |
144
|
|
|
|
|
|
|
{ |
145
|
1
|
|
|
1
|
1
|
497
|
Test::Dir::Base::_dir_not_executable_ok(@_); |
146
|
|
|
|
|
|
|
} # dir_not_executable_ok |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 TO DO |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
I know there are a lot more directory attributes that can be tested. |
152
|
|
|
|
|
|
|
If you need them, please ask (or better yet, contribute code!). |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=head1 AUTHOR |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
Martin 'Kingpin' Thurn, C, L. |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 BUGS |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
Please report any bugs or feature requests to C
|
161
|
|
|
|
|
|
|
rt.cpan.org>, or through the web interface at |
162
|
|
|
|
|
|
|
L. I will be |
163
|
|
|
|
|
|
|
notified, and then you'll automatically be notified of progress on |
164
|
|
|
|
|
|
|
your bug as I make changes. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=head1 SUPPORT |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
perldoc Test::Dir |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
You can also look for information at: |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
=over 4 |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
L |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
L |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=item * CPAN Ratings |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
L |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=item * Search CPAN |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
L |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=back |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
Copyright (C) 2007-2008 Martin 'Kingpin' Thurn |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
203
|
|
|
|
|
|
|
under the same terms as Perl itself. |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=cut |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
1; |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
__END__ |