NAME String::Elide::Tiny - A very simple text truncating function, elide() VERSION This document describes version 0.003 of String::Elide::Tiny (from Perl distribution String-Elide-Tiny), released on 2023-08-08. SYNOPSIS use String::Elide::Tiny qw(elide); # ruler: 0----5---10---15---20 my $text = "this is your brain"; elide($text, 16); # -> "this is your ..." elide($text, 14); # -> "this is yo ..." # marker option: elide($text, 14, {marker=>"xxx"}); # -> "this is youxxx" # truncate option: elide($text, 14, {truncate=>"left"}); # -> "... your brain" elide($text, 14, {truncate=>"middle"}); # -> "this ... brain" elide($text, 14, {truncate=>"ends"}); # -> "...is your ..." DESCRIPTION This module offers "elide"() function that is very simple; it's not word-aware. It has options to choose marker or to select side(s) to truncate. FUNCTIONS elide Usage: my $truncated = elide($str, $max_len [ , \%opts ]) Elide a string with " ..." if length exceeds $max_len. Known options: * truncate String, either "right", "left", "middle", "ends". * marker String. Default: "...". HOMEPAGE Please visit the project's homepage at . SOURCE Source repository is at . SEE ALSO Text::Elide is also quite simple and elides at word boundaries, but it's not tiny enough. Text::Truncate is tiny enough, but does not support truncating at the left/both ends. String::Elide::Parts can elide at different points of the string. String::Truncate has similar interface like String::Elide::Parts and has some options. But it's not tiny: it has a couple of non-core dependencies. String::Elide::Lines is based on this module but works on a line-basis. AUTHOR perlancar CONTRIBUTING To contribute, you can send patches by email/via RT, or send pull requests on GitHub. Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via: % prove -l If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me. COPYRIGHT AND LICENSE This software is copyright (c) 2023, 2019 by perlancar . This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. BUGS Please report any bugs or feature requests on the bugtracker website When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.