line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package TM::Utils; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
sub xmlify_hash { |
4
|
|
|
|
|
|
|
my $hash = shift; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5016
|
use XML::LibXML::SAX::Builder; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
my $builder = new XML::LibXML::SAX::Builder; |
8
|
|
|
|
|
|
|
use TM::Utils::TreeWalker; |
9
|
|
|
|
|
|
|
my $walker = new TM::Utils::TreeWalker (Handler => $builder); |
10
|
|
|
|
|
|
|
$walker->walk ($hash); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
return $builder->result()->toString; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub is_xml { |
16
|
|
|
|
|
|
|
my $s = shift; |
17
|
|
|
|
|
|
|
use XML::LibXML; |
18
|
|
|
|
|
|
|
my $parser = XML::LibXML->new(); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
eval { |
21
|
|
|
|
|
|
|
my $doc = $parser->parse_string ($s); |
22
|
|
|
|
|
|
|
}; $@ ? 0 : 1; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our $VERSION = '1.04'; |
26
|
|
|
|
|
|
|
our $REVISION = '$Id: Utils.pm,v 1.5 2006/11/13 08:02:33 rho Exp $'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |