Debian Codegraph @

README

raw
1 NAME
2 File::LocalizeNewlines - Localize the newlines for one or more files
3
4 DESCRIPTION
5 For people that routinely work with a mixture of different platforms
6 that have conflicting newline formats (mainly *NIX and Win32) there are
7 a number of different situations that can result in files having their
8 newlines get corrupted.
9
10 File::LocalizeNewlines provides a mechanism for one off or bulk
11 detection and conversion of these files to the newline style for the
12 local platform.
13
14 The module implements the conversion using a standard "universal line
15 seperator" regex, which ensures that files with any of the different
16 newlines, plus a couple of common "broken" newlines, including multiple
17 different types mixed in the same file, are all converted to the local
18 platform's newline style.
19
20 METHODS
21 new param => value, ...
22 The "new" constructor creates a new conversion object.
23
24 By default, the conversion object will process all files and convert
25 them to the local platform's newline format.
26
27 Takes some optional parameters
28
29 filter => File::Find::Rule
30 The "filter" param allows you to provide an instantiate
31 File::Find::Rule object, that will used to determine the list of
32 files to check or process.
33
34 newline => $newline
35 The "newline" option allows you to provide an alternative newline
36 format to the local one. The newline format should be provided as a
37 literal string.
38
39 For example, to force Win32 newlines, you would use
40
41 my $Object = File::LocalizeNewlines->new( newline => "\015\012" );
42
43 verbose => 1
44 The "verbose" option will cause the "File::LocalizeNewlines" object
45 to print status information to "STDOUT" as it runs.
46
47 Returns a new "File::LocalizeNewlines" object.
48
49 Find
50 The "Find" accessor returns the File::Find::Rule object that will be
51 used for the file search.
52
53 newline
54 The "newline" accessor returns the newline format that will be used in
55 the localisation process.
56
57 localized $file
58 The "localized" method takes an argument of a single file name or file
59 handle and tests it to see it is localized correctly.
60
61 Returns true if localized correctly, false if not, or "undef" on error.
62
63 find $dir
64 The "find" method takes the path for a dir (or file) and returns a list
65 of relative files names for all of the files that do not have their
66 newlines correctly localized.
67
68 Returns a list of file names, or the null list if there are no files, or
69 if an incorrect path was provided.
70
71 localize $file | $dir
72 The "localize" method takes a file, file handle or directory as argument
73 and localizes the newlines of the file, or all files within the
74 directory (that match the filter if one was provided).
75
76 Returns the number of files that were localized, zero if no files needed
77 to be localized, or "undef" on error.
78
79 SUPPORT
80 Bugs should always be submitted via the CPAN bug tracker
81
82 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-LocalizeNewlines>
83
84 For other issues, contact the maintainer.
85
86 AUTHOR
87 Adam Kennedy <[email protected]>
88
89 ACKNOWLEDGEMENTS
90 Thank you to Phase N (<http://phase-n.com/>) for permitting the open
91 sourcing and release of this distribution.
92
93 FileHandle support added by David Dick <[email protected]>
94
95 COPYRIGHT
96 Copyright 2005 - 2009 Adam Kennedy.
97
98 This program is free software; you can redistribute it and/or modify it
99 under the same terms as Perl itself.
100
101 The full text of the license can be found in the LICENSE file included
102 with this module.
103