Author: dagolden
Date: Thu Sep 17 16:16:02 2009
New Revision: 13361
Modified:
Module-Build/branches/0.3500/lib/Module/Build/Version.pm
Log:
load embedded version.pm from vars, not DATA
Loading from DATA keep a filehandle open that prevents
Module::Build::Version from being replaced on install
without a reboot. This change should allow us to install
without that issue.
Modified: Module-Build/branches/0.3500/lib/Module/Build/Version.pm
==============================================================================
--- Module-Build/branches/0.3500/lib/Module/Build/Version.pm (original)
+++ Module-Build/branches/0.3500/lib/Module/Build/Version.pm Thu Sep 17
16:16:02 2009
@@ -1,7 +1,8 @@
package Module::Build::Version;
use strict;
-use vars qw($VERSION);
+# $version and $vpp are set in a BEGIN block at end of this file
+use vars qw($VERSION $version $vpp);
$VERSION = 0.77;
eval "use version $VERSION";
@@ -9,25 +10,9 @@
# Avoid redefined warnings if an old version.pm was available
delete $version::{$_} foreach keys %version::;
+ delete $version::vpp::{$_} foreach keys %version::vpp::;
- # first we get the stub version module
- my $version;
- while (<DATA>) {
- s/(\$VERSION)\s=\s\d+/\$VERSION = 0/;
- $version .= $_ if $_;
- last if /^1;$/;
- }
-
- # and now get the current version::vpp code
- my $vpp;
- while (<DATA>) {
- s/(\$VERSION)\s=\s\d+/\$VERSION = 0/;
- $vpp .= $_ if $_;
- last if /^1;$/;
- }
-
- # but we eval them in reverse order since version depends on
- # version::vpp to already exist
+ # but we eval version::vpp first since version depends on it
eval $vpp; die $@ if $@;
$INC{'version/vpp.pm'} = 'inside Module::Build::Version';
eval $version; die $@ if $@;
@@ -38,8 +23,10 @@
use vars qw(@ISA);
@ISA = qw(version);
-1;
-__DATA__
+### EMBEDDED VERSION.PM CODE FOLLOWS ###
+
+BEGIN {
+ $version = << 'END_VERSION_CODE';
# stub version module to make everything else happy
package version;
@@ -113,7 +100,9 @@
}
1;
+END_VERSION_CODE
+ $vpp = << 'END_VPP_CODE';
# replace everything from here to the end with the current version/vpp.pm
package version::vpp;
use strict;
@@ -682,3 +671,9 @@
}
1; #this line is important and will help the module return a true value
+END_VPP_CODE
+
+} # BEGIN
+
+1;
+