| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "Text::Tabs 3perl" |
| 58 |
.TH Text::Tabs 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
Text::Tabs \- expand and unexpand tabs like unix expand(1) and unexpand(1) |
| 65 |
.SH SYNOPSIS |
| 66 |
.IX Header "SYNOPSIS" |
| 67 |
.Vb 1 |
| 68 |
\& use Text::Tabs; |
| 69 |
\& |
| 70 |
\& $tabstop = 4; # default = 8 |
| 71 |
\& @lines_without_tabs = expand(@lines_with_tabs); |
| 72 |
\& @lines_with_tabs = unexpand(@lines_without_tabs); |
| 73 |
.Ve |
| 74 |
.SH DESCRIPTION |
| 75 |
.IX Header "DESCRIPTION" |
| 76 |
Text::Tabs does most of what the unix utilities \fBexpand\fR\|(1) and \fBunexpand\fR\|(1) |
| 77 |
do. Given a line with tabs in it, \f(CW\*(C`expand\*(C'\fR replaces those tabs with |
| 78 |
the appropriate number of spaces. Given a line with or without tabs in |
| 79 |
it, \f(CW\*(C`unexpand\*(C'\fR adds tabs when it can save bytes by doing so, |
| 80 |
like the \f(CW\*(C`unexpand \-a\*(C'\fR command. |
| 81 |
.PP |
| 82 |
Unlike the old unix utilities, this module correctly accounts for |
| 83 |
any Unicode combining characters (such as diacriticals) that may occur |
| 84 |
in each line for both expansion and unexpansion. These are overstrike |
| 85 |
characters that do not increment the logical position. Make sure |
| 86 |
you have the appropriate Unicode settings enabled. |
| 87 |
.SH EXPORTS |
| 88 |
.IX Header "EXPORTS" |
| 89 |
The following are exported: |
| 90 |
.IP expand 4 |
| 91 |
.IX Item "expand" |
| 92 |
.PD 0 |
| 93 |
.IP unexpand 4 |
| 94 |
.IX Item "unexpand" |
| 95 |
.ie n .IP $tabstop 4 |
| 96 |
.el .IP \f(CW$tabstop\fR 4 |
| 97 |
.IX Item "$tabstop" |
| 98 |
.PD |
| 99 |
The \f(CW$tabstop\fR variable controls how many column positions apart each |
| 100 |
tabstop is. The default is 8. |
| 101 |
.Sp |
| 102 |
Please note that \f(CWlocal($tabstop)\fR doesn't do the right thing and if you want |
| 103 |
to use \f(CW\*(C`local\*(C'\fR to override \f(CW$tabstop\fR, you need to use |
| 104 |
\&\f(CWlocal($Text::Tabs::tabstop)\fR. |
| 105 |
.SH EXAMPLE |
| 106 |
.IX Header "EXAMPLE" |
| 107 |
.Vb 3 |
| 108 |
\& #!perl |
| 109 |
\& # unexpand \-a |
| 110 |
\& use Text::Tabs; |
| 111 |
\& |
| 112 |
\& while (<>) { |
| 113 |
\& print unexpand $_; |
| 114 |
\& } |
| 115 |
.Ve |
| 116 |
.PP |
| 117 |
Instead of the shell's \f(CW\*(C`expand\*(C'\fR command, use: |
| 118 |
.PP |
| 119 |
.Vb 1 |
| 120 |
\& perl \-MText::Tabs \-n \-e \*(Aqprint expand $_\*(Aq |
| 121 |
.Ve |
| 122 |
.PP |
| 123 |
Instead of the shell's \f(CW\*(C`unexpand \-a\*(C'\fR command, use: |
| 124 |
.PP |
| 125 |
.Vb 1 |
| 126 |
\& perl \-MText::Tabs \-n \-e \*(Aqprint unexpand $_\*(Aq |
| 127 |
.Ve |
| 128 |
.SH BUGS |
| 129 |
.IX Header "BUGS" |
| 130 |
Text::Tabs handles only tabs (\f(CW"\et"\fR) and combining characters (\f(CW\*(C`/\epM/\*(C'\fR). It doesn't |
| 131 |
count backwards for backspaces (\f(CW"\et"\fR), omit other non-printing control characters (\f(CW\*(C`/\epC/\*(C'\fR), |
| 132 |
or otherwise deal with any other zero\-, half\-, and full-width characters. |
| 133 |
.SH LICENSE |
| 134 |
.IX Header "LICENSE" |
| 135 |
Copyright (C) 1996\-2002,2005,2006 David Muir Sharnoff. |
| 136 |
Copyright (C) 2005 Aristotle Pagaltzis |
| 137 |
Copyright (C) 2012\-2013 Google, Inc. |
| 138 |
This module may be modified, used, copied, and redistributed at your own risk. |
| 139 |
Although allowed by the preceding license, please do not publicly |
| 140 |
redistribute modified versions of this code with the name "Text::Tabs" |
| 141 |
unless it passes the unmodified Text::Tabs test suite. |