| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Goo::Thing::conf::ConfigProfiler; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
|
4
|
|
|
|
|
|
|
# Nigel Hamilton |
|
5
|
|
|
|
|
|
|
# |
|
6
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2005 |
|
7
|
|
|
|
|
|
|
# All Rights Reserved |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
|
10
|
|
|
|
|
|
|
# Filename: Goo::Thing::conf::ConfigProfiler.pm |
|
11
|
|
|
|
|
|
|
# Description: Profile a config file |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
# Date Change |
|
14
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
|
15
|
|
|
|
|
|
|
# 17/09/2005 Version 1 |
|
16
|
|
|
|
|
|
|
# 17/09/2005 Added method: showProfile |
|
17
|
|
|
|
|
|
|
# 16/10/2005 Added method: getFields |
|
18
|
|
|
|
|
|
|
# |
|
19
|
|
|
|
|
|
|
############################################################################### |
|
20
|
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
3850
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
31
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
6
|
use Goo::List; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
19
|
|
|
24
|
1
|
|
|
1
|
|
5
|
use Goo::Object; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
16
|
|
|
25
|
1
|
|
|
1
|
|
6
|
use Goo::Profile; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
20
|
|
|
26
|
1
|
|
|
1
|
|
5
|
use base qw (Goo::Object); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
407
|
|
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
############################################################################### |
|
30
|
|
|
|
|
|
|
# |
|
31
|
|
|
|
|
|
|
# run - display a profile of an xml thing |
|
32
|
|
|
|
|
|
|
# |
|
33
|
|
|
|
|
|
|
############################################################################### |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub run { |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
0
|
1
|
|
my ($this, $thing) = @_; |
|
38
|
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $profile = Goo::Profile->new($thing); |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
|
while (1) { |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
$profile->clear(); |
|
44
|
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
$profile->show_header("Config Profile", |
|
46
|
|
|
|
|
|
|
$thing->get_filename(), |
|
47
|
|
|
|
|
|
|
$thing->get_location()); |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# add the variable list |
|
50
|
0
|
|
|
|
|
|
$profile->add_options_table("Fields", 4, "Goo::JumpProfileOption", |
|
51
|
|
|
|
|
|
|
$this->get_fields($thing->get_file())); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# add a list of Things found in this Thing |
|
54
|
0
|
|
|
|
|
|
$profile->add_things_table(); |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
# show the profile and all the rendered tables |
|
57
|
0
|
|
|
|
|
|
$profile->display(); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# prompt the user for the next command |
|
60
|
0
|
|
|
|
|
|
$profile->get_command(); |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
############################################################################### |
|
68
|
|
|
|
|
|
|
# |
|
69
|
|
|
|
|
|
|
# get_fields - get all the fields in the config file |
|
70
|
|
|
|
|
|
|
# |
|
71
|
|
|
|
|
|
|
############################################################################### |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub get_fields { |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
|
|
0
|
1
|
|
my ($this, $config_string) = @_; |
|
76
|
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
my @fields; |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
foreach my $line (split(/\n/, $config_string)) { |
|
80
|
|
|
|
|
|
|
|
|
81
|
0
|
0
|
|
|
|
|
next if $line =~ /^\#/; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# strip any trailing comment |
|
84
|
0
|
|
|
|
|
|
$line =~ s/\#.*//; |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
# strip trailing space |
|
87
|
0
|
|
|
|
|
|
$line =~ s/\s+$//; |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
# strip leading space |
|
90
|
0
|
|
|
|
|
|
$line =~ s/^\s+//; |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# match a field |
|
93
|
0
|
0
|
|
|
|
|
if ($line =~ /^(.*?)\=/) { |
|
94
|
|
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
my $field = $1; |
|
96
|
0
|
|
|
|
|
|
$field =~ s/\s+$//; |
|
97
|
0
|
|
|
|
|
|
$field =~ s/^\s+//; |
|
98
|
0
|
|
|
|
|
|
push(@fields, $field); |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
} |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
return Goo::List::get_unique(@fields); |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
} |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
1; |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
__END__ |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 NAME |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Goo::Thing::conf::ConfigProfiler - Profile a config file |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
use Goo::Thing::conf::ConfigProfiler; |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 METHODS |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=over |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item run |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
display a profile of an xml thing |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item get_fields |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
get all the fields in the config file |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=back |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head1 AUTHOR |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Nigel Hamilton <nigel@turbo10.com> |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
145
|
|
|
|
|
|
|
|