I use array#pack to obfuscate some of my scripts. This last week, I had
a user in French Polynesia try to run the script and it would not load.
He got a compile error on the eval line of the script. He’s running the
French version of Windows.
I sent him a copy of the script without the packing and it worked fine.
The same packed script work perfect for me on both Windows (US version)
and on a Mac.
The specifics of the error are:
Error Loading File myscript.rb
(eval): 156: compile error
(eval): 40: syntax error
class MyChildClass < MyParentClass
^
(eval): 156: syntax error
The source script is 156 lines long, and the above statement is on line
40. There is a require statement two lines above. The packed version
of the script is longer (more lines).
I have a process I use to create the packed script. I read the script
in and preserve all my copyright, contact and comments at the top of the
script, These are either individual # comment lines or block comments
wrapped by =begin and =end. Everything else below that gets packed into
a eval() method.
(In other words, when you edit the script, you see human comments at the
top, and then you see the whole eval(…) expression.)
It would be easy to say that there’s an issue with the process I use to
create the packed version of the script, but it works here (on my US
version of Windows) and other users have not had any issues either -
just this ony guy. I had him send me his copy of the script, which he
did, and it worked perfect for me. This is with Ruby 1.8.0.
Any ideas?
Thanks, Todd