Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Text::Padding(3)      User Contributed Perl Documentation     Text::Padding(3)

NAME
       Text::Padding - simple way of formatting	a text

VERSION
       version 1.110170

SYNOPSIS
	   my $pad = Text::Padding->new;
	   my $string	= 'foo bar baz';
	   my $left	= $pad->left  (	$string, 20 );
	   my $centered	= $pad->center(	$string, 20 );
	   my $right	= $pad->right (	$string, 20 );

DESCRIPTION
       This module provides a simple way to align a text on the	left, right or
       center. If left & right are easy	to achieve (see	"sprintf()"), i	found
       no cpan module that achieved a simple text centering. Well, of course,
       Perl6::Form provides it,	but it's incredibly slow during	startup	/
       destroy time. And Text::Reform was segfaulting during destroy time.

       Hence this module, which	aims to	provide	only those 3 methods.

ATTRIBUTES
   ellipsis
       When a string is	too long to fit	the wanted length, the methods are
       truncating it. To indicate that the string has been choped, the last
       character is replaced by	an ellipsis (\x{2026} by default). However,
       it's possible to	change this character by whatever ones wants: empty
       string to disable this behaviour, multi-char string is supported, etc.
       See Text::Truncate for more information.

METHODS
   center
	   my $centered	= $pad->center(	$str, $length );

       Return a	$length-long string where $str is centered, using white	spaces
       on left & right.	$str is	truncated if too long to fit (see the
       "ellipsis" attribute).

   left
	   my $left = $pad->left( $str,	$length	);

       Return a	$length-long string where $str is left-aligned,	right being
       padded with white spaces. $str is truncated if too long to fit (see the
       "ellipsis" attribute).

   right
	   my $right = $pad->right( $str, $length );

       Return a	$length-long string where $str is right-aligned, left being
       padded with white spaces. $str is truncated if too long to fit (see the
       "ellipsis" attribute).

SEE ALSO
       Text::Reform, Perl6::Form, Text::Truncate.

       You can also look for information on this module	at:

       o   AnnoCPAN: Annotated CPAN documentation

	   <http://annocpan.org/dist/Text-Padding>

       o   CPAN	Ratings

	   <http://cpanratings.perl.org/d/Text-Padding>

       o   Open	bugs

	   <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Text-Padding>

       o   Git repository

	   <http://github.com/jquelin/text-padding.git>.

AUTHOR
	 Jerome	Quelin

COPYRIGHT AND LICENSE
       This software is	copyright (c) 2011 by Jerome Quelin.

       This is free software; you can redistribute it and/or modify it under
       the same	terms as the Perl 5 programming	language system	itself.

perl v5.32.0			  2020-08-09		      Text::Padding(3)

NAME | VERSION | SYNOPSIS | DESCRIPTION | ATTRIBUTES | METHODS | SEE ALSO | AUTHOR | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Text::Padding&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help