line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Toader; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
30801
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
1
|
|
|
1
|
|
594
|
use Toader::isaToaderDir; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
6
|
1
|
|
|
1
|
|
1015
|
use Toader::findToaderRoot; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
38
|
|
7
|
1
|
|
|
1
|
|
7
|
use base 'Error::Helper'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
61
|
|
8
|
1
|
|
|
1
|
|
825
|
use Toader::pathHelper; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
30
|
|
9
|
1
|
|
|
1
|
|
8
|
use Toader::findToaderRoot; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
10
|
1
|
|
|
1
|
|
782
|
use Toader::Directory; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
11
|
1
|
|
|
1
|
|
851
|
use Sys::Hostname; |
|
1
|
|
|
|
|
1261
|
|
|
1
|
|
|
|
|
58
|
|
12
|
1
|
|
|
1
|
|
490
|
use Toader::Config; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
13
|
1
|
|
|
1
|
|
520
|
use Toader::VCS; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1087
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Toader - A CMS meant to be integrated with a versioning system. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 VERSION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Version 1.1.2 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our $VERSION = '1.1.2'; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 SYNOPSIS |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use Toader; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
my $foo = Toader->new({dir=>$toaderDir}); |
32
|
|
|
|
|
|
|
if ( $foo->error ){ |
33
|
|
|
|
|
|
|
warn('Error:'.$foo->error.': '.$foo->errorString); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 METHODS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 new |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head3 args hash ref |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head4 dir |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
This is the directory to intiate in. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
This is required and needs to be a Toader directory. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head4 outputdir |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
This is the output directory to use when rendering. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my $toader=Toader->new(\%args); |
53
|
|
|
|
|
|
|
if ( $toader->error ){ |
54
|
|
|
|
|
|
|
warn('Error:'.$toader->error.':'.$toader->errorFlag.': '.$toader->errorString); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new{ |
60
|
0
|
|
|
0
|
1
|
|
my %args; |
61
|
0
|
0
|
|
|
|
|
if(defined($_[1])){ |
62
|
0
|
|
|
|
|
|
%args= %{$_[1]}; |
|
0
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
}; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
my $self={ |
66
|
|
|
|
|
|
|
error=>undef, |
67
|
|
|
|
|
|
|
errorString=>'', |
68
|
|
|
|
|
|
|
isatd=>Toader::isaToaderDir->new, |
69
|
|
|
|
|
|
|
perror=>undef, |
70
|
|
|
|
|
|
|
outputdir=>undef, |
71
|
|
|
|
|
|
|
errorExtra=>{ |
72
|
|
|
|
|
|
|
flags=>{ |
73
|
|
|
|
|
|
|
1=>'noDirSpecified', |
74
|
|
|
|
|
|
|
2=>'isaToaderDirError', |
75
|
|
|
|
|
|
|
3=>'notAtoaderDir', |
76
|
|
|
|
|
|
|
4=>'outputIsAtoaderDir', |
77
|
|
|
|
|
|
|
5=>'DirectoryInitError', |
78
|
|
|
|
|
|
|
6=>'ConfigInitError', |
79
|
|
|
|
|
|
|
7=>'PathHerlerInitError', |
80
|
|
|
|
|
|
|
8=>'VCSinitError', |
81
|
|
|
|
|
|
|
9=>'VCSusableError', |
82
|
|
|
|
|
|
|
}, |
83
|
|
|
|
|
|
|
}, |
84
|
|
|
|
|
|
|
}; |
85
|
0
|
|
|
|
|
|
bless $self; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
#makes sure we have a directory |
88
|
0
|
0
|
|
|
|
|
if (!defined( $args{dir} )) { |
89
|
0
|
|
|
|
|
|
$self->{error}=1; |
90
|
0
|
|
|
|
|
|
$self->{errorString}='No directory specified'; |
91
|
0
|
|
|
|
|
|
$self->warn; |
92
|
0
|
|
|
|
|
|
return $self; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
#makes sure it is a Toader directory |
96
|
0
|
|
|
|
|
|
my $results=$self->{isatd}->isaToaderDir($args{dir}); |
97
|
0
|
0
|
|
|
|
|
if ($self->{isatd}->error) { |
98
|
0
|
|
|
|
|
|
$self->{error}=2; |
99
|
0
|
|
|
|
|
|
$self->{errorString}='$self->{isatd}->isaToaderDir($args{dir}) errored. error='.$self->{isatd}->error. |
100
|
|
|
|
|
|
|
' errorString="'.$self->{isatd}->errorString.'"'; |
101
|
0
|
|
|
|
|
|
$self->warn; |
102
|
0
|
|
|
|
|
|
return $self; |
103
|
|
|
|
|
|
|
} |
104
|
0
|
0
|
|
|
|
|
if (!$results) { |
105
|
0
|
|
|
|
|
|
$self->{error}=3; |
106
|
0
|
|
|
|
|
|
$self->{errorString}='"'.$args{dir}.'" is not a Toader directory'; |
107
|
0
|
|
|
|
|
|
$self->warn; |
108
|
0
|
|
|
|
|
|
return $self; |
109
|
|
|
|
|
|
|
} |
110
|
0
|
|
|
|
|
|
$self->{dir}=$args{dir}; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
#finds the Toader root |
113
|
0
|
|
|
|
|
|
my $findroot=Toader::findToaderRoot->new; |
114
|
0
|
|
|
|
|
|
$self->{dir}=$findroot->findToaderRoot( $self->{dir} ); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
#make sure it is clean |
117
|
0
|
|
|
|
|
|
$self->{pathHelper}=Toader::pathHelper->new( $self->{dir} ); |
118
|
0
|
|
|
|
|
|
$self->{dir}=$self->{pathHelper}->cleanup( $self->{dir} ); |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
#handles the output directory if specified |
121
|
0
|
0
|
|
|
|
|
if( defined( $args{outputdir} ) ){ |
122
|
0
|
|
|
|
|
|
$results=$self->{isatd}->isaToaderDir( $args{outputdir} ); |
123
|
0
|
0
|
|
|
|
|
if( $self->{isatd}->error ){ |
124
|
0
|
|
|
|
|
|
$self->{perror}=1; |
125
|
0
|
|
|
|
|
|
$self->{error}=2; |
126
|
0
|
|
|
|
|
|
$self->{errorString}='$self->{isatd}->isaToaderDir($args{outputdir}) errored. error=' |
127
|
|
|
|
|
|
|
.$self->{isatd}->error.' errorString="'.$self->{isatd}->errorString.'"'; |
128
|
0
|
|
|
|
|
|
$self->warn; |
129
|
0
|
|
|
|
|
|
return $self; |
130
|
|
|
|
|
|
|
} |
131
|
0
|
0
|
|
|
|
|
if ($results) { |
132
|
0
|
|
|
|
|
|
$self->{perror}=1; |
133
|
0
|
|
|
|
|
|
$self->{error}=4; |
134
|
0
|
|
|
|
|
|
$self->{errorString}='"'.$args{outputdir}.'" can not be used as a out put directory'. |
135
|
|
|
|
|
|
|
' as it is a Toader directory'; |
136
|
0
|
|
|
|
|
|
$self->warn; |
137
|
0
|
|
|
|
|
|
return $self; |
138
|
|
|
|
|
|
|
} |
139
|
0
|
|
|
|
|
|
$self->{outputdir}=$args{outputdir}; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
# intialize the VCS integration |
143
|
0
|
|
|
|
|
|
$self->{vcs}=Toader::VCS->new($self); |
144
|
0
|
0
|
|
|
|
|
if ( $self->{vcs}->error ){ |
145
|
0
|
|
|
|
|
|
$self->{perror}=1; |
146
|
0
|
|
|
|
|
|
$self->{error}=8; |
147
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initiate VCS. error="'. |
148
|
|
|
|
|
|
|
$self->{vcs}->error.'" errorString="'.$self->{vcs}->errorString.'"'; |
149
|
0
|
|
|
|
|
|
$self->warn; |
150
|
0
|
|
|
|
|
|
return $self; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
# VCS usable |
153
|
0
|
|
|
|
|
|
$self->{VCSusable}=$self->{vcs}->usable; |
154
|
0
|
0
|
|
|
|
|
if ( $self->{vcs}->error ){ |
155
|
0
|
|
|
|
|
|
$self->{perror}=1; |
156
|
0
|
|
|
|
|
|
$self->{error}=9; |
157
|
0
|
|
|
|
|
|
$self->{errorString}='Toader::VCS->usable errored. error="'. |
158
|
|
|
|
|
|
|
$self->{vcs}->error.'" errorString="'.$self->{vcs}->errorString.'"'; |
159
|
0
|
|
|
|
|
|
$self->warn; |
160
|
0
|
|
|
|
|
|
return $self; |
161
|
|
|
|
|
|
|
} |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
# initialize the config |
164
|
0
|
|
|
|
|
|
$self->{config}=Toader::Config->new( $self ); |
165
|
0
|
0
|
|
|
|
|
if ( $self->{config}->error ){ |
166
|
0
|
|
|
|
|
|
$self->{perror}=1; |
167
|
0
|
|
|
|
|
|
$self->{error}=6; |
168
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initialize Toader::Config. error="' |
169
|
|
|
|
|
|
|
.$self->{config}->error.'" errorString="'.$self->{config}->errorString.'"'; |
170
|
0
|
|
|
|
|
|
$self->warn; |
171
|
0
|
|
|
|
|
|
return $self; |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
# initialize the path helper |
175
|
0
|
|
|
|
|
|
$self->{ph}=Toader::pathHelper->new( $self->{dir} ); |
176
|
0
|
0
|
|
|
|
|
if ( $self->{ph}->error ){ |
177
|
0
|
|
|
|
|
|
$self->{perror}=1; |
178
|
0
|
|
|
|
|
|
$self->{error}=7; |
179
|
0
|
|
|
|
|
|
$self->{errorString}='Failed to initiate pathHelper. error="'. |
180
|
|
|
|
|
|
|
$self->{ph}->error.'" errorString="'.$self->{ph}->errorString.'"'; |
181
|
0
|
|
|
|
|
|
$self->warn; |
182
|
0
|
|
|
|
|
|
return $self; |
183
|
|
|
|
|
|
|
} |
184
|
|
|
|
|
|
|
|
185
|
0
|
|
|
|
|
|
return $self; |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head2 getConfig |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
This returns the L object storing the Toader |
191
|
|
|
|
|
|
|
config. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
There is no need to do any error checking as long as |
194
|
|
|
|
|
|
|
Toader new suceeded with out issue. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
my $config=$toader->getConfig; |
197
|
|
|
|
|
|
|
if ( $toader->error ){ |
198
|
|
|
|
|
|
|
warn('Error:'.$toader->error.':'.$toader->errorFlag.': '.$toader->errorString); |
199
|
|
|
|
|
|
|
} |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=cut |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
sub getConfig{ |
204
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
#blank any previous errors |
207
|
0
|
0
|
|
|
|
|
if(!$self->errorblank){ |
208
|
0
|
|
|
|
|
|
return undef; |
209
|
|
|
|
|
|
|
} |
210
|
|
|
|
|
|
|
|
211
|
0
|
|
|
|
|
|
return $self->{config}->getConfig; |
212
|
|
|
|
|
|
|
} |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=head2 getConfigObj |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
This returns the L object that was created |
217
|
|
|
|
|
|
|
when this module was created. |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
my $configObj=$toader->getConfigObj; |
220
|
|
|
|
|
|
|
if ( $toader->error ){ |
221
|
|
|
|
|
|
|
warn('Error:'.$toader->error.':'.$toader->errorFlag.': '.$toader->errorString); |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=cut |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub getConfigObj{ |
227
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
#blank any previous errors |
230
|
0
|
0
|
|
|
|
|
if(!$self->errorblank){ |
231
|
0
|
|
|
|
|
|
return undef; |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
|
234
|
0
|
|
|
|
|
|
return $self->{config}; |
235
|
|
|
|
|
|
|
} |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
=head2 getDirObj |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
This returns a L object with the directory |
240
|
|
|
|
|
|
|
set to the Toader root. |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
my $dirobj=$toader->getDirObj; |
243
|
|
|
|
|
|
|
if ( $toader->error ){ |
244
|
|
|
|
|
|
|
warn('Error:'.$toader->error.':'.$toader->errorFlag.': '.$toader->errorString); |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=cut |
248
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
sub getDirObj{ |
250
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
251
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
#blank any previous errors |
253
|
0
|
0
|
|
|
|
|
if(!$self->errorblank){ |
254
|
0
|
|
|
|
|
|
return undef; |
255
|
|
|
|
|
|
|
} |
256
|
|
|
|
|
|
|
|
257
|
0
|
|
|
|
|
|
my $dirobj=Toader::Directory->new( $self ); |
258
|
|
|
|
|
|
|
|
259
|
0
|
|
|
|
|
|
$dirobj->dirSet( $self->{dir} ); |
260
|
0
|
0
|
|
|
|
|
if ( $dirobj->error ){ |
261
|
0
|
|
|
|
|
|
$self->{error}=5; |
262
|
0
|
|
|
|
|
|
$self->{errorString}='Could not set the directory for the newly created '. |
263
|
|
|
|
|
|
|
'Toader::Directory object to "'.$self->{dir}.'"'; |
264
|
0
|
|
|
|
|
|
$self->warn; |
265
|
0
|
|
|
|
|
|
return undef; |
266
|
|
|
|
|
|
|
} |
267
|
|
|
|
|
|
|
|
268
|
0
|
|
|
|
|
|
return $dirobj; |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=head2 getOutputDir |
272
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
This returns the output directory. |
274
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
If none is specified, undef is returned. |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
There is no reason for check for errors if new |
278
|
|
|
|
|
|
|
succeeded with out error. |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
my $outputdir=$toader->getOutputDir; |
281
|
|
|
|
|
|
|
if( defined( $outputdir ) ){ |
282
|
|
|
|
|
|
|
print "outputdir='".$outputdir."'\n"; |
283
|
|
|
|
|
|
|
}else{ |
284
|
|
|
|
|
|
|
print "No output directory defined.\n"; |
285
|
|
|
|
|
|
|
} |
286
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=cut |
288
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
sub getOutputDir{ |
290
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
#blank any previous errors |
293
|
0
|
0
|
|
|
|
|
if(!$self->errorblank){ |
294
|
0
|
|
|
|
|
|
return undef; |
295
|
|
|
|
|
|
|
} |
296
|
|
|
|
|
|
|
|
297
|
0
|
|
|
|
|
|
return $self->{outputdir}; |
298
|
|
|
|
|
|
|
} |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
=head2 getPathHelper |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
This returns a L object for this Toader object. |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
If the Toader object initialized with out issue, then there is no reason |
305
|
|
|
|
|
|
|
to check for an error. |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
my $pathHelper=$toader->getPathHelper; |
308
|
|
|
|
|
|
|
if ( $toader->error ){ |
309
|
|
|
|
|
|
|
warn('Error:'.$toader->error.':'.$toader->errorFlag.': '.$toader->errorString); |
310
|
|
|
|
|
|
|
} |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
=cut |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
sub getPathHelper{ |
315
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
#blank any previous errors |
318
|
0
|
0
|
|
|
|
|
if(!$self->errorblank){ |
319
|
0
|
|
|
|
|
|
return undef; |
320
|
|
|
|
|
|
|
} |
321
|
|
|
|
|
|
|
|
322
|
0
|
|
|
|
|
|
return $self->{ph}; |
323
|
|
|
|
|
|
|
} |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
=head2 getRootDir |
326
|
|
|
|
|
|
|
|
327
|
|
|
|
|
|
|
This returns the root directory for what Toader is using. |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
If the returned value is not defined, one has not been set yet. |
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
my $rootdir=$toader->getRootDir; |
332
|
|
|
|
|
|
|
if ( $foo->error ){ |
333
|
|
|
|
|
|
|
warn('Error:'.$foo->error.':'.$toader->errorFlag.': '.$foo->errorString); |
334
|
|
|
|
|
|
|
} |
335
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=cut |
337
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
sub getRootDir{ |
339
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
340
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
#blank any previous errors |
343
|
0
|
0
|
|
|
|
|
if(!$self->errorblank){ |
344
|
0
|
|
|
|
|
|
return undef; |
345
|
|
|
|
|
|
|
} |
346
|
|
|
|
|
|
|
|
347
|
0
|
|
|
|
|
|
return $self->{dir}; |
348
|
|
|
|
|
|
|
} |
349
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
=head2 setOutputDir |
351
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
This sets the output directory. |
353
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
$foo->setOutputDir( $dir ); |
355
|
|
|
|
|
|
|
if ( $foo->error ){ |
356
|
|
|
|
|
|
|
warn('Error:'.$foo->error.':'.$toader->errorFlag.': '.$foo->errorString); |
357
|
|
|
|
|
|
|
} |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
=cut |
360
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
sub setOutputDir{ |
362
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
363
|
0
|
|
|
|
|
|
my $dir=$_[1]; |
364
|
|
|
|
|
|
|
|
365
|
|
|
|
|
|
|
#blank any previous errors |
366
|
0
|
0
|
|
|
|
|
if(!$self->errorblank){ |
367
|
0
|
|
|
|
|
|
return undef; |
368
|
|
|
|
|
|
|
} |
369
|
|
|
|
|
|
|
|
370
|
|
|
|
|
|
|
#makes sure it is a directory |
371
|
0
|
0
|
|
|
|
|
if ( ! defined($dir) ){ |
372
|
0
|
|
|
|
|
|
$self->{error}=1; |
373
|
0
|
|
|
|
|
|
$self->{errorString}='No directory defined'; |
374
|
0
|
|
|
|
|
|
$self->warn; |
375
|
0
|
|
|
|
|
|
return undef; |
376
|
|
|
|
|
|
|
} |
377
|
|
|
|
|
|
|
|
378
|
0
|
|
|
|
|
|
my $results=$self->{isatd}->isaToaderDir( $dir ); |
379
|
0
|
0
|
|
|
|
|
if( $self->{isatd}->error ){ |
380
|
0
|
|
|
|
|
|
$self->{perror}=1; |
381
|
0
|
|
|
|
|
|
$self->{error}=2; |
382
|
0
|
|
|
|
|
|
$self->{errorString}='$self->{isatd}->isaToaderDir($args{outputdir}) errored. error=' |
383
|
|
|
|
|
|
|
.$self->{isatd}->error.' errorString="'.$self->{isatd}->errorString.'"'; |
384
|
0
|
|
|
|
|
|
$self->warn; |
385
|
0
|
|
|
|
|
|
return undef; |
386
|
|
|
|
|
|
|
} |
387
|
0
|
0
|
|
|
|
|
if ($results) { |
388
|
0
|
|
|
|
|
|
$self->{error}=4; |
389
|
0
|
|
|
|
|
|
$self->{errorString}='"'.$dir.'" can not be used as a out put directory'. |
390
|
|
|
|
|
|
|
'as it is a Toader directory'; |
391
|
0
|
|
|
|
|
|
$self->warn; |
392
|
0
|
|
|
|
|
|
return undef; |
393
|
|
|
|
|
|
|
} |
394
|
0
|
|
|
|
|
|
$self->{outputdir}=$dir; |
395
|
|
|
|
|
|
|
|
396
|
0
|
|
|
|
|
|
return 1; |
397
|
|
|
|
|
|
|
} |
398
|
|
|
|
|
|
|
|
399
|
|
|
|
|
|
|
=head2 getVCS |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
This returns to the L object. |
402
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
my $vcs=$toader->getVCS; |
404
|
|
|
|
|
|
|
if ( $toader->error ){ |
405
|
|
|
|
|
|
|
warn('Error:'.$toader->error.':'.$toader->errorFlag.': '.$toader->errorString); |
406
|
|
|
|
|
|
|
} |
407
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
=cut |
409
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
sub getVCS{ |
411
|
0
|
|
|
0
|
1
|
|
my $self=$_[0]; |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
#blank any previous errors |
414
|
0
|
0
|
|
|
|
|
if(!$self->errorblank){ |
415
|
0
|
|
|
|
|
|
return undef; |
416
|
|
|
|
|
|
|
} |
417
|
|
|
|
|
|
|
|
418
|
0
|
|
|
|
|
|
return $self->{vcs}; |
419
|
|
|
|
|
|
|
} |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
=head1 ERROR CODES |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
=head2 1, noDirSpecified |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
No directory specified. |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
=head2 2, isaToaderDirError |
428
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
Toader::isaToaderDir->isaToaderDir errored. |
430
|
|
|
|
|
|
|
|
431
|
|
|
|
|
|
|
=head2 3, notAtoaderDir |
432
|
|
|
|
|
|
|
|
433
|
|
|
|
|
|
|
The specified directory is not a Toader directory. |
434
|
|
|
|
|
|
|
|
435
|
|
|
|
|
|
|
=head2 4, outputIsAtoaderDir |
436
|
|
|
|
|
|
|
|
437
|
|
|
|
|
|
|
The specified output directory is a Toader directory. |
438
|
|
|
|
|
|
|
|
439
|
|
|
|
|
|
|
=head2 5, DirectoryInitError |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
Could initialize the L object. |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
=head2 6, ConfigInitError |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
Failed to initialize L. |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
=head2 7, PathHerlerInitError |
448
|
|
|
|
|
|
|
|
449
|
|
|
|
|
|
|
Failed to initiate the path helper. |
450
|
|
|
|
|
|
|
|
451
|
|
|
|
|
|
|
=head2 8, VCSinitError |
452
|
|
|
|
|
|
|
|
453
|
|
|
|
|
|
|
Failed to initiate VCS integration. |
454
|
|
|
|
|
|
|
|
455
|
|
|
|
|
|
|
=head2 9, VCSusableError |
456
|
|
|
|
|
|
|
|
457
|
|
|
|
|
|
|
Toader::VCS->usable errored. |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
=head1 AUTHOR |
460
|
|
|
|
|
|
|
|
461
|
|
|
|
|
|
|
Zane C. Bowers-Hadley, C<< >> |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
=head1 BUGS |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
467
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
468
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
=head1 SUPPORT |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
perldoc Toader |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
You can also look for information at: |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
=over 4 |
483
|
|
|
|
|
|
|
|
484
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
485
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
L |
487
|
|
|
|
|
|
|
|
488
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
L |
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
=item * CPAN Ratings |
493
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
L |
495
|
|
|
|
|
|
|
|
496
|
|
|
|
|
|
|
=item * Search CPAN |
497
|
|
|
|
|
|
|
|
498
|
|
|
|
|
|
|
L |
499
|
|
|
|
|
|
|
|
500
|
|
|
|
|
|
|
=back |
501
|
|
|
|
|
|
|
|
502
|
|
|
|
|
|
|
|
503
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
|
506
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
507
|
|
|
|
|
|
|
|
508
|
|
|
|
|
|
|
Copyright 2013 Zane C. Bowers-Hadley |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
511
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
512
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
|
517
|
|
|
|
|
|
|
=cut |
518
|
|
|
|
|
|
|
|
519
|
|
|
|
|
|
|
1; # End of Toader |