[VPM] Text::Table success

Carl B. Constantine cconstan at csc.UVic.CA
Tue Apr 1 12:48:36 CST 2003


Well, I've been playing around with the Text::Table class and have
had great success with it. I now have it producing the same tables that
I was printing out line by line and doing a whack of length checking in
my ugly code. Now the Table class handles all that for me and produces
some nice tables.

wrt the variable formatting I posted here before, scanf seems to be the
best solution for the one column in the table that I need it:

push @line, scanf "\$%5.2f", $amount

which when the table is printed, it looks like this:

Page Rate ==> (0.07)  (0.07)  (0.50)  Totals 
Student:      rp      rp-     rp-            
                      test    colour         
=============================================
     student1       0     917       0 $ 64.19
     student2      66       0       0 $  4.62
     student3      14     391      19 $ 37.85
=============================================
  Total Cost: $  5.60 $ 91.56 $  9.50        

There are other cool things you can do with this table class as well,
such as dividers (|) and so forth. There are methods to get the height
and width of the table, printing the rules (=== in my case) and more.

Now, just to clean up the rest of my code ;-(

That's one thing I think would be good for me, as a relatively new perl
programmer, is to learn how to write better perl scripts, using my ugly
(more C-like) perl code as an example.

Since the April meeting is taken for a topic, How about May?

-- 
Carl B. Constantine         University of Victoria
Programmer Analyst          http://www.csc.uvic.ca
UNIX System Administrator   Victoria, BC, Canada
cconstan at csc.uvic.ca        ELW A220, 721-8753



More information about the Victoria-pm mailing list