From 14e0a598d72aa718537c474e67a98a5f0835f8af Mon Sep 17 00:00:00 2001 From: Kenichi Ishigaki Date: Fri, 26 Apr 2024 00:29:58 +0900 Subject: [PATCH] Strip BOM before parsing package version --- lib/PAUSE/pmfile.pm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/PAUSE/pmfile.pm b/lib/PAUSE/pmfile.pm index eeb0310a6..b8301419c 100644 --- a/lib/PAUSE/pmfile.pm +++ b/lib/PAUSE/pmfile.pm @@ -204,9 +204,14 @@ sub packages_per_pmfile { local $/ = "\n"; my $inpod = 0; + my $checked_bom; PLINE: while (<$fh>) { chomp; my($pline) = $_; + unless ($checked_bom) { + $pline =~ s/\A(?:\x00\x00\xfe\xff|\xff\xfe\x00\x00|\xfe\xff|\xff\xfe|\xef\xbb\xbf)//; + $checked_bom = 1; + } $inpod = $pline =~ /^=(?!cut)/ ? 1 : $pline =~ /^=cut/ ? 0 : $inpod; next if $inpod;