Hub::Console::Output - Utility methods console output


hub-standard documentation  | view source Contained in the hub-standard distribution.

Index


NAME

Top

Hub::Console::Output - Utility methods console output

SYNOPSIS

Top



  use Hub qw(:standard);







DESCRIPTION

Top

Intention

PUBLIC METHODS

Top

fw

fixed-width (default padding is a space)

Warning, many calls to this method is a performance hit!

usage examples:



  Hub::fw( 5, "Hello World" )                  "Hello"
  Hub::fw( 5, "Hello World", '-clip=0' )       "Hello world"
  Hub::fw( 5, "Hi" )                           "Hi   "
  Hub::fw( 5, "Hi", '-align=r' )               "   Hi"
  Hub::fw( 5, "Hi", '-align=l' )               "Hi   "
  Hub::fw( 5, "Hi", '-align=c' )               "  Hi "
  Hub::fw( 5, "Hi", '-repeat' )                "HHHHH"
  Hub::fw( 5, "Hi", '-pad=x' )                 "Hixxx"
  Hub::fw( 5, "Hi", '-pad=x', '-align=r' )     "xxxHi"




  Depricated:




  Hub::fw( 5, "Hi", "right" )                  "   Hi"
  Hub::fw( 5, "Hi", "repeat" )                 "HHHHH"
  Hub::fw( 5, "Hi", "padding:x" )              "Hixxx"
  Hub::fw( 5, "Hi", "padding:x", "right" )     "xxxHi"










ps

 Usage: ps




Aka: Proportional Space

Split the given string up into multiple lines which will not exceed the specified character width.

Default padding is a space.

Example: (matches)

    ps( 10, "this is really short but splits on ten chars" );










    this is re
    ally short
 but split
    s on ten c
    hars

Example: (matches)

    ps( 10, "this is really short but splits on ten chars", 3 );










    this is re
   ally short
    but split
   s on ten c
   hars

Example: (matches)

    ps( 10, "this  is really short but splits on ten chars", -keepwords );







    this  is 
    really 
    short but 
    splits on 
    ten 




fcols

 Usage: fcols STRING, COLS, [OPTIONS]

Divide text into fixed-width columns.

Where OPTIONS can be:



  --split:REGEX                   # Split on regex REGEX (default '\s')
  --flow:ttb|ltr                  # Top-to-bottom or Left-to-right (default 'ttb')
  --pad:NUM                       # Spacing between columns (default 1)
  --padwith:STR                   # Pad with STR (multiplied by --pad)
  --width:NUM                     # Force column width (--pad becomes irrelevant)
  --justify:left|center|right     # Justify within column




Examples:

  1) print fcols( "A B C D E F G", 4, "-flow=ttb" ), "\n";




      A C E G
      B D F




  2) print fcols( "a b c d e f g", 4, "-flow=ltr" ), "\n";




      a b c d
      e f g










indenttext

Indent text


 Usage: indenttext $count, $text, [options]




options:



  -skip_first=1       Do not indent the first line
  -pad=CHAR           Use this padding character for indenting

Example: (matches)

    indenttext(4,"Hello\nWorld")




    Hello
    World




AUTHOR

Top

Ryan Gies (ryangies@livesite.net)

COPYRIGHT

Top

UPDATED

Top

08/02/2007


hub-standard documentation  | view source Contained in the hub-standard distribution.