Conf.pm at line 76

Joel Griffiths griff at aver-computer.com
Wed Apr 28 17:42:09 PDT 1999


 sub config {
  my($self,$file)=@_;
  my($dir)=$self->dir;
  my $fh = new IO::File "<$dir/$file" or return;
  if ( wantarray ) {
    map {
      /^(.*)$/ or die "Illegal line in $fh $dir/$file:\n$_\n";
      $1;
    } <$fh>;
  } else {
    <$fh> =~ /^(.*)$/ or die "Illegal line in $dir/$file:\n$_\n";
    $1;
  }
}  

It appears that the whole file is being read in as a single line with the
/^(.*)$/ command. I tried to change the /^(.*)$/ to /^(.*)$/m and it obviously
didn't work but then the the extra lines weren't even seen. I'm not much at
Perl so the problem could be something else. Could this be where the problem
is. I am running Perl 5.005_2 so I'm a thinking something changed in Perl that
broke this.

This is out of the manual.....

      By default, the "^" character is guaranteed to match at
       only the beginning of the string, the "$" character at
       only the end (or before the newline at the end) and Perl
       does certain optimizations with the assumption that the
       string contains only one line.  Embedded newlines will not
       be matched by "^" or "$".  You may, however, wish to treat
       a string as a multi-line buffer, such that the "^" will
       match after any newline within the string, and "$" will
       match before any newline.  At the cost of a little more
       overhead, you can do this by using the /m modifier on the
       pattern match operator.  (Older programs did this by
       setting $*, but this practice is now deprecated.)

If I am entirely off base, please be kind with the flaming. I have too much
email to sort through already.

-- Joel                                                
           



More information about the freeside-users mailing list