<br><div class="gmail_quote">On Sun, Jul 24, 2011 at 2:29 AM, Shashwat Anand <span dir="ltr"><<a href="mailto:anand.shashwat@gmail.com">anand.shashwat@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I am working with a huge codebase of Perl.<div>The code have zero documentation and zero unit-tests.</div><div>It seems like a huge hack.</div></blockquote><div><br>My condolences.  Er, actually, it sounds kind of fun.<br>
<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>The underlying database schema is horrid.</div><div>So I want to rewrite the whole of it in Python.</div>
</blockquote><div><br>Good choice.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div>How do I start ?</div></blockquote><div><br>You're probably going to need to learn a lot about the perl code - it's probably a good idea to come up with unit, integration and system tests for it - in perl; document it; and diagram it using something like autodia.<br>
<br>Then after you know what's going on inside and outside the perl, you're better equipped to rewrite into python.<br><br>If you write your automated perl tests in a straightforward way, they can be mostly straightforwardly translated to python - to get an apples to apples comparison of how each is functioning.<br>
<br>If you do this module by module, you're less likely to run into problems, but you're also more likely to preserve some of the original code's oddities.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>The idea is to rewrite module by module.<br></div></blockquote><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>But how to make sure code doesn't break ?</div>
</blockquote><div><br>See above.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div>How can I import perl and python codes in each other ?</div>
</blockquote><div><br>I'm not confident you can, unless perhaps you find that you can use an alternative VM like Parrot.  However, many languages on Parrot are not complete.<br><br></div></div>