/usr/bin/check_perldiag is in libparse-errorstring-perl-perl 0.22-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | #!/usr/bin/perl -w
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
package check_perldiag;
# ABSTRACT: check a localized version of L<peldiag> for consistency
use strict;
use warnings;
use Pod::Find ();
use Pod::POM ();
my $localized_perldiag = $ARGV[0];
die "No perldiag specified" unless $localized_perldiag;
my $localized_pod_filename = Pod::Find::pod_where({-inc => 1}, $localized_perldiag);
my $default_pod_filename = Pod::Find::pod_where({-inc => 1}, 'perldiag');
my $parser = Pod::POM->new();
my $pom_local = $parser->parse_file($localized_pod_filename);
if (!$pom_local) {
die "Could not parse localized perldiag: " . $parser->error();
}
my $pom_default = $parser->parse_file($default_pod_filename);
if (!$pom_default) {
die "Could not parse default perldiag: " . $parser->error();
}
my (@local_errors, @default_errors);
foreach my $item ($pom_local->head1->[1]->over->[0]->item) {
push @local_errors, $item->title;
}
foreach my $item ($pom_default->head1->[1]->over->[0]->item) {
push @default_errors, $item->title;
}
if ($#local_errors != $#default_errors) {
print "Unequal number of errors: localized - $#local_errors, default - $#default_errors.\n";
}
for (my $i = 0; $i <= $#local_errors; $i++) {
if ($local_errors[$i] ne $default_errors[$i]) {
print 'Got: "' . $local_errors[$i] . '", expected: "' . $default_errors[$i] . '".' . "\n";
}
}
__END__
=head1 NAME
check_perldiag - check a localized version of peldiag for consistency
=head1 SYNOPSIS
From the command line:
check_perldiag POD2::FR::perldiag
=head1 DESCRIPTION
This script compares a translated version of L<peldiag> with the default L<peldiag> installed with perl. It compares each error message in the two files and tells you if they do not match. A warning is issued if the two files contain a different number of error messages defined.
|