in reply to Re: Code rot?
in thread Code rot?

You betcha - 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.

Replies are listed 'Best First'.
Re3: Code rot?
by dragonchild (Archbishop) on Sep 22, 2003 at 20:01 UTC
    Hence, something changed. You need to tell us these things!

    There is no code that is guaranteed to work between Perl versions. You may have to tweak it a little. I would suggest using perl -MO=Deparse scriptname.pl to find out what it's doing. The problem isn't in the if-condition. It's earlier on, where $_ is set.

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

      FWIW, here's the whole beginning of my script:
      #!/usr/bin/perl -w use warnings; use CGI qw(:standard *table); # Location of screen/field description file $screenflddescpath = "descriptions.txt"; open SCREENFLDDESC, $screenflddescpath or die "cannot find screen description file: $!"; while (<SCREENFLDDESC>) { chomp; ($key, $desc) = split /,/; $screenflddesc{$key} = $desc; } close SCREENFLDDESC; # Location of index file we will write results to $indexfile = ">screenindex.html"; open INDEX, $indexfile or die "cannot open index for writing: $!"; # Location of master GUI file # $guipath = "Master.gui"; $guipath = "Master.gui.test"; open GUIFILE, $guipath or die "cannot find Master.gui: $!"; # Start our index file print INDEX start_html("GUI Map Index"), "\n"; print INDEX h1("GUI Map Index"), "\n"; print INDEX "Click on a screen name below to go to its description pag +e", br, "\n"; print INDEX hr, "\n"; # Flag to let us know if we're inside a description block $desc = 0; # Current file name $currfile = ""; while (<GUIFILE>) { chomp; # print "Line: $_\n"; # Outside description block with no ".": Screen name # (or quoted name without following ".") # (Regex was originally /^([^.]+):$/) if ($desc != 0 and /^(\w+):$/) { # this is where the warning is pr +inted print "Screen name: $1\n"; # etc...
      There's nothing fancy going on here. Regexes have not changed between 5.6.1 and 5.8.0. I'm not doing anything to $_ except a chomp. I ran the line you had above, and reported that the syntax is OK after printing the parsed version of my script (which didn't change the script noticeably). Does anybody know if Perl has somehow been broken on the new version of Cygwin? edit: Of course, I mean that the regex functions I'm using have not changed btwn 5.6.1 and 5.8.0 - I'm sure there have been other unrelated changes.
        Well, first off, I'm going to tell you to use strict. I noticed one place that makes maintenance hard (your dual use of $desc). Your code is almost strict as it is. Take the final step.

        Secondly, are you sure that your line actually has stuff in it? Uncomment the print and see if it complains about an undefined variable being used ...

        ------
        We are the carpenters and bricklayers of the Information Age.

        The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

        Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

        Please also post all the elsif() lines to that if(). I'd think there must be one, because there is no string concatanation in the if().

        BTW: Warnings in elsif() conditions are reported with the line number of the if(). Nice to know...