Skip to content

Commit d72cf88

Browse files
committed
Adjust cpan/Module-Metadata to look for version
References: Perl-Toolchain-Gang/Module-Metadata#35
1 parent 8132fcf commit d72cf88

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

cpan/Module-Metadata/lib/Module/Metadata.pm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,6 @@ sub _parse_fh {
546546

547547
while (defined( my $line = <$fh> )) {
548548
my $line_num = $.;
549-
550549
chomp( $line );
551550

552551
# From toke.c : any line that begins by "=X", where X is an alphabetic
@@ -685,14 +684,18 @@ sub _evaluate_version_line {
685684
my $self = shift;
686685
my( $sigil, $variable_name, $line ) = @_;
687686

687+
# It is not legal to do local on a variable in the local name space before it is declared.
688+
my $local = ($variable_name =~ m/::/) ? 'local' : 'my';
689+
688690
# We compile into a local sub because 'use version' would cause
689691
# compiletime/runtime issues with local()
690692
$pn++; # everybody gets their own package
691693
my $eval = qq{ my \$dummy = q# Hide from _packages_inside()
692694
#; package Module::Metadata::_version::p${pn};
695+
no strict 'vars';
693696
use version;
694697
sub {
695-
local $sigil$variable_name;
698+
$local $sigil$variable_name;
696699
$line;
697700
return \$$variable_name if defined \$$variable_name;
698701
return \$Module::Metadata::_version::p${pn}::$variable_name;

0 commit comments

Comments
 (0)