#!/usr/bin/perl -w
use strict;
-use vars qw($masterpodfile %Build %Targets $Verbose $Quiet %Ignore
+use vars qw(%Build %Targets $Verbose $Quiet %Ignore
@Master %Readmes %Pods %Aux %Pragmata %Modules $delta_target
%Copies %Generated $Test);
use File::Spec;
exit 255;
}
-
-$masterpodfile = 'pod.lst';
+sub open_or_die {
+ my $filename = shift;
+ open my $fh, '<', $filename or my_die "Can't open $filename: $!";
+ return $fh;
+}
# Generate any/all of these files
# --verbose gives slightly more output
{
my $source = 'perldelta.pod';
my $filename = "pod/$source";
- open my $fh, '<', $filename or my_die "Can't open $filename: $!";
+ my $fh = open_or_die($filename);
local $/;
my $contents = <$fh>;
my @want =
{
my %Readmepods;
-open my $master, '<', $masterpodfile or my_die "Can't open $masterpodfile: $!";
+ my $master = open_or_die('pod.lst');
foreach (<$master>) {
next if /^\#/;
# Things we copy from won't be in perl.pod
# Things we copy to won't be in MANIFEST
- my $filename = 'MANIFEST';
- open my $mani, '<', $filename or my_die "opening $filename failed: $!";
+ my $mani = open_or_die('MANIFEST');
while (<$mani>) {
chomp;
s/\s+.*$//;
@cpanpods{@cpanpods} = map { s/.*\///r } @cpanpods;
%cpanpods_short = reverse %cpanpods;
- $filename = 'pod/perl.pod';
- open my $perlpod, '<', $filename or my_die "opening $filename failed: $!\n";
+ my $perlpod = open_or_die('pod/perl.pod');
while (<$perlpod>) {
if (/^For ease of access, /../^\(If you're intending /) {
if (/^\s+(perl\S*)\s+\w/) {
print "Now processing $name\n" if $Verbose;
if ($target ne "toc") {
local $/;
- open my $thing, '<', $name or my_die "Can't open $name: $!";
+ my $thing = open_or_die($name);
binmode $thing;
$orig = <$thing>;
my_die "$name contains NUL bytes" if $orig =~ /\0/;