NAME
String::Truncate - a module for when strings are too long to be displayed in...
VERSION
version 0.01
SYNOPSIS
This module handles the simple but common problem of long strings and finite terminal width. It can convert:
"this is your brain" -> "this is your ..."
or "...is your brain"
or "this is... brain"
It's simple:
use String::Truncate qw(elide);
my $brain = "this is your brain";
elide($brain, 16); # first option
elide($brain, 16, { truncate => 'left' }); # second option
elide($brain, 16, { truncate => 'middle' }); # third option
FUNCTIONS
elide($string, $length, \%arg)
This function returns the string, if it is less than or equal to $length
characters long. If it is longer, it truncates the string and marks the elision.
Valid arguments are:
elide - elide at left, right, or middle? (default: right)
marker - how to mark the elision (default: ...)
trunc($string, $length, \%arg)
This acts just like elide
, but assumes an empty marker, so it actually truncates the string normally.
AUTHOR
Ricardo Signes, <rjbs at cpan.org>
BUGS
Please report any bugs or feature requests to bug-string-truncate@rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=String-Truncate. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2005 Ricardo Signes, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.