[prev in list] [next in list] [prev in thread] [next in thread]
List: ruby-talk
Subject: Re: Frozen string problem, but I haven't frozen anything?
From: Emmanuel Touzery <emmanuel.touzery () wanadoo ! fr>
Date: 2004-02-17 9:04:00
Message-ID: 4031D97D.4010309 () wanadoo ! fr
[Download RAW message or body]
LC Geldenhuys wrote:
>Hi,
>
>I am new to Ruby. I'm trying to get some Ruby scripts going to manage
>or CVS log message emails. (I haven't written them myself, got them
>from the web.)
>
>I get:
>/home/cvs/repository/CVSROOT/commitinfo.rb:26:in `tr_s!': can't modify
>frozen string (TypeError)
> from /home/cvs/repository/CVSROOT/commitinfo.rb:26
>
>I've done some reading, and I suspect I understand what the frozen
>string issue is about. The problem is, I don't see how/why this string
>is frozen? Here is the relevant code snippet:
>
>-----------------------------------
>if ARGV.size < 4
> puts "Usage: #{$0} CVSROOT USER modulepath file1 [file2...]"
> exit 1 # No way!
>end
>
>$cvsroot, $cvsuser, $modulepath, *$cvsfiles = *ARGV
>
>$cvsroot.tr_s!('/', '/')
>$modulepath.tr_s!('/', '/')
>-----------------------------------
>
>The two lines using 'tr_s!' causes the problem, but I don't see
>how/why $cvsroot or $modulepath is 'frozen'? Might it be due to the
>fact that they are passed to the script, i.e. some global/local scope
>issue?
>
>
you can't modify values in ARGV. you have to copy the values.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic