File::Find::Rule::BOM - Common rules for searching for BOM in files.
use File::Find::Rule; use File::Find::Rule::BOM; my @files = File::Find::Rule->bom->in($dir); my @files = File::Find::Rule->bom_utf8->in($dir); my @files = File::Find::Rule->bom_utf16->in($dir); my @files = File::Find::Rule->bom_utf32->in($dir);
This Perl module contains File::Find::Rule rules for detecting Byte Order Mark in files.
BOM (Byte Order Mark) is a particular usage of the special Unicode character, U+FEFF BYTE ORDER MARK, whose appearance as a magic number at the start of a text stream can signal several things to a program reading the text.
See Byte order mark on Wikipedia.
bom
my @files = File::Find::Rule->bom->in($dir);
The bom() rule detect files with BOM.
bom()
bom_utf8
my @files = File::Find::Rule->bom_utf8->in($dir);
The bom_utf8() rule detect files with UTf-8 BOM.
bom_utf8()
bom_utf16
my @files = File::Find::Rule->bom_utf16->in($dir);
The bom_utf16() rule detect files with UTF-16 BOM.
bom_utf16()
bom_utf32
my @files = File::Find::Rule->bom_utf32->in($dir);
The bom_utf32() rule detect files with UTF-32 BOM.
bom_utf32()
use strict; use warnings; use File::Find::Rule; use File::Find::Rule::BOM; # Arguments. if (@ARGV < 1) { print STDERR "Usage: $0 dir\n"; exit 1; } my $dir = $ARGV[0]; # Print all files with BOM in directory. foreach my $file (File::Find::Rule->bom->in($dir)) { print "$file\n"; } # Output like: # Usage: qr{[\w\/]+} dir
use strict; use warnings; use File::Find::Rule; use File::Find::Rule::BOM; # Arguments. if (@ARGV < 1) { print STDERR "Usage: $0 dir\n"; exit 1; } my $dir = $ARGV[0]; # Print all files with UTF-8 BOM in directory. foreach my $file (File::Find::Rule->bom_utf8->in($dir)) { print "$file\n"; } # Output like: # Usage: qr{[\w\/]+} dir
use strict; use warnings; use File::Find::Rule; use File::Find::Rule::BOM; # Arguments. if (@ARGV < 1) { print STDERR "Usage: $0 dir\n"; exit 1; } my $dir = $ARGV[0]; # Print all files with UTF-16 BOM in directory. foreach my $file (File::Find::Rule->bom_utf16->in($dir)) { print "$file\n"; } # Output like: # Usage: qr{[\w\/]+} dir
use strict; use warnings; use File::Find::Rule; use File::Find::Rule::BOM; # Arguments. if (@ARGV < 1) { print STDERR "Usage: $0 dir\n"; exit 1; } my $dir = $ARGV[0]; # Print all files with UTF-32 BOM in directory. foreach my $file (File::Find::Rule->bom_utf32->in($dir)) { print "$file\n"; } # Output like: # Usage: qr{[\w\/]+} dir
File::Find::Rule, String::BOM.
Alternative interface to File::Find
https://github.com/michal-josef-spacek/File-Find-Rule-BOM
Michal Josef Špaček mailto:skim@cpan.org
http://skim.cz
© Michal Josef Špaček 2015-2020
BSD 2-Clause License
0.02
To install File::Find::Rule::BOM, copy and paste the appropriate command in to your terminal.
cpanm
cpanm File::Find::Rule::BOM
CPAN shell
perl -MCPAN -e shell install File::Find::Rule::BOM
For more information on module installation, please visit the detailed CPAN module installation guide.