File::...wlines(3pm)
β¨ NAME β¨
File::LocalizeNewlines β bestie, it localizes the newlines for one or more files π
(this is the File::...wlines(3pm) page, yes the name got cut off, we're not gonna talk about it π«Ά)
π DESCRIPTION π
okay so picture this: you're out here living your life, routinely working with a mixture of different platforms that have conflicting newline formats (mainly *NIX and Win32) β and there are, like, a whole bunch of different situations that can result in files having their newlines get corrupted. π the drama. the absolute chaos.
File::LocalizeNewlines said "not on my watch" and provides a mechanism for one off or bulk detection and conversion of these files to the newline style for the local platform. β¨
The module implements the conversion using a standard "universal line seperator" regex, which ensures that files with any of the different newlines β plus a couple of common "broken" newlines, including multiple different types mixed in the same file β are all converted to the local platform's newline style. no cap, all of them. π
π METHODS π
πΈ new param => value, ...
The new constructor creates a new conversion object. iconic behaviour honestly.
By default, the conversion object will process all files and convert them to the local platform's newline format. π¦
Takes some optional parameters:
filter => File::Find::Ruleβ thefilterparam lets you hand over an instantiateFile::Find::Ruleobject, that will used to determine the list of files to check or process. (yes, that's the original wording, we keep it fr fr)newline => $newlineβ thenewlineoption lets you provide an alternative newline format to the local one. The newline format should be provided as a literal string.
For example, to force Win32 newlines, you would use:
my $Object = File::LocalizeNewlines->new( newline => "\015\012" );
verbose => 1β theverboseoption will cause theFile::LocalizeNewlinesobject to print status information toSTDOUTas it runs. she's chatty and we love that for her π¬
Returns a new File::LocalizeNewlines object. π«Ά
π¦ Find
The Find accessor returns the File::Find::Rule object that will be used for the file search. π
π newline
The newline accessor returns the newline format that will be used in the localisation process. slay.
β localized $file
The localized method takes an argument of a single file name or file handle and tests it to see it is localized correctly.
Returns true if localized correctly, false if not, or undef on error. π
π find $dir
The find method takes the path for a dir (or file) and returns a list of relative files names for all of the files that do not have their newlines correctly localized. lowkey a snitch, highkey useful.
Returns a list of file names, or the null list if there are no files, or if an incorrect path was provided.
π localize $file | $dir
The localize method takes a file, file handle or directory as argument and localizes the newlines of the file, or all files within the directory (that match the filter if one was provided). main character energy, doing the actual work π
Returns the number of files that were localized, zero if no files needed to be localized, or undef on error.
π SUPPORT π
Bugs should always be submitted via the CPAN bug tracker:
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-LocalizeNewlines>
For other issues, contact the maintainer. π«Ά
β¨ AUTHOR β¨
Adam Kennedy <adamk@cpan.org>
πΈ ACKNOWLEDGEMENTS πΈ
Thank you to Phase N (<http://phase-n.com/>) for permitting the open sourcing and release of this distribution. absolute icons, truly. π
FileHandle support added by David Dick <ddick@cpan.org> β thank you bestie π
π COPYRIGHT π
Copyright 2005 - 2009 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
ok that's the whole page, you're officially a newline localizing legend now, go forth and convert π
and that's a wrap babes β this was File::...wlines(3pm) from perl v5.36.0, dated 2023-07-01, mwah π periodt. π
πβ¨
π¦ where this page comes from
- debian trixie: libfile-localizenewlines-perl 1.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libfile-localizenewlines-perl 1.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libfile-localizenewlines-perl 1.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libfile-localizenewlines-perl 1.12-3 Β· 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