Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Text Columns

by clscott (Friar)
on Nov 28, 2006 at 21:35 UTC ( [id://586574]=note: print w/replies, xml ) Need Help??


in reply to Text Columns

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^2: Text Columns
by Tanktalus (Canon) on Nov 28, 2006 at 21:50 UTC

    "Dude," that's not even close to the question. The format function only sets up static format. If you don't know the sizes of your columns ahead of time, you're (mostly) stuck. Even perl6's formats are still largely stuck in the same mindset, despite being much more flexible. The OP is asking if there is anything out there that will determine how many columns are needed, and automagically set up a nice table. See the 'ls' command on unix for an example. Even 'dir' on Windows, with the /w flag, is close.

    For the most part, I've just made do with Text::Table. But it is an interesting problem. I would actually try using Text::Table, feeding it the screen width (which you can get with Term::Screen), and just keep adding columns until things don't fit. But that would definitely be slower than a more direct approach.

    If the OP is really interested, you might be able to find the source to the ls command and reimplement that algorithm in Perl. The implementation side probably will be easier in perl than C, it'll be the deciphering of the ls code that will be the hard part ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://586574]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-03-28 22:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found