line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Package Definition |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Text::UberText::Log; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# Compiler Directives |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
15
|
|
|
1
|
|
|
|
|
33
|
|
12
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
64
|
|
|
1
|
|
|
|
|
31
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# |
15
|
|
|
|
|
|
|
# Includes |
16
|
|
|
|
|
|
|
# |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
2303
|
use Text::Wrap; |
|
1
|
|
|
|
|
4254
|
|
|
1
|
|
|
|
|
63
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# |
21
|
|
|
|
|
|
|
# Global Variables |
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
1
|
|
7
|
use vars qw/$VERSION /; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
523
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$VERSION=0.95; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$Text::Wrap::columns=72; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# |
31
|
|
|
|
|
|
|
# Methods |
32
|
|
|
|
|
|
|
# |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub new |
35
|
|
|
|
|
|
|
{ |
36
|
0
|
|
|
0
|
0
|
|
my ($class)=shift; |
37
|
0
|
|
|
|
|
|
my ($object); |
38
|
0
|
|
|
|
|
|
$object={}; |
39
|
0
|
|
|
|
|
|
bless ($object,$class); |
40
|
0
|
|
|
|
|
|
$object->_init(@_); |
41
|
0
|
|
|
|
|
|
return $object; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub write |
45
|
|
|
|
|
|
|
{ |
46
|
0
|
|
|
0
|
1
|
|
my ($self)=shift; |
47
|
0
|
0
|
|
|
|
|
if (@_) |
48
|
|
|
|
|
|
|
{ |
49
|
0
|
|
|
|
|
|
my ($module,$message,$line,$severity)=@_; |
50
|
0
|
|
|
|
|
|
$self->{log}->[$self->{last}]->{module}=$module; |
51
|
0
|
|
|
|
|
|
$self->{log}->[$self->{last}]->{message}=$message; |
52
|
0
|
|
|
|
|
|
$self->{log}->[$self->{last}]->{line}=$line; |
53
|
0
|
|
|
|
|
|
$self->{log}->[$self->{last}]->{severity}=$severity; |
54
|
0
|
|
|
|
|
|
$self->{last}++; |
55
|
|
|
|
|
|
|
} |
56
|
0
|
|
|
|
|
|
return; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub list |
60
|
|
|
|
|
|
|
{ |
61
|
0
|
|
|
0
|
1
|
|
my ($self)=shift; |
62
|
0
|
|
|
|
|
|
my ($fmt)="%s.%s: %s at line %d\n"; |
63
|
0
|
0
|
|
|
|
|
if (@{$self->{log}}) |
|
0
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
{ |
65
|
0
|
|
|
|
|
|
my ($entry); |
66
|
0
|
|
|
|
|
|
foreach $entry (@{$self->{log}}) |
|
0
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
{ |
68
|
0
|
|
|
|
|
|
printf($fmt,$entry->{module},$entry->{severity}, |
69
|
|
|
|
|
|
|
$entry->{message},$entry->{line}); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
0
|
|
|
|
|
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub report |
76
|
|
|
|
|
|
|
{ |
77
|
0
|
|
|
0
|
0
|
|
my ($self)=shift; |
78
|
0
|
0
|
|
|
|
|
if (@{$self->{log}}) |
|
0
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
{ |
80
|
0
|
|
|
|
|
|
my ($entry); |
81
|
0
|
|
|
|
|
|
print("\n"); |
82
|
0
|
|
|
|
|
|
foreach $entry (@{$self->{log}}) |
|
0
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
{ |
84
|
0
|
|
|
|
|
|
print($entry->{module}.":".$entry->{line},"\n"); |
85
|
0
|
|
|
|
|
|
print(wrap(" "," ", |
86
|
|
|
|
|
|
|
$entry->{severity}.":".$entry->{message}),"\n"); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
0
|
|
|
|
|
|
return; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# |
93
|
|
|
|
|
|
|
# Hidden Methods |
94
|
|
|
|
|
|
|
# |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub _init |
97
|
|
|
|
|
|
|
{ |
98
|
0
|
|
|
0
|
|
|
my ($self)=shift; |
99
|
0
|
|
|
|
|
|
$self->{log}=[]; |
100
|
0
|
|
|
|
|
|
$self->{last}=0; |
101
|
0
|
|
|
|
|
|
return; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# |
106
|
|
|
|
|
|
|
# Exit Block |
107
|
|
|
|
|
|
|
# |
108
|
|
|
|
|
|
|
1; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
# |
111
|
|
|
|
|
|
|
# POD Documentation |
112
|
|
|
|
|
|
|
# |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 NAME |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Text::UberText::Log - Record of UberText processing |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head1 SYNOPSIS |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
$uber=Text::UberText->new(); |
121
|
|
|
|
|
|
|
$log=$uber->log(); |
122
|
|
|
|
|
|
|
$log->write("Dispatch","Object load failure",,"ERROR"); |
123
|
|
|
|
|
|
|
$log->list(); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 DESCRIPTION |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Text::UberText::Log is used to debug the parsing of UberText documents. The |
128
|
|
|
|
|
|
|
Parser, the Dispatch table, and other modules record informational or warning |
129
|
|
|
|
|
|
|
messages to the log. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 OBJECT METHODS |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=over 4 |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item $log->write($module,$message,$linenumber,$severity) |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Writes a message to the log object. Module generically refers to which |
138
|
|
|
|
|
|
|
UberText module is reporting the error, but it can also be more generic or |
139
|
|
|
|
|
|
|
specific to suit the needs of the implementor. Message is a verbose |
140
|
|
|
|
|
|
|
description of the event. Linenumber indicates at what line of the document |
141
|
|
|
|
|
|
|
the error occured (if it occured during parsing). Severity refers to |
142
|
|
|
|
|
|
|
the level of importance of the message, and could be set to either "DEBUG", |
143
|
|
|
|
|
|
|
"INFO", or "ERROR". |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=item $log->list($severity) |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Lists all log messages matching the severity level specified, or lists all |
148
|
|
|
|
|
|
|
messages if no severity level is specified. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=back |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 BUGS/CAVEATS |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
This is the simplest module in the UberText distribution. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 AUTHOR |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Chris Josephes Ecpj1@visi.comE |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 SEE ALSO |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
L |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 COPYRIGHT |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Copyright 2002, Chris Josephes. All rights reserved. |
167
|
|
|
|
|
|
|
This module is free software. It may be used, redistributed, |
168
|
|
|
|
|
|
|
and/or modified under the same terms as Perl itself. |
169
|
|
|
|
|
|
|
~ |