line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package XML::MyXML::Util; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
36
|
use strict; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
145
|
|
4
|
5
|
|
|
5
|
|
23
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
1787
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
|
|
|
|
|
|
our @ISA = ('Exporter'); |
8
|
|
|
|
|
|
|
our @EXPORT_OK = qw/ trim strip_ns debug /; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub trim { |
11
|
2
|
|
|
2
|
0
|
5
|
my $string = shift; |
12
|
|
|
|
|
|
|
|
13
|
2
|
50
|
|
|
|
4
|
if (defined $string) { |
14
|
2
|
|
|
|
|
7
|
$string =~ s/^\s+//; |
15
|
2
|
|
|
|
|
7
|
$string =~ s/\s+$//; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
7
|
return $string; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub strip_ns { |
22
|
3
|
|
|
3
|
0
|
8
|
my $string = shift; |
23
|
|
|
|
|
|
|
|
24
|
3
|
50
|
|
|
|
10
|
defined $string or return undef; |
25
|
|
|
|
|
|
|
|
26
|
3
|
|
|
|
|
15
|
my $num_colons = () = $string =~ /\:/g; |
27
|
3
|
100
|
66
|
|
|
27
|
if ($num_colons == 1 and $string =~ /.\:./) { |
28
|
2
|
|
|
|
|
14
|
$string =~ s/^.+\://; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
3
|
|
|
|
|
14
|
return $string; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub debug { |
35
|
0
|
|
|
0
|
0
|
|
my $thing = shift; |
36
|
0
|
|
|
|
|
|
require Data::Dumper; |
37
|
0
|
0
|
|
|
|
|
warn Data::Dumper::Dumper($thing) if $ENV{DEBUG}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |