summaryrefslogtreecommitdiff
path: root/Porting/corelist-perldelta.pl
diff options
context:
space:
mode:
authorAbir Viqar <abiviq@hushmail.com>2013-10-03 16:48:34 -0400
committerSteve Hay <steve.m.hay@googlemail.com>2013-12-19 17:26:23 +0000
commitc014dfade439c530cde995c21eddff12e9179657 (patch)
tree6407c379637cbc13620860beda08e06573bab612 /Porting/corelist-perldelta.pl
parent3668a9e5f3fcda99d7e32f1ac571123b116971cd (diff)
downloadperl-c014dfade439c530cde995c21eddff12e9179657.tar.gz
Porting/corelist-perldelta.pl - Cleanup DeltaParser
* Comment generation of accessor methods * Make _parse_delta() more explicit by calling the section parsing methods explicitly * Ensure that the new_modules, updated_modules, and removed_modules attributes exist even if the perldelta file does not contain the corresponding sections
Diffstat (limited to 'Porting/corelist-perldelta.pl')
-rwxr-xr-xPorting/corelist-perldelta.pl43
1 files changed, 20 insertions, 23 deletions
diff --git a/Porting/corelist-perldelta.pl b/Porting/corelist-perldelta.pl
index 6b8ebbad3f..19ab0d3093 100755
--- a/Porting/corelist-perldelta.pl
+++ b/Porting/corelist-perldelta.pl
@@ -224,6 +224,10 @@ sub do_check {
return $self;
}
+ # creates the accessor methods:
+ # new_modules
+ # updated_modules
+ # removed_modules
for my $k (keys %sections) {
no strict 'refs';
my $m = "${k}_modules";
@@ -233,29 +237,17 @@ sub do_check {
sub _parse_delta {
my ($self, $pod) = @_;
- map {
- my ($t, $s) = @{ $_ };
-
- # Keep the section title if it has one:
- if( $s->[0]->[0] eq 'head2' ) {
- #warn "Keeping section title '$s->[0]->[2]'";
- $titles{ $t } = $s->[0]->[2]
- if $s->[0]->[2];
- };
-
- $self->${\"_parse_${t}_section"}($s)
- } map {
- my $s = $self->_look_for_section($pod => $sections{$_})
- or die "failed to parse $_ section";
- [$_, $s];
- } keys %sections;
-
- for my $s (keys %sections) {
- my $m = "${s}_modules";
-
- $self->{$m} = [sort {
- lc $a->[0] cmp lc $b->[0]
- } @{ $self->{$m} }];
+ my $new_section = $self->_look_for_section( $pod, $sections{new} );
+ my $updated_section = $self->_look_for_section( $pod, $sections{updated} );
+ my $removed_section = $self->_look_for_section( $pod, $sections{removed} );
+
+ $self->_parse_new_section($new_section);
+ $self->_parse_updated_section($updated_section);
+ $self->_parse_removed_section($removed_section);
+
+ for (qw/new_modules updated_modules removed_modules/) {
+ $self->{$_} =
+ [ sort { lc $a->[0] cmp lc $b->[0] } @{ $self->{$_} } ];
}
return;
@@ -264,6 +256,8 @@ sub do_check {
sub _parse_new_section {
my ($self, $section) = @_;
+ $self->{new_modules} = [];
+ return unless $section;
$self->{new_modules} = $self->_parse_section($section => sub {
my ($el) = @_;
@@ -310,6 +304,9 @@ sub do_check {
sub _parse_removed_section {
my ($self, $section) = @_;
+
+ $self->{removed_modules} = [];
+ return unless $section;
$self->{removed_modules} = $self->_parse_section($section => sub {
my ($el) = @_;