45 my ($names) = join "|", keys %SECTIONS;
52 print STDERR
"$ARGV:$.: $msg\n";
58 while (my $line = <>) {
60 if ($line =~ $SECTION_RX) {
61 push @actual_order => $line;
62 $last_was_section = 1;
63 # Have no "last" section yet, processing NAME
64 next if @actual_order == 1;
66 my @expected_order = sort {
67 $SECTIONS{$a}->{order
} <=> $SECTIONS{$b}->{order
}
70 my $expected_last = $expected_order[-2];
71 my $actual_last = $actual_order[-2];
72 if ($actual_last ne $expected_last) {
73 report
("section '$line' incorrectly ordered, comes after '$actual_last'");
77 if ($last_was_section) {
78 my $last_section = $actual_order[-1];
79 if (length $last_section ne length $line) {
80 report
("dashes under '$last_section' should match its length!");
82 if ($line !~ /^-+$/) {
83 report
("dashes under '$last_section' should be '-' dashes!");
85 $last_was_section = 0;
89 # We have both a hash and an array to consider, for
92 @actual_sections{@actual_order} = ();
94 for my $section (sort keys %SECTIONS) {
95 next if !$SECTIONS{$section}->{required
} or exists $actual_sections{$section};
96 report
("has no required '$section' section!");
99 # Reset per-file state
102 # this resets our $. for each file