went to 5.8.1 and now my while statement fails

From: pui ming Wong (s11976_at_net2.hkbu.edu.hk)
Date: 11/27/03


Date: 27 Nov 2003 04:23:34 GMT

My script which worked under 5.6.1 failed after I upgraded
to 5.8

The loop codes that failed is as below:
The print count line statement never gets printed at all; why?
------------------------------------------------
 # read each message in turn

  while( $msg = &read_message ) {
    $count++;
 print "count line is $count";
      }
---------------------------------------------------
and its routine is:
-------------------------------------------------------
sub read_message
{
  local( $msg ) = ""; # message to send back
  local( $prev_blank ) = 1; # assume previous line blank
  local( $seen_from ) = 0; # seen a from line
  local( $line ) = ""; # current line

  # reset some globals
  $msg_status = "";
  $msg_subject = "";
  $msg_date = "";
 while( $line = &get_line ) {

    if( $line =~ /^From\s+([^\s]+)\s+(.*)$/ ) {
      # if previous line was blank, then legal from line
      if( $prev_blank ) {
        # if already seen a legal from line, then this is next message
 if( $seen_from ) {
   # pushback this from line
   $line_buffer = $line;
   return $msg;
 }
 $seen_from++;
        # From line found, extract information
        ( $msg_from, $msg_date ) = ( $1, $2 );
 $msg_stamp = &rctime( $msg_date );
        $msg_age = &days_old( $msg_stamp );
      }
    } elsif( $line =~ /^[Ss]tatus: ([A-Za-z]+)/ ) { ( $msg_status ) = ( $1 );
    } elsif( $line =~ /^[Ss]ubject: (.*)$/ ) { ( $msg_subject ) = ( $1 );
    }

    # set previous line
    if( $line =~ /^$/ ) {
      $prev_blank = 1;
    } else { $prev_blank = 0;
    }

    $msg .= $line;
  }

  return $msg;
}
-------------------------------------
BTW ,The perl routines required are:

require "getopts.pl"; # option handling
require "timelocal.pl"; # time conversion
require "ctime.pl"; # ctime for pseudo-mailing
require "stat.pl"; # file status

Any change to these after upgrade to 5.8 ?
that could be responsible for the failure of my old script?



Relevant Pages

  • automate dcpromo during nt4 pdc upgrade to W2k3 DC
    ... I am attempting to script the upgrade of a NT4 PDC to a W2K3 domain ... I have set the UnAttendMode to ... FullUnattended and the upgrade works perfectly up to the point where the ... @rem SetupMgrTag ...
    (microsoft.public.windows.server.migration)
  • Re: samba-common = 3.0.23d-4 but 3.0.24-2 is installed
    ... wants to upgrade to is 3.0.23d-4 which is lower. ... The problem is that the pre-removal script ... Reading package lists... ... warning - old pre-removal script returned error exit status 102 ...
    (Debian-User)
  • Re: FC2 upgrade-X problem
    ... Immideately after upgrade completed I ran 'yum update' ... > getting the X server to launch. ... I made up a test script that runs all the ... > longer able to run startx. ...
    (Fedora)
  • Re: Can someone help me write a "yes-man" program
    ... not work with the Ubuntu system upgrade script, ... which upgrade script you mean. ... from optparse import OptionParser ...
    (comp.lang.tcl)
  • Re: Some thoughts about Fedora Core 1 packages upgrade
    ... > upgrade hundreds of clients through Internet(big burden on Internet ... > building options, we have to download source RPMs as well, so there ... i'd recommend the apt-mirror script to be run once a day, ...
    (Fedora)