Modification of a read-only value attempted at /opt/rt3/bin/rt line 1155

$ perl -v

This is perl, v5.8.4 built for sun4-solaris-64

$ cat /etc/rt.conf
user jparsons

$ ./rt-3.2.0/bin/rt
Modification of a read-only value attempted at ./rt-3.2.0/bin/rt line
1155.

It seems that $_ is read-only within sub parse_config_file, and so
can’t be modified by ‘while ()’. This works for me:

— ./rt-3.2.0/bin/rt 2004-07-07 14:52:28.632210000 -0400
+++ /opt/rt3/bin/rt 2004-08-17 04:37:50.467497000 -0400
@@ -1148,22 +1148,22 @@

Makes a hash of the specified configuration file.

sub parse_config_file {

  • my %cfg;
  • my %cfg = ();
  • my $val;
    my ($file) = @_;
  • open(CFG, $file) && do {
  •    while (<CFG>) {
    
  •        chomp;
    
  •        next if (/^#/ || /^\s*$/);
    
  •        if (/^(user|passwd|server|query|orderby)\s+(.*)\s?$/) {
    
  •            $cfg{$1} = $2;
    
  •        }
    
  •        else {
    
  •            die "rt: $file:$.: unknown configuration directive.\n";
    
  •        }
    
  • open(CNF, $file) || return %cfg;
  • while ( $val = ) {
  •    chomp $val;
    
  •    next if ( $val =~ /^#/ || $val =~ /^\s*$/);
    
  •    if ( $val =~ /^(user|passwd|server|query|orderby)\s+(.*)\s?$/) 
    

{

  •        $cfg{$1} = $2;
    
  •    }
    
  •    else {
    
  •        die "rt: $file:$.: unknown configuration directive.\n";
        }
    
  • };
  • }

    return %cfg;
    }

Saffron Solutions, Inc. http://www.saffron.net
A customer-focused IT services company offering
computer system, network, and security consulting.