#!./perl
-print "1..51\n";
+print "1..54\n";
$x = 'x';
print "ok $test\n";
++$test;
}
+
+# Tests 52-54
+# => should only quote foo::bar if it isn't a real sub. AMS, 20010621
+
+sub xyz::foo { "bar" }
+my %str = (
+ foo => 1,
+ xyz::foo => 1,
+ xyz::bar => 1,
+);
+
+my $test = 52;
+print ((exists $str{foo} ? "" : "not ")."ok $test\n"); ++$test;
+print ((exists $str{bar} ? "" : "not ")."ok $test\n"); ++$test;
+print ((exists $str{xyz::bar} ? "" : "not ")."ok $test\n"); ++$test;
default: /* not a keyword */
just_a_word: {
SV *sv;
+ int pkgname = 0;
char lastchar = (PL_bufptr == PL_oldoldbufptr ? 0 : PL_bufptr[-1]);
/* Get the rest if it looks like a package qualifier */
Perl_croak(aTHX_ "Bad name after %s%s", PL_tokenbuf,
*s == '\'' ? "'" : "::");
len += morelen;
+ pkgname = 1;
}
if (PL_expect == XOPERATOR) {
}
}
-
PL_expect = XOPERATOR;
s = skipspace(s);
/* Is this a word before a => operator? */
- if (*s == '=' && s[1] == '>') {
+ if (*s == '=' && s[1] == '>' && !pkgname) {
CLINE;
sv_setpv(((SVOP*)yylval.opval)->op_sv, PL_tokenbuf);
if (UTF && !IN_BYTES && is_utf8_string((U8*)PL_tokenbuf, len))