1Test::EOL(3) User Contributed Perl Documentation Test::EOL(3)
2
3
4
6 Test::EOL - Check the correct line endings in your project
7
9 "Test::EOL" lets you check for the presence of trailing whitespace
10 and/or windows line endings in your perl code. It reports its results
11 in standard "Test::Simple" fashion:
12
13 use Test::EOL tests => 1;
14 eol_unix_ok( 'lib/Module.pm', 'Module is ^M free');
15
16 and to add checks for trailing whitespace:
17
18 use Test::EOL tests => 1;
19 eol_unix_ok( 'lib/Module.pm', 'Module is ^M and trailing whitespace free', { trailing_whitespace => 1 });
20
21 Module authors can include the following in a t/eol.t and have
22 "Test::EOL" automatically find and check all perl files in a module
23 distribution:
24
25 use Test::EOL;
26 all_perl_files_ok();
27
28 or
29
30 use Test::EOL;
31 all_perl_files_ok( @mydirs );
32
33 and if authors would like to check for trailing whitespace:
34
35 use Test::EOL;
36 all_perl_files_ok({ trailing_whitespace => 1 });
37
38 or
39
40 use Test::EOL;
41 all_perl_files_ok({ trailing_whitespace => 1 }, @mydirs );
42
44 This module scans your project/distribution for any perl files
45 (scripts, modules, etc) for the presence of windows line endings.
46
48 all_perl_files_ok
49 all_perl_files_ok( [ \%options ], [ @directories ] )
50
51 Applies "eol_unix_ok()" to all perl files found in @directories (and
52 sub directories). If no <@directories> is given, the starting point is
53 one level above the current running script, that should cover all the
54 files of a typical CPAN distribution. A perl file is *.pl or *.pm or
55 *.t or a file starting with "#!...perl"
56
57 Valid "\%options" currently are:
58
59 · trailing_whitespace
60
61 By default Test::EOL only looks for Windows (CR/LF) line-endings.
62 Set this to true to raise errors if any kind of trailing whitespace
63 is present in the file.
64
65 · all_reasons
66
67 Normally Test::EOL reports only the first error in every file
68 (given that a text file originated on Windows will fail every
69 single line). Set this a true value to register a test failure for
70 every line with an error.
71
72 If the test plan is defined:
73
74 use Test::EOL tests => 3;
75 all_perl_files_ok();
76
77 the total number of files tested must be specified.
78
79 eol_unix_ok
80 eol_unix_ok ( $file [, $text] [, \%options ] )
81
82 Run a unix EOL check on $file. For a module, the path
83 (lib/My/Module.pm) or the name (My::Module) can be both used. $text is
84 the diagnostic label emited after the "ok"/"not ok" TAP output.
85 "\%options" takes the same values as described in "all_perl_files_ok".
86
88 A list of functions that can be exported. You can delete this section
89 if you don't export anything, such as for a purely object-oriented
90 module.
91
93 Shamelessly ripped off from Test::NoTabs.
94
96 Test::More, Test::Pod. Test::Distribution, <Test:NoWarnings>,
97 Test::NoTabs, Module::Install::AuthorTests.
98
100 · Arthur Axel 'fREW' Schmidt <frioux@gmail.com>
101
102 · Florian Ragwitz <rafl@debian.org>
103
104 · Kent Fredric <kentfredric@gmail.com>
105
106 · Peter Rabbitson <ribasushi@cpan.org>
107
108 · Tomas Doran <bobtfish@bobtfish.net>
109
111 This software is copyright (c) 2012 by Tomas Doran.
112
113 This is free software; you can redistribute it and/or modify it under
114 the same terms as the Perl 5 programming language system itself.
115
116
117
118perl v5.16.3 2012-06-15 Test::EOL(3)