summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-02-10 19:17:09 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-02-10 19:17:09 +0000
commit9f3d182ed95630da223ec0d99832141e262ccc05 (patch)
tree8eed5188dbc01789099214dd0ebd33f5714377ce
parent1acb48c9d1d40d4a21897ac28a864cf7255b8a1c (diff)
downloadperl-9f3d182ed95630da223ec0d99832141e262ccc05.tar.gz
longstanding bug in parsing "require VERSION", could reallocate
current line and not know it; exposed by change#5004; manifested as parse failure of C<{require 5.003}> p4raw-link: @5004 on //depot/perl: 18b095192e336ba31465f4d3dab1ecc90871c3a9 p4raw-id: //depot/perl@5061
-rwxr-xr-xt/comp/require.t20
-rwxr-xr-xt/comp/use.t8
-rw-r--r--toke.c2
3 files changed, 27 insertions, 3 deletions
diff --git a/t/comp/require.t b/t/comp/require.t
index d4c9d8ca61..f963a8ce30 100755
--- a/t/comp/require.t
+++ b/t/comp/require.t
@@ -7,7 +7,7 @@ BEGIN {
# don't make this lexical
$i = 1;
-print "1..16\n";
+print "1..20\n";
sub do_require {
%INC = ();
@@ -23,6 +23,24 @@ sub write_file {
close REQ;
}
+eval {require 5.005};
+print "# $@\nnot " if $@;
+print "ok ",$i++,"\n";
+
+eval { require 5.005 };
+print "# $@\nnot " if $@;
+print "ok ",$i++,"\n";
+
+eval { require 5.005; };
+print "# $@\nnot " if $@;
+print "ok ",$i++,"\n";
+
+eval {
+ require 5.005
+};
+print "# $@\nnot " if $@;
+print "ok ",$i++,"\n";
+
# new style version numbers
eval { require v5.5.630; };
diff --git a/t/comp/use.t b/t/comp/use.t
index 2594f0a547..dbbda5c038 100755
--- a/t/comp/use.t
+++ b/t/comp/use.t
@@ -5,9 +5,15 @@ BEGIN {
unshift @INC, '../lib';
}
-print "1..14\n";
+print "1..15\n";
my $i = 1;
+eval "use 5.000"; # implicit semicolon
+if ($@) {
+ print STDERR $@,"\n";
+ print "not ";
+}
+print "ok ",$i++,"\n";
eval "use 5.000;";
if ($@) {
diff --git a/toke.c b/toke.c
index 34599bd95f..44b3023f10 100644
--- a/toke.c
+++ b/toke.c
@@ -825,7 +825,7 @@ S_force_version(pTHX_ char *s)
if (*d == 'v')
d++;
for (; isDIGIT(*d) || *d == '_' || *d == '.'; d++);
- if ((*d == ';' || isSPACE(*d)) && *(skipspace(d)) != ',') {
+ if (*d == ';' || isSPACE(*d) || *d == '}' || !*d) {
s = scan_num(s);
/* real VERSION number -- GBARR */
version = yylval.opval;