summaryrefslogtreecommitdiff
path: root/Porting/pod_lib.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-11-09 21:50:56 +0100
committerNicholas Clark <nick@ccl4.org>2011-11-18 11:08:58 +0100
commitbcfe7366a024445f7575d1c34add01b8f02b72b3 (patch)
treee8359635575c837d1bb8931b898f8a5691b5e48c /Porting/pod_lib.pl
parentc26a697bb0fc682eb6ae9f58c6372d8e19d482b2 (diff)
downloadperl-bcfe7366a024445f7575d1c34add01b8f02b72b3.tar.gz
Add Porting/new-perldelta.pl, which automates adding a new perldelta.
Strictly, "mostly automates", as it doesn't run `git add`, or test that the build is clean. However, it simplifies a gnarly step in the release manager's guide, so it's progress.
Diffstat (limited to 'Porting/pod_lib.pl')
-rw-r--r--Porting/pod_lib.pl23
1 files changed, 21 insertions, 2 deletions
diff --git a/Porting/pod_lib.pl b/Porting/pod_lib.pl
index 6caeb193d0..0d7755bdc3 100644
--- a/Porting/pod_lib.pl
+++ b/Porting/pod_lib.pl
@@ -18,6 +18,24 @@ sub open_or_die {
return $fh;
}
+sub slurp_or_die {
+ my $filename = shift;
+ my $fh = open_or_die($filename);
+ binmode $fh;
+ local $/;
+ my $contents = <$fh>;
+ die "Can't read $filename: $!" unless defined $contents and close $fh;
+ return $contents;
+}
+
+sub write_or_die {
+ my ($filename, $contents) = @_;
+ open my $fh, '>', $filename or die "Can't open $filename for writing: $!";
+ binmode $fh;
+ print $fh $contents or die "Can't write to $filename: $!";
+ close $fh or die "Can't close $filename: $!";
+}
+
sub get_pod_metadata {
# Do we expect to find generated pods on disk?
my $permit_missing_generated = shift;
@@ -43,9 +61,10 @@ sub get_pod_metadata {
my $fh = open_or_die($filename);
my $contents = do {local $/; <$fh>};
my @want =
- $contents =~ /perldelta - what is new for perl v5\.(\d+)\.(\d+)\n/;
+ $contents =~ /perldelta - what is new for perl v(5)\.(\d+)\.(\d+)\n/;
die "Can't extract version from $filename" unless @want;
- $state{delta_target} = "perl5$want[0]$want[1]delta.pod";
+ $state{delta_target} = join '', 'perl', @want, 'delta.pod';
+ $state{delta_version} = \@want;
# This way round so that keys can act as a MANIFEST skip list
# Targets will always be in the pod directory. Currently we can only cope