diff options
Diffstat (limited to 'Perl/export2cpan')
-rwxr-xr-x | Perl/export2cpan | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/Perl/export2cpan b/Perl/export2cpan index 766422e..830e243 100755 --- a/Perl/export2cpan +++ b/Perl/export2cpan @@ -47,7 +47,24 @@ sub version4cpan { close (FD); - return "$major.$minor$patchlevel"; + return sprintf ("%d.%d%02d", $major,$minor,$patchlevel); +} + +sub filesubst { + my ($fileIn, $fileOut, $key, $val) = @_; + + open(FDIN, "<$fileIn") or die "Could not open input file $fileIn"; + open(FDOUT, ">$fileOut") or die "Could not open output file $fileOut"; + + while (<FDIN>) { + if (/$key/) { + s/$key/$val/g; + } + print FDOUT $_; + } + + close(FDIN); + close(FDOUT); } my $VERSION; @@ -94,7 +111,7 @@ if ($FROM_CVS) { else { $VERSION = version4cpan; print "cd ..; ./configure\n"; - system ("cd ..; ./configure"); # for creating Zinc.pm and Makefile.pl from xxx.in files + system ("cd ..; ./configure"); # for creating Makefile.pl from xxx.in files } print "VERSION $VERSION\n"; @@ -137,8 +154,9 @@ foreach my $f (@files) { system("$CP $f $EXPORT_DIR/$VERSION_DIR"); } +# modifying the $VERSION of Zinc.pm with the correctly perl formated version scheme. +&filesubst ('Zinc.pm', "$EXPORT_DIR/$VERSION_DIR/Zinc.pm", '^\$VERSION *=.*;', "\$VERSION = $VERSION;"); -system("$CP Zinc.pm $EXPORT_DIR/$VERSION_DIR"); system("$CP Makefile.PL $EXPORT_DIR/$VERSION_DIR"); system("$CP ../generic/*.c $EXPORT_DIR/$VERSION_DIR"); system("$CP ../generic/*.h $EXPORT_DIR/$VERSION_DIR"); |