Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jonasbn (1153)

  reversethis-{gro.napc} {ta} {nbsanoj}
AOL IM: BJonasN (Add Buddy, Send Message)

Perl Programmer located in Copenhagen, Denmark. Active member of Copenhagen Perl Mongers.

Author of:

  • Business::DK::CPR
  • Business::DK::CVR
  • Business::DK::PO
  • Business::OnlinePayment::CashCow
  • Date::Holidays
  • Date::Holidays::Abstract
  • Date::Holidays::Super
  • Date::Pregnancy
  • Games::Bingo
  • Games::Bingo::Bot
  • Games::Bingo::Print
  • Module::Info::File
  • Module::Template::Setup
  • Test::Timer

and maintainer of:

  • Tie::Tools
  • XML::Conf
  • Workflow

Journal of jonasbn (1153)

Thursday December 19, 2002
04:40 PM

Other Peoples' Code

[ #9555 ]

Well I was so lucky to get a task of adding some functionality to a Perl script which had been developed by a consultant. I know I have written about this before (actually on the 11th. of october).

This time strict was enabled though - anyway I started with adding a -w to the she-bang line, warnings started to show up.

The developer seem to have been working with Perl 4, so I started to refactor the script to a more Perl 5-ish style (well just the perlstyle actually). After this I started refactoring seriously on the code, moving subs into a module, adding tests and eliminating overly use of the same strings and different variable for holding the same kinds of data ($mode and $status).

At the same time I started adding the new functionality, and all of a sudden I lost track, what was I doing... it was still compiling, but I was loosing focus.

Things where getting messy (I know this is not the purpose of refactoring), I had all of a sudden ruined quite a few of the APIs of the different subs. So I thought to myself, how can I ensure that I don't break everything - well in VB.NET all subs have signatures and ... hey thats it - Perl's prototypes

So I started looking into the Perl prototypes, I then added prototypes to all the subs and now when I compiled I was told when I had ruined some interface to a sub - phantastic.

Again I located something new (to me) in Perl and have learned something new. Now I know a little about prototypes in Perl and I have developed myself a new refactoring technique.

Out of chaos came order, and as I often have said before: learning another language gives perspective to your primary language (heh - I am no Mark Jason-Dominus).

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.