clusterssh/bin_PL/_build_docs
Duncan Ferguson 7808bd8e20 Generate docs using same perl as the build process
Ensure the same perl binary is used to generate the docs as used to build the module, to ensure consistency (i.e. don't use the system perl if a different perl is used)
2015-11-07 11:37:57 +00:00

44 lines
1,021 B
Perl
Executable file

#!/usr/bin/env perl
use strict;
use warnings;
use FindBin qw($Bin $Script);
chdir $Bin || die "Unable to chdir into $Bin: $!";
my $bindir="$Bin/../bin";
if(! -d $bindir) {
mkdir $bindir || die "Could not mkdir $bindir: $!";
}
for my $source (glob("*")) {
my $dest="$bindir/$source";
next if($source =~ m/$Script/);
next if($source =~ m/\.x$/);
print "Generating: $source",$/;
if(-f $dest) {
chmod(0777, $dest) || die "Could not chmod $dest for removing: $!";
}
open(my $sfh, '<', $source) || die "Could not open $source for reading: $!";
open(my $dfh, '>', $dest ) || die "Could not open $dest for writing: $!";
print $dfh $_ while(<$sfh>);
close($sfh);
if($source ne "clusterssh_bash_completion.dist") {
print $dfh "\n\n__END__\n\n";
my $pod= qx{ $^X ./$source --generate-pod };
die "Failed to generate pod" if($?);
print $dfh $pod;
}
close($dfh);
chmod(0555, $dest) || die "Could not chmod $dest: $!";
}