On Nov 23, 2007 5:47 AM, Jeremy Mclain <gongchengshi / gmail.com> wrote: > I love the flexibility of writing scripts in Ruby but my work doesn't > allow me to install the Ruby interpreter on my system. Does anyone know > of any tools that will translate my Ruby scripts into Perl scripts? My > Ruby scripts aren't "Perlish" so it is not a trivial task to do it > manually. I know the frameworks are different and I can deal with that. > I mostly only care about the syntactic translation. Any suggestions? Actually, such a translator would have to be a full compiler, I think. I don't know any compiler for this, but if there are any specific constructs you are having problems with, I'd be willing to help you find a nice translation. The primary problems I immediately see for a compiler is the difference in true/false handling between Ruby and Perl, the integer overflow problem, issues with native types (scalars, hashes, arrays and code) not being objects, and the string/integer/float collapse that happen around this. I first thought that adding methods to objects etc would be a problem, but thinking about it for a second, I see that this is fairly simple to implement (on adding a method, you construct a new package that inherit from the one the object is presently in, use *THING syntax to add your method, add a DESTROY to get rid of the temporary package space when your object is GCed while also calling the old DESTROY if any). Of course, the syntax to do object magic in Perl is horrible, compared to Ruby. I've just not found much that isn't doable, if I dig into it and disregard that faint feeling of revulsion. Eivind.