]> matita.cs.unibo.it Git - helm.git/blob - helm/configuration/local/lib/helm/configuration.pl
This commit was manufactured by cvs2svn to create tag 'initial'.
[helm.git] / helm / configuration / local / lib / helm / configuration.pl
1 use XML::Parser;
2
3 # this should be the only fixed constant
4 $configuration_file = "/home/cadet/sacerdot/local/etc/helm/configuration.xml";
5
6 $parser = new XML::Parser(Handlers => {Start => \&handle_start,
7                                        End   => \&handle_end,
8                                        Char  => \&handle_char});
9
10
11 $parser->parsefile($configuration_file, ErrorContext => 3);
12
13
14 sub handle_start
15 {
16    if ($_[1] eq "value-of") {
17       $$varname .= ${$_[3]};
18    } elsif ($_[1] ne "configuration") {
19       $varname = $_[1];
20    }
21 }
22
23 sub handle_end
24 {
25    if ($_[1] ne "value-of" && $_[1] ne "configuration") {
26       # Next line for debugging only:
27       # print "OK: #$_[1]# := #$$varname#\n";
28       $varname = undef;
29    }
30 }
31
32 sub handle_char
33 {
34    $$varname .= $_[1];
35 }