Converting Perl scripts to Ruby?

If only there were…

Such a beast would be incredibly difficult to write. The problem with
writing something to convert Perl to Ruby would not only be the difficulty
of parsing, but also the paradigm shift that occurs when moving from Perl to
Ruby. In other words, you could convert from a functional style to a
functional style, but it would be difficult to convert it to an OO paradigm.

This is not to minimize the problems with parsing. Can you imagine trying
to parse an convert some of the more obfuscated code? Yikes!

As it stands, if you know Perl and have a decent handle on Ruby it’s not
that difficult to ‘translate’ the syntax. For the most part, the functions
in Perl are class or instance methods in Ruby (there are a few exceptions).
To give you an idea, it took me less than a day (and probably only about 2
hours) to convert version .11 of John McNamara’s Spreadsheet::WriteExcel
module into a working Ruby version.

Just my .02

Regards,

Dan

···

-----Original Message-----
From: Giuseppe Bilotta [mailto:bilotta78@hotpop.com]

Is there some (semi)automatic way to attempt such a thing? Or does it
have sense at all?

Berger, Daniel wrote:

Such a beast would be incredibly difficult to write. The problem with
writing something to convert Perl to Ruby would not only be the difficulty
of parsing, but also the paradigm shift that occurs when moving from Perl to
Ruby. In other words, you could convert from a functional style to a
functional style, but it would be difficult to convert it to an OO paradigm.

This is not to minimize the problems with parsing. Can you imagine trying
to parse an convert some of the more obfuscated code? Yikes!

As it stands, if you know Perl and have a decent handle on Ruby it’s not
that difficult to ‘translate’ the syntax. For the most part, the functions
in Perl are class or instance methods in Ruby (there are a few exceptions).
To give you an idea, it took me less than a day (and probably only about 2
hours) to convert version .11 of John McNamara’s Spreadsheet::WriteExcel
module into a working Ruby version.

I see, thank you. Guess abusing Ruby’s OO paradigm to bend it to
quasi-functional writing wouldn’t help either, uh?

···


Giuseppe “Oblomov” Bilotta

Axiom I of the Giuseppe Bilotta
theory of IT:
Anything is better than MS