line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alzabo::Config; |
2
|
|
|
|
|
|
|
|
3
|
19
|
|
|
19
|
|
112921
|
use File::Spec; |
|
19
|
|
|
|
|
56
|
|
|
19
|
|
|
|
|
606
|
|
4
|
|
|
|
|
|
|
|
5
|
19
|
|
|
19
|
|
182
|
use vars qw($VERSION %CONFIG); |
|
19
|
|
|
|
|
36
|
|
|
19
|
|
|
|
|
1374
|
|
6
|
|
|
|
|
|
|
|
7
|
19
|
|
|
19
|
|
109
|
use strict; |
|
19
|
|
|
|
|
49
|
|
|
19
|
|
|
|
|
11834
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
$VERSION = 2.0; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
%CONFIG = ( |
12
|
|
|
|
|
|
|
'root_dir' => undef, |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $curdir = File::Spec->curdir; |
16
|
|
|
|
|
|
|
my $updir = File::Spec->updir; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub root_dir |
19
|
|
|
|
|
|
|
{ |
20
|
19
|
50
|
|
19
|
1
|
3519656
|
$CONFIG{root_dir} = $_[0] if defined $_[0]; |
21
|
19
|
|
|
|
|
231
|
return $CONFIG{root_dir}; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub schema_dir |
25
|
|
|
|
|
|
|
{ |
26
|
0
|
0
|
|
0
|
1
|
|
Alzabo::Exception->throw( error => "No Alzabo root directory defined" ) |
27
|
|
|
|
|
|
|
unless defined $CONFIG{root_dir}; |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
return File::Spec->catdir( $CONFIG{root_dir}, 'schemas' ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub available_schemas |
33
|
|
|
|
|
|
|
{ |
34
|
0
|
|
|
0
|
1
|
|
my $dirname = Alzabo::Config::schema_dir; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
local *DIR; |
37
|
0
|
0
|
|
|
|
|
opendir DIR, $dirname |
38
|
|
|
|
|
|
|
or Alzabo::Exception::System->throw( error => "can't open $dirname: $!\n" ); |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my @s; |
41
|
0
|
|
|
|
|
|
foreach my $e (readdir DIR) |
42
|
|
|
|
|
|
|
{ |
43
|
0
|
0
|
0
|
|
|
|
next if $e eq $curdir || $e eq $updir; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
my $dir = File::Spec->catdir( $dirname, $e ); |
46
|
0
|
0
|
0
|
|
|
|
push @s, $e |
|
|
|
0
|
|
|
|
|
47
|
|
|
|
|
|
|
if -d $dir && -r _ && glob "$dir/*.alz"; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
0
|
0
|
|
|
|
|
closedir DIR |
51
|
|
|
|
|
|
|
or Alzabo::Exception::System->throw( error => "can't close $dirname: $!\n" ); |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
return @s; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |