/usr/share/perl5/TM/Utils/TreeWalker.pm is in libtm-perl 1.56-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | package TM::Utils::TreeWalker;
use base qw(XML::SAX::Base);
sub walk {
my $self = shift;
my $hash = shift;
$self->SUPER::start_document();
$self->SUPER::start_element ({ Name => 'root'} );
_walk_children ($self, $hash);
sub _walk_children {
my $self = shift;
my $hash = shift;
foreach (keys %{$hash}) {
$self->SUPER::start_element ({ Name => $_ });
if (ref ($hash->{$_}) eq 'HASH') {
_walk_children ($self, $hash->{$_});
} else {
$self->SUPER::characters ({ Data => $hash->{$_} });
}
$self->SUPER::end_element ({ Name => $_ });
}
}
$self->SUPER::end_element ({ Name => 'root'} );
$self->SUPER::end_document();
}
1;
__END__
package CamelDriver;
use base qw(XML::SAX::Base);
sub parse {
my $self = shift;
my %links = @_;
$self->SUPER::start_document;
$self->SUPER::start_element({Name => 'html'});
$self->SUPER::start_element({Name => 'body'});
foreach my $item (keys (%camelid_links)) {
$self->SUPER::start_element({Name => 'a',
Attributes => {
'href' => $links{$item}->{url}
}
});
$self->SUPER::characters({Data => $links{$item}->{description}});
$self->SUPER::end_element({Name => 'a'});
}
$self->SUPER::end_element({Name => 'body'});
$self->SUPER::end_element({Name => 'html'});
$self->SUPER::end_document;
}
1;
|