diff options
author | Kenichi Ishigaki <ishigaki@cpan.org> | 2024-04-15 16:47:46 +0900 |
---|---|---|
committer | Kenichi Ishigaki <ishigaki@cpan.org> | 2024-04-15 16:48:04 +0900 |
commit | 53729d72eae3015298a858d46afda3529d40881c (patch) | |
tree | 797a3eca5915b52e6484e29e7a7735d7be75d7b3 /lib/Parse | |
parent | 0f2fe6d15e47d13545c6c233b11dc6bd02d6ce8e (diff) |
Strip BOM before finding a package
Diffstat (limited to 'lib/Parse')
-rw-r--r-- | lib/Parse/PMFile.pm | 3 |
1 files changed, 3 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; |