.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Text::Tabs 3perl" .TH Text::Tabs 3perl 2023-11-30 "perl v5.38.2" "Perl Programmers Reference Guide" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Text::Tabs \- expand and unexpand tabs like unix expand(1) and unexpand(1) .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Text::Tabs; \& \& $tabstop = 4; # default = 8 \& @lines_without_tabs = expand(@lines_with_tabs); \& @lines_with_tabs = unexpand(@lines_without_tabs); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Text::Tabs does most of what the unix utilities \fBexpand\fR\|(1) and \fBunexpand\fR\|(1) do. Given a line with tabs in it, \f(CW\*(C`expand\*(C'\fR replaces those tabs with the appropriate number of spaces. Given a line with or without tabs in it, \f(CW\*(C`unexpand\*(C'\fR adds tabs when it can save bytes by doing so, like the \f(CW\*(C`unexpand \-a\*(C'\fR command. .PP Unlike the old unix utilities, this module correctly accounts for any Unicode combining characters (such as diacriticals) that may occur in each line for both expansion and unexpansion. These are overstrike characters that do not increment the logical position. Make sure you have the appropriate Unicode settings enabled. .SH EXPORTS .IX Header "EXPORTS" The following are exported: .IP expand 4 .IX Item "expand" .PD 0 .IP unexpand 4 .IX Item "unexpand" .ie n .IP $tabstop 4 .el .IP \f(CW$tabstop\fR 4 .IX Item "$tabstop" .PD The \f(CW$tabstop\fR variable controls how many column positions apart each tabstop is. The default is 8. .Sp Please note that \f(CWlocal($tabstop)\fR doesn't do the right thing and if you want to use \f(CW\*(C`local\*(C'\fR to override \f(CW$tabstop\fR, you need to use \&\f(CWlocal($Text::Tabs::tabstop)\fR. .SH EXAMPLE .IX Header "EXAMPLE" .Vb 3 \& #!perl \& # unexpand \-a \& use Text::Tabs; \& \& while (<>) { \& print unexpand $_; \& } .Ve .PP Instead of the shell's \f(CW\*(C`expand\*(C'\fR command, use: .PP .Vb 1 \& perl \-MText::Tabs \-n \-e \*(Aqprint expand $_\*(Aq .Ve .PP Instead of the shell's \f(CW\*(C`unexpand \-a\*(C'\fR command, use: .PP .Vb 1 \& perl \-MText::Tabs \-n \-e \*(Aqprint unexpand $_\*(Aq .Ve .SH BUGS .IX Header "BUGS" Text::Tabs handles only tabs (\f(CW"\et"\fR) and combining characters (\f(CW\*(C`/\epM/\*(C'\fR). It doesn't count backwards for backspaces (\f(CW"\et"\fR), omit other non-printing control characters (\f(CW\*(C`/\epC/\*(C'\fR), or otherwise deal with any other zero\-, half\-, and full-width characters. .SH LICENSE .IX Header "LICENSE" Copyright (C) 1996\-2002,2005,2006 David Muir Sharnoff. Copyright (C) 2005 Aristotle Pagaltzis Copyright (C) 2012\-2013 Google, Inc. This module may be modified, used, copied, and redistributed at your own risk. Although allowed by the preceding license, please do not publicly redistribute modified versions of this code with the name "Text::Tabs" unless it passes the unmodified Text::Tabs test suite.