Dual-license your content for inclusion in The Perl 5 Wiki using this HOWTO, or join us for a chat on irc.freenode.net#PerlNet.


From PerlNet

Jump to: navigation, search

I'm Alec:

I like the O'Reilly Perl CD Bookshelf, Inline::Java, I hack Perl using Vim on Linux, sometimes I use the Eclipse IDE with the EPIC Eclipse Perl intergration. However I have found the debugger slow and the IDE does seem too complicated and bloated on occasions.

Alec 22:53, 30 Apr 2005 (EST)


Starting a new Perl project

Here is a new job.

My kid’s school distributes a list of students and 'phone numbers in each class so that parents and students can contact each other. The task has fallen to me again this year. Because of privacy issues we have forms from each parent (we hope) giving permission to publish their details.

I need to knock up a script that

  1. Sucks in the student data from an .xls file
  2. Sorts into class form order and then alpha order
  3. Presents a UI so that the user can tick off those users who have given permission
  4. Print a report, one page for each class form, with the details

I'll post my code here for entertainment purposes

==== Tools ====
CVS as source control ,even though I have access to much more sophisticated tools I can just hand the CVS repository over to anyone else. As I'm on Windows it's CVSNT.
Eclipse and EPIC as my development tools
This page for my notes etc.
LaTeX (MiKTeX) to format the output reports. Open to suggestions on alternatives here -- but it has to be high quality output.
==== Perl Features and Modules ====
Tk for the UI. I have fount this a very useful widget set, however the code you create always appears incredibly cryptic after you've finished and impossible to maintain :-(.
Perl hashs to hold the class data in memory. That was an approach that worked very well last year, even though the problem then was slightly different -- we had an historical database to merge
Normally I would expect to use a test::more suite (see the excellent introductory article by our own Leif Eriksen) -- however that does not seem appropriate here for a small standalone program with a GUI.

First Major issue

I now have some code that compiles and runs, but how the hell do you debug in perl/TK? -- all the real meat happens in callback functions which the debugger can't step into (maybe setting a breakpoint would work -- I'try that)

That works

In the Perl debugger say 'c nnn' where nnn is the line number you want to stop at. The debugger will stop, even if nnn is located in a Tk callback function.

Also try using ptksh for testing fragments of Perl and Perl/tk. Incidentally the ptksh perldoc mentions "enter ``O tk on debuggers command line to start the Tk eventloop". Not tried that yet...

Code has gone 'gold' Time to wrap up

Well code has been used to create the schools class lists so that's it for another year. I have quite a few problems with dirty data. A students class name (e.g. '4 Y') is used as hash key, inconsistant forms played havoc with the data. I had to write extra code to strip extraneous white space -- glad it was was Perl, real easy with regular expressions.

These problems got even worse when I tried to use the same fields to cross reference two lists. Now I discovered that the naming conventions has not been consistently followed. Now all fixed.

A third isse was the LaTeX output. I wanted to have something that would work the font size etc. having been given a page to print. Some classes did not fit on a single sheet and I had to provide special logic to change the font size in those cases. You can probably do it with LaTeX bit I did not have time.

Next year I should use TEXT::CSV

Except where otherwise indicated, I hereby license my textual contributions to PerlNet to be distributed under the same license as Perl 5 itself.

Personal tools