Test::Tabs(3pm)
β¨ Test::Tabs β¨
okay bestie, so this is Test::Tabs (a Test:: module, iykyk) and its whole entire job is checking for tabs in your project. not even joking. it's giving "whitespace hall monitor" and honestly? she ate π
πΈ SYNOPSIS πΈ
like, you can do the one-file vibe:
use Test::Tabs tests => 1;
tabs_ok('lib/Module.pm', 'Module is indented sanely');
orrrr:
use Test::Tabs;
all_perl_files_ok();
orrrr if you're feeling extra and wanna point at your own dirs:
use Test::Tabs;
all_perl_files_ok( @mydirs );
β¨ DESCRIPTION β¨
so what this module does is it goes through your whole project/distribution and scans every perl file it can find (scripts, modules, etc, all of them) looking for tabs. she's thorough, no cap.
specifically, here's the vibe check it runs π
- all indentation has to be done with tabs, never spaces
- alignment has to be done with spaces, never tabs
- indentation levels can never jump up β like, going from 1 tab indent straight to 3 tab indent without an intervening 2 tab indent? absolutely not, that's a red flag π©
- no trailing whitespace on any line (though a line is allowed to be entirely whitespace, that's fine, we're not monsters)
Comment lines and pod? ignored. completely. not our problem. (tho the docs do say a future version may also ignore heredocs β so maybe one day, bestie, maybe one day π)
now, the escape hatches, and there's three of them so listen up:
- a trailing comment
##WSlets you ignore all the whitespace rules for that one line π ## no Test::Tabsstarts ignoring the whitespace rules for all the following lines, and keeps doing that until it sees## use Test::Tabs## skip Test::Tabstells Test::Tabs to skip the current file entirely β but there's a catch, it has to be used before the first whitespace rule violation, otherwise it's too late and she's already clocked you π
π Functions π
all_perl_files_ok( @directories )β runstabs_ok()on literally every perl file it finds in@directories, recursively, down the whole tree. if you don't pass any@directoriesat all, the starting point defaults to one level above the current running script, which should cover all the files of a typical CPAN distribution. and what counts as a perl file, you ask? a*.pl, a*.pm, a*.psgi, a*.t, or any file whose first line starts with"#!...perl". that's the whole list, periodt.tabs_ok( $file, $text )β runs a tab check on$file. here's the cute part: for a module you can pass in either the path (lib/My/Module.pm) or the package name (My::Module), your choice, both work π«Ά.$textis the optional test name, if you wanna be descriptive about it.
π¦ BUGS π¦
found a bug? please report it, bestie, don't just sit on it:
<http://rt.cpan.org/Dist/Display.html?Queue=Test-Tabs>
β SEE ALSO β
Test::EOL, Test::More.
go read those too, they're in the same friend group π
π AUTHOR π
Toby Inkster <tobyink@cpan.org>.
and huge shoutout: large portions stolen from Test::NoTabs by Nick Gerakines. iconic behavior, we respect it π
π COPYRIGHT AND LICENCE π
This software is copyright (c) 2012-2013 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
π DISCLAIMER OF WARRANTIES π
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
and that's the whole page, bestie!! this one's from perl v5.40.1, dated 2025-08-14 β go forth and check those tabs, ily, mwah πβ¨
π¦ where this page comes from
- ubuntu resolute: libtest-tabs-perl 0.005-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtest-tabs-perl 0.005-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms