UTF8BOM - handling Byte Order Mark for UTF-8 files
use UTF8BOM; UTF8BOM->insert_into_files( recursive => 1, dir => '/path/to/dir', ); # or on your shell utf8bom -insert -dir /path/to/dir -recursive utf8bom -strip -file /path/to/file # display usage utf8bom -help
This modules allows you to insert UTF8's BOM into strings and files, or remove it from them easily.
check whether passed string includes BOM or not, and return boolean.
if( UTF8BOM->check_bom($str) ) { # $str includes BOM } else { # $str doesn't include BOM }
insert BOM into passed string, and return it.
$str = UTF8BOM->insert_into_str($str) # Now, $str includes BOM
insert BOM into head of file.
UTF8BOM->insert_into_file('/path/to/file'); # Now, the file has BOM on it's head.
insert BOM into head of files.
UTF8BOM->insert_into_files( dir => '/path/to/dir', recursive => 1, ); # Now, all the in the directory has BOM on it's head.
remove BOM from passed string, and return it.
$str = UTF8DOM->remove_from_str($str);
UTF8BOM->remove_from_file('/path/to/file');
UTF8BOM->remove_from_files( dir => '/path/to/dir', recursive => 1, );
utf8bom
Lyo Kato <lyo.kato@gmail.com>
This library is free software. You can redistribute it and/or modify it under the same terms as perl itself.
To install UTF8BOM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm UTF8BOM
CPAN shell
perl -MCPAN -e shell install UTF8BOM
For more information on module installation, please visit the detailed CPAN module installation guide.