From: Tatsuhiko Miyagawa Date: Sun, 26 Jun 2011 05:12:29 +0000 (-0700) Subject: local $package::VERSION should now actually work X-Git-Tag: release_1.0.5~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=398fe5a24070a54c6c4ce6466f37904f6cc37405;p=p5sagit%2FModule-Metadata.git local $package::VERSION should now actually work Signed-off-by: David Golden --- diff --git a/lib/Module/Metadata.pm b/lib/Module/Metadata.pm index 9d60226..c2dd51d 100644 --- a/lib/Module/Metadata.pm +++ b/lib/Module/Metadata.pm @@ -517,9 +517,9 @@ sub _evaluate_version_line { use version; no strict; - local $sigil$var; - \$$var=undef; \$vsub = sub { + local $sigil$var; + \$$var=undef; $line; \$$var }; diff --git a/t/lib/0.1/Foo.pm b/t/lib/0.1/Foo.pm new file mode 100644 index 0000000..f1ecaca --- /dev/null +++ b/t/lib/0.1/Foo.pm @@ -0,0 +1,3 @@ +package Foo; +$Foo::VERSION = '0.1'; +1; diff --git a/t/lib/0.2/Foo.pm b/t/lib/0.2/Foo.pm new file mode 100644 index 0000000..8f8ef06 --- /dev/null +++ b/t/lib/0.2/Foo.pm @@ -0,0 +1,3 @@ +package Foo; +$Foo::VERSION = '0.2'; +1; diff --git a/t/version.t b/t/version.t new file mode 100644 index 0000000..4acc358 --- /dev/null +++ b/t/version.t @@ -0,0 +1,22 @@ +use strict; +use Test::More; +use Module::Metadata; +use lib "t/lib/0.2"; + +plan tests => 4; + +require Foo; +is $Foo::VERSION, 0.2; + +my $meta = Module::Metadata->new_from_module("Foo", inc => [ "t/lib/0.1" ] ); +is $meta->version, 0.1; + +is $Foo::VERSION, 0.2; + +ok eval "use Foo 0.2; 1"; + + + + + +