Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

hi,

is there a easy way to draw table in Perl? There is GD which can be used to draw lines but i am wondering if there is anything more useful exist already?

the table will be placed below the chart ( i have nailed this part using the wonderful Chart module) to show more chart data detail as we often seen in excel.

thanks.

Replies are listed 'Best First'.
Re: draw table ?
by Joost (Canon) on Jul 18, 2007 at 22:37 UTC
Re: draw table ?
by GrandFather (Saint) on Jul 18, 2007 at 21:18 UTC

    In what context? HTML handles tables pretty well, but I'm sure that's not what you want. Are you using a GUI? Do you want to generate an image file? Do you want to print it? What form is that data in that you want to populate the table with? Have you look in CPAN?


    DWIM is Perl's answer to Gödel
      i thought mentioning GD already implied that i want to generate image. sorry being unclear to you. this is for reporting that will be shown online. since i am already generating the chart image and i would like to have the chart data also generated right below it.

      i have searched CPAN and nothing turned out yet.

        Just because you are using GD to generate an image for the chart doesn't mean that you need to generate the table as an image.

        If by "online" you mean on a web page then an HTML table is what you want to create and there are a pile of modules for that on CPAN (HTML::Table and HTML::QuickTable for example).

        If you mean in the context of a GUI then again generating the table as an image is probably not what you want and the tools available depend a great deal on the GUI you are using. If you were using Tk for example you may find Tk::Table does the trick (although it actually manages a table of widgets so there is some work to be done!).

        Otherwise the only module I could find that seems to come close is PostScript::Simple::Table, but that's a bit indirect!


        DWIM is Perl's answer to Gödel
        For me "reporting online" implies a greater audience. Have you thought about the readability of that table? HTML, Postscript, PDF allow rescaling text for better readability if the reader is so inclined. Rescaling an image (raster graphic) won't get you a table that's more readable.