| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mail::Maildir::Is::A; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
104527
|
use warnings; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
55
|
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
536
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Mail::Maildir::Is::A - Checks if a directory is a mail directory or not. |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 0.0.0 |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '0.0.0'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 METHODS |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head2 new |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Initiates the object. |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $foo=Mail::Maildir::Is::A->new; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=cut |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub new { |
|
29
|
0
|
|
|
0
|
1
|
|
my %args; |
|
30
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
|
31
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
|
0
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
}; |
|
33
|
0
|
|
|
|
|
|
my $method='new'; |
|
34
|
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
|
my $self={ |
|
36
|
|
|
|
|
|
|
error=>undef, |
|
37
|
|
|
|
|
|
|
errorString=>'', |
|
38
|
|
|
|
|
|
|
module=>'Mail-Maildir-Is-a', |
|
39
|
|
|
|
|
|
|
}; |
|
40
|
0
|
|
|
|
|
|
bless $self; |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
return $self; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=head2 isAmaildir |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
This returns true or false based on if specified directory is a maildir |
|
48
|
|
|
|
|
|
|
or not. |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
my $returned=$foo->isAmaildir('/somedir'); |
|
51
|
|
|
|
|
|
|
if($foo->error){ |
|
52
|
|
|
|
|
|
|
warn('Error:'.$self->error.':'.$self->errorString); |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
if(! $returned){ |
|
55
|
|
|
|
|
|
|
print "It is a maildir."\n"; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub isAmaildir{ |
|
61
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
62
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
|
63
|
0
|
|
|
|
|
|
my $method='isAmaildir'; |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
$self->errorblank; |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
0
|
|
|
|
|
if (!defined( $dir )) { |
|
68
|
0
|
|
|
|
|
|
$self->{error}=3; |
|
69
|
0
|
|
|
|
|
|
$self->{errorString}='No directory specified'; |
|
70
|
0
|
|
|
|
|
|
warn($self->{module}.' ',$method.':'.$self->error.': '.$self->{errorString}); |
|
71
|
0
|
|
|
|
|
|
return undef; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
0
|
0
|
|
|
|
|
if (! -e $dir) { |
|
75
|
0
|
|
|
|
|
|
$self->{error}=1; |
|
76
|
0
|
|
|
|
|
|
$self->{errorString}='The specified item does not exist'; |
|
77
|
0
|
|
|
|
|
|
warn($self->{module}.' ',$method.':'.$self->error.': '.$self->{errorString}); |
|
78
|
0
|
|
|
|
|
|
return undef; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
if (! -d $dir) { |
|
82
|
0
|
|
|
|
|
|
$self->{error}=2; |
|
83
|
0
|
|
|
|
|
|
$self->{errorString}='The specified item does not exist'; |
|
84
|
0
|
|
|
|
|
|
warn($self->{module}.' ',$method.':'.$self->error.': '.$self->{errorString}); |
|
85
|
0
|
|
|
|
|
|
return undef; |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
#makes sure all the directories exist |
|
89
|
0
|
0
|
|
|
|
|
if (! -d $dir.'/new/') { |
|
90
|
0
|
|
|
|
|
|
return undef; |
|
91
|
|
|
|
|
|
|
} |
|
92
|
0
|
0
|
|
|
|
|
if (! -d $dir.'/cur/') { |
|
93
|
0
|
|
|
|
|
|
return undef; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
0
|
0
|
|
|
|
|
if (! -d $dir.'/tmp/') { |
|
96
|
0
|
|
|
|
|
|
return undef; |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
return 1; |
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 ERROR HANDLING METHODS |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 error |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Returns the current error code and true if there is an error. |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
If there is no error, undef is returned. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $error=$foo->error; |
|
111
|
|
|
|
|
|
|
if($error){ |
|
112
|
|
|
|
|
|
|
print 'error code: '.$error."\n"; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub error{ |
|
118
|
0
|
|
|
0
|
1
|
|
return $_[0]->{error}; |
|
119
|
|
|
|
|
|
|
} |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 errorblank |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
This blanks the error storage and is only meant for internal usage. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
It does the following. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
$zconf->{error}=undef; |
|
128
|
|
|
|
|
|
|
$zconf->{errorString}=""; |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=cut |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
#blanks the error flags |
|
133
|
|
|
|
|
|
|
sub errorblank{ |
|
134
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
|
135
|
|
|
|
|
|
|
|
|
136
|
0
|
|
|
|
|
|
$self->{error}=undef; |
|
137
|
0
|
|
|
|
|
|
$self->{errorString}=""; |
|
138
|
|
|
|
|
|
|
|
|
139
|
0
|
|
|
|
|
|
return 1; |
|
140
|
|
|
|
|
|
|
}; |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 ERROR CODES |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 1 |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
The item does not exist. |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 2 |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
The item is not a directory. |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 3 |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
No directory specified. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 AUTHOR |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Zane C. Bowers, C<< >> |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 BUGS |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
|
163
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
|
164
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 SUPPORT |
|
170
|
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
|
172
|
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
perldoc Mail::Maildir::Is::A |
|
174
|
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
You can also look for information at: |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=over 4 |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
L |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
L |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * CPAN Ratings |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
L |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item * Search CPAN |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
L |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=back |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
Copyright 2010 Zane C. Bowers. |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
|
207
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
|
208
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=cut |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
1; # End of Mail::Maildir::Is::A |