P
Peter M Aarestad
I tried posting this at PerlMonks.org, but didn't get very far...
So I wrote a Perl script about 5 months ago to parse a rather strange
text file. Here's a sample of the source file:
AACE_1:
{
class: mic_if_win,
label: "!AACE.*",
mic_if_handles_windows: 1
}
{
rtree_state: close,
ltree_state: close
}
AACE_1."ADDR LINE1":
{
class: field,
id: 734
}
etc. (For those who may recognize it, it's a GUI Map file used by
WinRunner, an automated testing suite.) Each header of a braced chunk
is either a screen (green-scren) name or field name - the field names
have the screen name they're on, followed by ".", followed by the
field name. I'm using the following code to parse the file:
while (<GUIFILE>) {
chomp;
if (!$desc and /^(\w+):$/) { # warnings here
# do stuff
} elsif (/^\{$/) {
# ...
} elsif (/^\}$/) {
# ...
} elsif (!$desc and /^"?$screen"?\.(.+):/) {
# ...
} elsif ($desc and /^\s*id:\s*(\d+)$/) {
# ...
} else {
# ...
}
}
This script worked fine 5 months ago, but now, for each and every line
of input, I get the warning:
Use of uninitialized value in concatenation (.) or string at
../genguimapdoc.pl line 52, <GUIFILE> line n.
and no output, as if every line is undefined (which I've been sure to
check that it's not by printing each line right before the if
statement). WTF? This script worked perfectly 5 months ago. The input
file has not changed, nor has the script. Is there something
fundamentally wrong with the regex?
(I'm currently using 5.8.0 for the latest Cygwin (1.5.5-cr-0x9b), and
back then I was using, if not 5.8.0, then 5.6.1, also for Cygwin.)
So I wrote a Perl script about 5 months ago to parse a rather strange
text file. Here's a sample of the source file:
AACE_1:
{
class: mic_if_win,
label: "!AACE.*",
mic_if_handles_windows: 1
}
{
rtree_state: close,
ltree_state: close
}
AACE_1."ADDR LINE1":
{
class: field,
id: 734
}
etc. (For those who may recognize it, it's a GUI Map file used by
WinRunner, an automated testing suite.) Each header of a braced chunk
is either a screen (green-scren) name or field name - the field names
have the screen name they're on, followed by ".", followed by the
field name. I'm using the following code to parse the file:
while (<GUIFILE>) {
chomp;
if (!$desc and /^(\w+):$/) { # warnings here
# do stuff
} elsif (/^\{$/) {
# ...
} elsif (/^\}$/) {
# ...
} elsif (!$desc and /^"?$screen"?\.(.+):/) {
# ...
} elsif ($desc and /^\s*id:\s*(\d+)$/) {
# ...
} else {
# ...
}
}
This script worked fine 5 months ago, but now, for each and every line
of input, I get the warning:
Use of uninitialized value in concatenation (.) or string at
../genguimapdoc.pl line 52, <GUIFILE> line n.
and no output, as if every line is undefined (which I've been sure to
check that it's not by printing each line right before the if
statement). WTF? This script worked perfectly 5 months ago. The input
file has not changed, nor has the script. Is there something
fundamentally wrong with the regex?
(I'm currently using 5.8.0 for the latest Cygwin (1.5.5-cr-0x9b), and
back then I was using, if not 5.8.0, then 5.6.1, also for Cygwin.)