469,898 Members | 1,574 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Code rot?

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:

class: mic_if_win,
label: "!AACE.*",
mic_if_handles_windows: 1
rtree_state: close,
ltree_state: close
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>) {
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.)
Jul 19 '05 #1
1 1770
This issue was solved with the help of people on the Cygwin mailing
list. Basically I needed to set the environment variable

export PERLIO=crlf

and this makes everything OK. The source file is a Windows CRLF file,
and Cygwin expects text to be in UN*X LF format...
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

51 posts views Thread by Mudge | last post: by
9 posts views Thread by bigoxygen | last post: by
4 posts views Thread by jason | last post: by
16 posts views Thread by Dario de Judicibus | last post: by
109 posts views Thread by Andrew Thompson | last post: by
18 posts views Thread by Joe Fallon | last post: by
171 posts views Thread by tshad | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.