From eea758eef3afb11fe045f2c8ee51346a54295616 Mon Sep 17 00:00:00 2001
From: short <>
Date: Tue, 13 Dec 2005 05:17:50 +0000
Subject: [PATCH] warn on projects with unregistered/unknown "platform" field.
---
project/Index.pm | 3 +++
project/List.pm | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/project/Index.pm b/project/Index.pm
index c0ba713..07475ff 100755
--- a/project/Index.pm
+++ b/project/Index.pm
@@ -43,6 +43,7 @@ print(project::Lib->views("Detailed"));
print(project::Lib->platforms(undef(),"novskip"=>1));
my %item=project::Lib->name_to_hashref();
+my %item_unused=%item;
my @platforms=@project::Lib::platforms;
while (@platforms) {
@@ -55,6 +56,7 @@ while (@platforms) {
(lc($item{$a}{"name"}) cmp lc($item{$b}{"name"}));
} map({ $item{$_}{"platform"} ne $platform_sym ? () : ($_); } keys(%item));
for my $project (@projects) {
+ delete $item_unused{$project};
my $t="";
$t.="
".a_href("/project/$project/",$item{$project}{"name"}.": ".$item{$project}{"summary"})."
\n";
@@ -71,6 +73,7 @@ while (@platforms) {
}
}
}
+cluck "INVALID 'platform': $_" for keys(%item_unused);
exit;
diff --git a/project/List.pm b/project/List.pm
index e8e913d..b7e3b74 100755
--- a/project/List.pm
+++ b/project/List.pm
@@ -25,6 +25,7 @@ use warnings;
use My::Web;
Wrequire 'project::Lib';
+use Carp qw(confess cluck);
sub handler
@@ -45,6 +46,7 @@ print(project::Lib->views(($W->{"args"}{"platform"} ? "BriefPlatform" : "BriefUn
print(project::Lib->platforms(undef(),"novskip"=>1)) if $W->{"args"}{"platform"};
my %item=project::Lib->name_to_hashref();
+my %item_unused=%item;
# $col{"name"}{"show"}=1
# $col{"name"}{"format"}=sub { "<".$_[0].">"; }
@@ -120,6 +122,7 @@ my($platform)=@_;
print '';
for my $col (@col_order) {
next if defined $col{$col}{"show"} && !$col{$col}{"show"};
+ delete $item_unused{$row};
print '';
if (!$col{$col}{"format"}) {
print(($item{$row}{$col} || ""));
@@ -153,6 +156,7 @@ else {
&{$print_one_platform}($platform_sym);
}
}
+cluck "INVALID 'platform': $_" for keys(%item_unused);
exit;
--
1.8.3.1
|