Re: Help needed on perl wrappers

From: R. Joseph Newton (rjnewton_at_efn.org)
Date: 12/11/03

  • Next message: Joel Newkirk: "Re: dbmopen problem"
    Date: Wed, 10 Dec 2003 17:53:56 -0800
    To: Pandey Rajeev-A19514 <rajeevpandey@motorola.com>
    
    

    Pandey Rajeev-A19514 wrote:

    > Hi,
    >
    > I was interested in formatted display on screen.
    >
    > I can display ONE text paragraph in any part of the screen with Text::wrap. My question was how to adjust MANY such independent paragraphs in one screen (exactly in a newspaper format where you have 8-10 columns of news items on a single page).
    >
    > I wanted to know is there something like Text::wrap which can do this. Or Text::wrap can handle only one paragraph. If nothing like that exists then I might have to give up Text::wrap and use my own logic to adjust it.
    >
    > Moreover, I also wanted to use Term::Size to adjust the text with changing screen size.
    >
    > Is there any convenient way to do this ? I was looking for readymade stuff.
    > Please suggest.
    >
    > Regards
    > Rajeev
    >
    > -----Original Message-----
    > From: Tom Kinzer [mailto:tomkinzer@earthlink.net]
    > Sent: Wednesday, December 10, 2003 12:05 PM
    > To: beginners@perl.org
    > Subject: RE: Help needed on perl wrappers
    >
    > I'm trying to figure out WHY you would ever want to create what you are
    > asking for. Why-- is a good question here, because there may be a way to
    > get to the real goal instead of creating this. For instance if it's just
    > going into an HTML document, a table of course, would be easier. Just an
    > example, so WHY are you wanting to do this?
    >
    > If this is really want you want, then: Do you really want a ragged left on
    > the right column? Do you really want to use tabs? I'm thinking spaces
    > would be easier to deal with for this problem and could buy you a justified
    > left margin on the right column.
    >
    > More info please.
    >
    > -Tom Kinzer
    >
    > -----Original Message-----
    > From: Pandey Rajeev-A19514 [mailto:rajeevpandey@motorola.com]
    > Sent: Tuesday, December 09, 2003 8:16 PM
    > To: 'beginners@perl.org'
    > Subject: Help needed on perl wrappers
    >
    > Hi,
    >
    > I have a text that I read from a file. I want to display the text on the
    > screen in a column in a newspaper style.
    > I do it like this....
    >
    > $initial_tab = "\t\t";
    > $subsequent_tab = "\t\t";
    > print wrap($initial_tab, $subsequent_tab, @text1);
    > print fill($initial_tab, $subsequent_tab, @text1);
    >
    > It will print like this ...
    > I am a boy and I go to school
    > everyday. I have to do a lot of
    > homework and I dont get time
    > to play these days.
    >
    > But if I have more than one independent text i.e. @text2, @text3 to be
    > displayed in different columns, then what shall i do.
    > I want something like this ...
    >
    > I am a boy and I go to school She is a girl and she
    > also goes
    > everyday. I have to do a lot of to school. I do all
    > her homework
    > homework and I dont get time and she gets plenty of
    > time to
    > to play these days play.
    >
    > Is there any mechanism to achieve this ?
    >
    > Best Regards
    > Rajeev

    Hi Rajeev,

    What you are asking for does seem a little bit funky. Please be aware that this type of formatting works only on even-width screens. Tabs are also very importable, since different applications may render them in different ways.

    That being said, I can see two routes:

    1. Perl does provide formats
    perldoc -f format
    that can help align your output for even-width renderings.

    2. Try the printf and sprintf functions. Once you get accustomed to the syntax [inherited from C] of their format strings and escapes, you may find them very handy. You can specify the width, alignment, and space or zero-padding, of you output
    very succinctly using these functions:
    perldoc -f printf
    perldoc -f sprintf

    Overall, I might recommend using or generating HTML for a job like this. This is the sort of work that markup was built for.

    Joseph


  • Next message: Joel Newkirk: "Re: dbmopen problem"

    Relevant Pages

    • Re: MS Outlook 2007 Contact Problem
      ... You specify the format for the Full Name field the same place you do for File As: ... Parse the elements yourself if you want them to display correctly. ... field without using the data entry dialogue box. ... I have no idea from the Help screens how to format the Full Name field. ...
      (microsoft.public.outlook.contacts)
    • Re: Tapble top fusion generator
      ... >increased my monitor format to 1280x1024 and display it on a Mitsubishi ... >using a screen format less than 1280x1024 and the low -resolution LCD ... >Since the poster writing about the character overlap, ... is, when you make one web site viewable, you can render others ...
      (sci.physics.fusion)
    • 2 Ques regarding dates (matching and subtracting)
      ... The end-user enters a date in cell a2, validated to format DD/MM/YYYY. ... In K30, I want to display the number of days until the end of the month, ... "Jacob" wrote: ... > I want to use a subtraction or matching formula. ...
      (microsoft.public.excel.misc)
    • Re: Dividing hours
      ... you can display these in a format that mimics time by making use of the ... The divisional manager will enter in the annual planned hrs on the ... worksheets Each workbook also has a calculation worksheet. ...
      (microsoft.public.excel.misc)
    • Re: Create Dynamic Controls and Displaying Page by Page on the for
      ... My computer is client and other is server. ... I want to display all recevied values for parameters ... > I'm saying this because dynamically creating a few thousand controls might ... >> row data format will be same. ...
      (microsoft.public.vsnet.general)