line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Toader::isaToaderDir; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
5
|
1
|
|
|
1
|
|
4
|
use base 'Error::Helper'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
623
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Toader::isaToaderDir - Checks if a directory has Toader support or not. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.1.0 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.1.0'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use Toader::isaToaderDir; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $foo = Toader::isaToaderDir->new(); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
my $returned=$foo->isaToaderDir($directory); |
27
|
|
|
|
|
|
|
if(!$returned){ |
28
|
|
|
|
|
|
|
if($foo->error){ |
29
|
|
|
|
|
|
|
warn('Error '.$foo->error.': '.$foo->errorString); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
}else{ |
32
|
|
|
|
|
|
|
print "It is a Toader directory"; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 new |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
This initiates the object. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
my $foo = Toader::isaToaderDir->new(); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new{ |
46
|
|
|
|
|
|
|
my $self={ |
47
|
|
|
|
|
|
|
error=>undef, |
48
|
|
|
|
|
|
|
errorString=>'', |
49
|
|
|
|
|
|
|
perror=>undef, |
50
|
|
|
|
|
|
|
errorExtra=>{ |
51
|
|
|
|
|
|
|
flags=>{ |
52
|
|
|
|
|
|
|
1=>'noDirSpecified', |
53
|
|
|
|
|
|
|
2=>'notAdir', |
54
|
|
|
|
|
|
|
}, |
55
|
|
|
|
|
|
|
}, |
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
bless $self; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
return $self; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 isaToaderDir |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
This checks if a directory is a L directory. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
If it is it returns true, it is a L directory. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
A error will only be generated if a directory is not specified |
69
|
|
|
|
|
|
|
or it does not exist. |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
my $returned=$foo->isaToaderDir($directory); |
72
|
|
|
|
|
|
|
if(!$returned){ |
73
|
|
|
|
|
|
|
if($foo->error){ |
74
|
|
|
|
|
|
|
warn('Error '.$foo->error.': '.$foo->errorString); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
}else{ |
77
|
|
|
|
|
|
|
print "It is a Toader directory"; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=cut |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub isaToaderDir{ |
83
|
|
|
|
|
|
|
my $self=$_[0]; |
84
|
|
|
|
|
|
|
my $dir=$_[1]; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
#blank any previous errors |
87
|
|
|
|
|
|
|
if(!$self->errorblank){ |
88
|
|
|
|
|
|
|
return undef; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
# Makes sure a directory is specified. |
92
|
|
|
|
|
|
|
if (!defined( $dir )) { |
93
|
|
|
|
|
|
|
$self->{error}=1; |
94
|
|
|
|
|
|
|
$self->{errorString}='No directory defined'; |
95
|
|
|
|
|
|
|
return undef; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
# Make sure the what is a directory. |
99
|
|
|
|
|
|
|
if (! -d $dir ) { |
100
|
|
|
|
|
|
|
$self->{error}=2; |
101
|
|
|
|
|
|
|
$self->{errorString}='The specified item is not a directory'; |
102
|
|
|
|
|
|
|
return undef; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
#makes sure the required toader directory exists |
106
|
|
|
|
|
|
|
if (! -d $dir.'/.toader') { |
107
|
|
|
|
|
|
|
return undef; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
return 1; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 ERROR CODES |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head2 1, noDirSpecified |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
No directory specified. |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head2 2, notAdir |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Not a directory. |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 AUTHOR |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Zane C. Bowers-Hadley, C<< >> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 BUGS |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
130
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
131
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head1 SUPPORT |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
perldoc Toader::isaToaderDir |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
You can also look for information at: |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=over 4 |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
L |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
L |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item * CPAN Ratings |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
L |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item * Search CPAN |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
L |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=back |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Copyright 2013 Zane C. Bowers-Hadley. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
174
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
175
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=cut |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
1; # End of Toader::isaToaderDir |