summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Parse/PMFile.pm3
-rw-r--r--xt/worepan.t3
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/Parse/PMFile.pm b/lib/Parse/PMFile.pm
index af4f705..813fe90 100644
--- a/lib/Parse/PMFile.pm
+++ b/lib/Parse/PMFile.pm
@@ -358,9 +358,12 @@ sub _packages_per_pmfile {
local $/ = "\n";
my $inpod = 0;
+ my $checked_bom;
PLINE: while (<$fh>) {
chomp;
my($pline) = $_;
+ $pline =~ s/\A(?:\x00\x00\xfe\xff|\xff\xfe\x00\x00|\xfe\xff|\xff\xfe|\xef\xbb\xbf)// unless $checked_bom;
+ $checked_bom = 1;
$inpod = $pline =~ /^=(?!cut)/ ? 1 :
$pline =~ /^=cut/ ? 0 : $inpod;
next if $inpod;
diff --git a/xt/worepan.t b/xt/worepan.t
index 7bdfa2b..ee61691 100644
--- a/xt/worepan.t
+++ b/xt/worepan.t
@@ -45,6 +45,9 @@ my @tests = (
['RCLAMP/Class-Accessor-Chained-0.01.tar.gz', 'lib/Class/Accessor/Chained.pm', 'Class::Accessor::Chained', '0.01'],
['ROODE/Readonly-1.03.tar.gz', 'Readonly.pm', 'Readonly', '1.03'],
['ACG/Scrabble-Dict-0.01.tar.gz', 'lib/Scrabble/Dict.pm', 'Scrabble::Dict', '0.01'],
+
+ # BOM
+ ['DANKOGAI/Lingua-JA-Numbers-0.05.tar.gz', 'lib/Lingua/JA/Numbers.pm', 'Lingua::JA::Numbers', '0.05'],
);
push @tests, (