Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robrwo/text-truncate
Perl module for truncating text strings.
https://github.com/robrwo/text-truncate
Last synced: 11 days ago
JSON representation
Perl module for truncating text strings.
- Host: GitHub
- URL: https://github.com/robrwo/text-truncate
- Owner: robrwo
- Created: 2011-06-19T20:35:14.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-06-19T20:35:33.000Z (over 13 years ago)
- Last Synced: 2024-10-11T21:56:34.404Z (about 1 month ago)
- Language: Perl
- Homepage:
- Size: 93.8 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
- Changelog: Changes
Awesome Lists containing this project
README
NAME
Text::Truncate - Perl module with simple string truncating routineREQUIREMENTS
This module only uses standard modules. It should run on Perl 5.004.INSTALLATION
Installation is pretty standard:perl Makefile.PL
make test
make install(On Windows platforms you should use nmake instead.)
Using Build.PL (if you have Module::Build installed):
perl Build.PL
perl Build test
perl Build installSYNOPSIS
use Text::Truncate;my $long_string = "This is a very long string";
# outputs "This is..."
print truncstr( $long_string, 10);# outputs "This is a-"
print truncstr( $long_string, 10, "-");# outputs "This is a "
print truncstr( $long_string, 10, "");# outputs "This is---"
$Text::Truncate::DEFAULT_MARKER = "---";
print truncstr( $long_string, 10);DESCRIPTION
This is a simple, no-brainer subroutine to truncate a string and add an
optional cutoff marker (defaults to ``...'').(Yes, this is a really brain-dead sort of thing to make a module out of,
but then again, I use it so often that it might as well be in a module.)The synopsis gives examples of how to use it.
REVISION HISTORY
The following changes have been made since the previous release:1.03 Sun Jun 26 2005
- README generated from Pod::Readme
- minor updates to POD
- uses Test::Pod::Coverage instead
(thanks to Richard Clamp for pointing this out)See the Changes file for a detailed revision history.
AUTHOR
Robert RothenbergLICENSE
This module is in the public domain. No copyright is claimed.