line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::XMetaL::Registry;
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
28785
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1002
|
use Hash::Util qw(lock_keys);
|
|
1
|
|
|
|
|
12501
|
|
|
1
|
|
|
|
|
9
|
|
8
|
1
|
|
|
1
|
|
560
|
use Win32::TieRegistry(Delimiter => '/');
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new {
|
11
|
|
|
|
|
|
|
my ($class) = @_;
|
12
|
|
|
|
|
|
|
my $self;
|
13
|
|
|
|
|
|
|
eval {
|
14
|
|
|
|
|
|
|
$self = bless {
|
15
|
|
|
|
|
|
|
_softquad_key => 'HKEY_LOCAL_MACHINE/SOFTWARE/SoftQuad/',
|
16
|
|
|
|
|
|
|
}, ref($class) || $class; |
17
|
|
|
|
|
|
|
lock_keys(%$self, keys %$self);
|
18
|
|
|
|
|
|
|
$Registry->Delimiter("/");
|
19
|
|
|
|
|
|
|
#$self->{_xmetal_path} = $self->_get_xmetal_path_from_registry();
|
20
|
|
|
|
|
|
|
};
|
21
|
|
|
|
|
|
|
croak $@ if $@;
|
22
|
|
|
|
|
|
|
return $self;
|
23
|
|
|
|
|
|
|
}
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _get_softquad_key {$_[0]->{_softquad_key}}
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#sub _get_xmetal_path {$_[0]->{_xmetal_path}}
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#sub _get_xmetal_path_from_registry { |
30
|
|
|
|
|
|
|
# my ($self) = @_; |
31
|
|
|
|
|
|
|
# my $registry_key_string = $self->{_xmetal_path_registry_key}; |
32
|
|
|
|
|
|
|
# my $registry_key = $Registry->{$registry_key_string}; |
33
|
|
|
|
|
|
|
# return $registry_key->{'/'}; |
34
|
|
|
|
|
|
|
#} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub xmetal_versions {
|
37
|
|
|
|
|
|
|
my ($self) = @_;
|
38
|
|
|
|
|
|
|
#return ($self->_get_xmetal_path());
|
39
|
|
|
|
|
|
|
my $softquad_key = $self->_get_softquad_key();
|
40
|
|
|
|
|
|
|
my $softquad_hive = $Registry->{$softquad_key};
|
41
|
|
|
|
|
|
|
my @subkeys = $softquad_hive->SubKeyNames;
|
42
|
|
|
|
|
|
|
@subkeys = sort grep {/^XMetaL \d+\.\d+/} @subkeys;
|
43
|
|
|
|
|
|
|
return wantarray ? @subkeys : $subkeys[-1];
|
44
|
|
|
|
|
|
|
}
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub xmetal_directory_path {
|
47
|
|
|
|
|
|
|
my ($self) = @_;
|
48
|
|
|
|
|
|
|
my $softquad_key = $self->_get_softquad_key();
|
49
|
|
|
|
|
|
|
my $softquad_hive = $Registry->{$softquad_key};
|
50
|
|
|
|
|
|
|
my @xmetal_versions = $self->xmetal_versions();
|
51
|
|
|
|
|
|
|
my @xmetal_keys = map {"$_/Path//"} @xmetal_versions;
|
52
|
|
|
|
|
|
|
my @xmetal_paths = map {$softquad_hive->{$_}} @xmetal_keys;
|
53
|
|
|
|
|
|
|
return wantarray ? @xmetal_paths : $xmetal_paths[-1];
|
54
|
|
|
|
|
|
|
}
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1;
|
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__
|