allow quotes around version in Makefile.PL
[p5sagit/Distar.git] / helpers / changelog-context
1 #!/usr/bin/env perl
2 use strict;
3 use warnings FATAL => 'all';
4
5 my $version = shift or die "no version specified!";
6 my $changelog = shift or die "no changelog file specified!";
7
8 open my $fh, '<', $changelog
9   or die "can't open $changelog: $!";
10 my $context;
11 my $found_version;
12 while (my $line = <$fh>) {
13   if ($found_version) {
14     last
15       if $line =~ /^\S/;
16     $context++;
17   }
18   elsif ($line =~ /^v?\Q$version\E/) {
19     $found_version = 1;
20   }
21 }
22 close $fh;
23 die "couldn't find heading for $version!"
24   unless $found_version;
25
26 print "$context\n";