Silence warnings for single-field line in revbank.products
This commit is contained in:
parent
e644526496
commit
5e8f905a7d
1 changed files with 5 additions and 4 deletions
|
@ -71,13 +71,13 @@ sub read_products($filename = "revbank.products", $default_contra = "+sales/prod
|
|||
unshift @addon_ids, $1 while $desc =~ s/\s+ \+ (\S+)$//x;
|
||||
}
|
||||
|
||||
my $canonical = join " ", map RevBank::Prompt::reconstruct($_), $ids, $p, $desc, @extra;
|
||||
|
||||
my @ids = split /,/, $ids;
|
||||
|
||||
$p ||= "invalid";
|
||||
$p //= 0;
|
||||
$desc ||= "(no description)";
|
||||
|
||||
my $canonical = join " ", map RevBank::Prompt::reconstruct($_), $ids, $p, $desc, @extra;
|
||||
|
||||
my ($price, $contra) = split /\@/, $p, 2;
|
||||
|
||||
my $sign = $price =~ s/^-// ? -1 : 1;
|
||||
|
@ -91,11 +91,12 @@ sub read_products($filename = "revbank.products", $default_contra = "+sales/prod
|
|||
$percent = $sign * (0 + $price);
|
||||
$price = undef; # calculated later
|
||||
} else {
|
||||
$price = $sign * eval { parse_amount($price) };
|
||||
$price = eval { parse_amount($price) };
|
||||
if (not defined $price) {
|
||||
warn "Invalid price for '$ids[0]' at $filename line $linenr.\n";
|
||||
next;
|
||||
}
|
||||
$price *= $sign;
|
||||
}
|
||||
for my $id (@ids) {
|
||||
warn "Product '$id' redefined at $filename line $linenr (original at line $products{$id}{line}).\n" if exists $products{$id};
|
||||
|
|
Loading…
Add table
Reference in a new issue