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

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.
    • Never saw that module before. I don't understand why it requires that I pass in the width when the calculation is trivial. Sometimes module interfaces mystify me.

  • I wrote Text::TabularDisplay [] to do exactly that.
    • Well, Text::SimpleTable is clearly more Table 2.0, what with the rounded corners and everything.

      • Well, Text::SimpleTable is clearly more Table 2.0, what with the rounded corners and everything.
        And it's from 2005, too -- well ahead of its time. It looks pretty similar to Text::TabularDisplay, otherwise. I was specifically going for the mysql client look, as part of a similar command line client for $WORK, when I wrote it, so I don't think the rounded corners occurred to me at the time.
  • Have fun reading the docs to figure that out :)

    I'm skeptical. I admit to having ever used Text::Table before, but not much, and it didn't take more than a glance at the docs to figure out how to do what you want:

    my $t = Text::Table->new(\'| ', 'Time', \' | ', 'Text', \' |');
    $t->load(... some data ...);
    my $rule = $t->rule(qw(- +));
    print $rule, $t->head, $rule, $t->body, $rule;

    I'm not claiming to be overly fond of the interface -- any time I have to do \'foo' it trips my fingers up -- but I've read documentation that's far worse

  • All these table formatters. I never knew. I just use the 'format' built-in.

    man perlform

    Perhaps I should investigate them, because I don't know how to write argument lines to 'format' that match the number of values in an array. The number of values is variable. The argument lines are fixed.

    Perhaps I should declare different formats for each of the possible number of values, because I have only a small number of different possible numbers of values.

  • My module Text::FormatTable (rather old and not really actively developed) can do word-wrapping and outputs tables like this:

         a| b     c
    this a| oh,   yep
    test,| cool,
    a nice| a
      test| test!
       you| yes,  z
      mean| it
      it's| is.