[Zope] Legacy Perl code and Zope. A pipe dream?

Jonathan dev101 at magma.ca
Tue Oct 3 14:05:50 EDT 2006


----- Original Message ----- 
From: "Derek Basch" <dbasch at yahoo.com>
To: "Jonathan" <dev101 at magma.ca>; <zope at zope.org>
Sent: Tuesday, October 03, 2006 1:54 PM
Subject: Re: [Zope] Legacy Perl code and Zope. A pipe dream?


> --- Jonathan <dev101 at magma.ca> wrote:
>
>>
>> ----- Original Message ----- 
>> From: "Derek Basch" <dbasch at yahoo.com>
>> To: "Lennart Regebro" <regebro at gmail.com>; <zope at zope.org>
>> Sent: Tuesday, October 03, 2006 1:25 PM
>> Subject: Re: [Zope] Legacy Perl code and Zope. A pipe dream?
>>
>>
>> > --- Lennart Regebro <regebro at gmail.com> wrote:
>> >
>> >> On 10/3/06, Derek Basch <dbasch at yahoo.com> wrote:
>> >> > I have about a million lines of Perl code/crap that I would like to
>> >> > refactor to Zope.
>> >> > Is this even possible?
>> >>
>> >> Refactor? No. But it's quite likely that you can redo it quite quickly
>> >> with Zope thanks to all the third-party products.
>> >>
>> >> What does you perl code/crap do? What type of site is it?
>> >
>> > Thanks for the responses everyone.
>> >
>> > Perhaps refactor wasn't the best choice of words. The site is a very 
>> > large
>> > online gaming website
>> > (not gambling). The legacy perl code does many, many things
>> > (administration, game play,
>> > accounting, message boards, publishing, mail, etc...) and really is 
>> > around
>> > a million lines.
>> > Rewriting the current perl code in python/zope would take a small 
>> > eternity
>> > even with the rapid
>> > development that zope permits.
>> >
>> > I saw that the zope-perl project is virtually dead and was hoping that
>> > some magical zope to perl
>> > bridge existed. Something that would allow me to use our existing perl
>> > code as an external method
>> > or someting similar. Forgive me if my zope terminology is a bit off as 
>> > I
>> > haven't worked with zope
>> > in about three years.
>> >
>> > As it stands it looks like I will need to use a PHP or Perl web
>> > application framework.
>> >
>> > PHP because it has decent Perl to PHP support:
>> >
>> > http://www.zend.com/php5/articles/php5-perl.php
>> >
>> > Or Perl, for obvious reasons. Perhaps something like Catalyst:
>> >
>> > http://www.catalystframework.org/
>> >
>> > However, neither of the above solutions is as enticing as the joy I am
>> > sure I would get from Zope.
>> > Which way should I go?
>>
>> It sounds like you already have a web application (in perl) up and 
>> running,
>> so what do you want Zope (or anything else) to accomplish for you?
>>
>>
>> Jonathan
>
> Yes, the application is currently deployed but it is the gnarliest mess of 
> ten year old spaghetti
> code you have ever seen. No session handling, no automatic CGI variable 
> parsing, no
> authentication....no fun. I am attempting to find a path towards a proper 
> web application
> framework without having to rewrite every single line of legacy code. For 
> example, all new
> projects would adhere to framework xyz and the legacy code would still 
> play nicely with the
> framework.

If you want to maintain this application within Zope then you will have to 
eventually rewrite the perl scripts into python.  However, as a first step, 
perhaps you could turn your perl scripts into standalone routines which can 
be invoked by a Zope External Method (use an 'os' call), and then 
communicate with the perl script via pipes or temporary files.

This should allow you to create an intial framework in Zope, but continue to 
use the business logic in the perl scripts.

This approach is based on the assumption that the perl scripts can be turned 
into 'functions' which take some input parameters, then apply some internal 
logic, and then return some value(s) which you then process/store in Zope.

I don't know if this approach will buy you anything or not... it all depends 
on how the perl routines are written and what they do.

It may be easier to rewrite the whole thing! The end result will probably be 
more maintainable and remember 1000 lines of Perl = 10 lines of python ;-) 
(ok, i may have exaggerated just a little...)


Jonathan




More information about the Zope mailing list