diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-12-18 10:35:09 +0100 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-12-19 13:55:19 +0100 |
commit | d4c6b7ae2c2b00211f9528f146804b76b755480d (patch) | |
tree | d6a7c84d267626c3e4db22af778c3b0fc708507e /Porting/pod_rules.pl | |
parent | 449e2f794bd454dce291b0a7192232fe882f1318 (diff) | |
download | perl-d4c6b7ae2c2b00211f9528f146804b76b755480d.tar.gz |
Change get_pod_metadata() to take a callback to report consistency errors.
Using the callback to report errors instead of passing the 'inconsistent'
arrayref back in the state means that get_pod_metadata() doesn't even need
to calculate this information if it's not going to be used.
Diffstat (limited to 'Porting/pod_rules.pl')
-rw-r--r-- | Porting/pod_rules.pl | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/Porting/pod_rules.pl b/Porting/pod_rules.pl index acea2d22f5..d23f86f935 100644 --- a/Porting/pod_rules.pl +++ b/Porting/pod_rules.pl @@ -62,23 +62,20 @@ if ($Verbose) { print "I will be building $_\n" foreach keys %Build; } +my $test = 1; # For testing, generated files must be present and we're rebuilding nothing. # For normal rebuilding, generated files may not be present, and we mute # warnings about inconsistencies in any file we're about to rebuild. -my $state = get_pod_metadata($Test ? () : (1, values %Build)); - -my $test = 1; -if ($Test) { - printf "1..%d\n", 1 + scalar keys %Build; - if (@{$state->{inconsistent}}) { - print "not ok $test\n"; - die @{$state->{inconsistent}}; - } - print "ok $test\n"; -} -else { - warn @{$state->{inconsistent}} if @{$state->{inconsistent}}; -} +my $state = $Test + ? get_pod_metadata(0, sub { + printf "1..%d\n", 1 + scalar keys %Build; + if (@_) { + print "not ok $test\n"; + die @_; + } + print "ok $test\n"; + }) + : get_pod_metadata(1, sub { warn @_ if @_ }, values %Build); sub generate_perlpod { my @output; |