summaryrefslogtreecommitdiff
path: root/Porting/pod_rules.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-11-10 11:52:34 +0100
committerNicholas Clark <nick@ccl4.org>2011-11-18 11:08:59 +0100
commit3b0c5c72fe9178c3109891f3884c2417c94e5959 (patch)
tree1f029a201a1a7f6f9b50dc179b4ceb18ae59ab79 /Porting/pod_rules.pl
parent9e241592f0b49731f51cf488e02c09dc84753e5d (diff)
downloadperl-3b0c5c72fe9178c3109891f3884c2417c94e5959.tar.gz
Refactor pod_rules.pl and buildtoc to use new functions in pod_lib.pl
This reduces code duplication.
Diffstat (limited to 'Porting/pod_rules.pl')
-rw-r--r--Porting/pod_rules.pl10
1 files changed, 2 insertions, 8 deletions
diff --git a/Porting/pod_rules.pl b/Porting/pod_rules.pl
index 8be1468967..acea2d22f5 100644
--- a/Porting/pod_rules.pl
+++ b/Porting/pod_rules.pl
@@ -274,10 +274,7 @@ pod/$_: pod/$state->{copies}{$_}
while (my ($target, $name) = each %Targets) {
print "Now processing $name\n" if $Verbose;
- my $fh = open_or_die($name);
- binmode $fh;
- local $/;
- my $orig = <$fh>;
+ my $orig = slurp_or_die($name);
my_die "$name contains NUL bytes" if $orig =~ /\0/;
my $new = do {
@@ -299,10 +296,7 @@ while (my ($target, $name) = each %Targets) {
my $mode = (stat $name)[2] // my_die "Can't stat $name: $!";
rename $name, "$name.old" or my_die "Can't rename $name to $name.old: $!";
- open $fh, '>', $name or my_die "Can't open $name for writing: $!";
- binmode $fh;
- print $fh $new or my_die "print to $name failed: $!";
- close $fh or my_die "close $name failed: $!";
+ write_or_die($name, $new);
chmod $mode & 0777, $name or my_die "can't chmod $mode $name: $!";
}