summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2012-01-29 17:21:27 +0000
committerNicholas Clark <nick@ccl4.org>2012-02-18 13:16:52 +0100
commit6f7c818601340cd36597dd56f5cfb30800501348 (patch)
treef1e5d1e5e7839b023f0998dc85c3f87fa1de0f5d /ext
parentc17cdb7237c28869f5b1e32776642668fb49707c (diff)
downloadperl-6f7c818601340cd36597dd56f5cfb30800501348.tar.gz
Change ext/Pod-Functions to generate Functions.pm from a Perl script.
For the first step, simply output the current file in one hit.
Diffstat (limited to 'ext')
-rw-r--r--ext/Pod-Functions/Functions_pm.PL (renamed from ext/Pod-Functions/Functions.pm)23
-rw-r--r--ext/Pod-Functions/Makefile.PL16
2 files changed, 39 insertions, 0 deletions
diff --git a/ext/Pod-Functions/Functions.pm b/ext/Pod-Functions/Functions_pm.PL
index 1069c43c33..f8329d23cd 100644
--- a/ext/Pod-Functions/Functions.pm
+++ b/ext/Pod-Functions/Functions_pm.PL
@@ -1,3 +1,26 @@
+#!perl -w
+use strict;
+
+# blead will run this with miniperl, hence we can't use autodie
+my $real = 'Functions.pm';
+my $temp = "Functions.$$";
+
+END {
+ return if !-e $temp;
+ unlink $temp or warn "Can't unlink '$temp': $!";
+}
+
+foreach ($real, $temp) {
+ next if !-e $_;
+ unlink $_ or die "Can't unlink '$_': $!";
+}
+
+open my $fh, '>', $temp or die "Can't open '$temp' for writing: $!";
+print $fh <DATA> or die "Can't write to '$temp': $!";
+close $fh or die "Can't close '$temp': $!";
+rename $temp, $real or die "Can't rename '$temp' to '$real': $!";
+
+__END__
package Pod::Functions;
use strict;
diff --git a/ext/Pod-Functions/Makefile.PL b/ext/Pod-Functions/Makefile.PL
new file mode 100644
index 0000000000..64936dc840
--- /dev/null
+++ b/ext/Pod-Functions/Makefile.PL
@@ -0,0 +1,16 @@
+#!perl -w
+
+use strict;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(NAME => 'Pod::Functions',
+ VERSION_FROM => 'Functions_pm.PL',
+ LICENSE => 'perl',
+ PREREQ_PM => {},
+ ABSTRACT_FROM => 'Functions_pm.PL',
+ AUTHOR => 'Perl 5 Porters <perlbug@perl.org>',
+ INSTALLDIRS => 'perl',
+ PL_FILES => {'Functions_pm.PL' => 'Functions.pm'},
+ PM => {'Functions.pm' => '$(INST_LIBDIR)/Functions.pm'},
+ clean => {FILES => 'Functions.pm'},
+ );