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