-
Notifications
You must be signed in to change notification settings - Fork 4
/
make-pod.pl
executable file
·74 lines (65 loc) · 1.41 KB
/
make-pod.pl
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
68
69
70
71
72
73
#!/home/ben/software/install/bin/perl
use warnings;
use strict;
use Template;
use FindBin '$Bin';
use Perl::Build qw/get_info get_commit/;
use Perl::Build::Pod ':all';
use Deploy qw/do_system older/;
use Getopt::Long;
my $ok = GetOptions (
'force' => \my $force,
'verbose' => \my $verbose,
);
if (! $ok) {
usage ();
exit;
}
my %pbv = (base => $Bin);
my $commit = get_commit (%pbv);
my $info = get_info (%pbv);
my $version = $info->{version};
# Names of the input and output files containing the documentation.
my $pod = 'PluralToSingular.pod';
my $input = "$Bin/lib/Lingua/EN/$pod.tmpl";
my $output = "$Bin/lib/Lingua/EN/$pod";
# Template toolkit variable holder
my %vars = (
commit => $commit,
info => $info,
version => $version,
);
my $tt = Template->new (
ABSOLUTE => 1,
INCLUDE_PATH => [
$Bin,
pbtmpl (),
"$Bin/examples",
],
ENCODING => 'UTF8',
FILTERS => {
xtidy => [
\& xtidy,
0,
],
},
STRICT => 1,
);
my @examples = <$Bin/examples/*.pl>;
for my $example (@examples) {
my $output = $example;
$output =~ s/\.pl$/-out.txt/;
if (older ($output, $example) || $force) {
do_system ("perl -I$Bin/blib/lib -I$Bin/blib/arch $example > $output 2>&1", $verbose);
}
}
$tt->process ($input, \%vars, $output, binmode => 'utf8')
or die '' . $tt->error ();
exit;
sub usage
{
print <<USAGEEOF;
--verbose
--force
USAGEEOF
}