NAME
Hub::Console::Output - Utility methods console output
SYNOPSIS
use Hub qw(:standard);
DESCRIPTION
Intention
PUBLIC METHODS
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
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
Ryan Gies (ryangies@livesite.net)
COPYRIGHT
Copyright (C) 2006-2007 by Livesite Networks, LLC. All rights reserved.
Copyright (C) 2000-2005 by Ryan Gies. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
* Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
* The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
To the best of our knowledge, no patented algorithms have been used. However, we do not have the resources to carry out a patent search, and therefore cannot give any guarantee of the above statement.
UPDATED
06/09/2007