This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
use yyerror() instead of croak() so that compile-time failures in
authorGurusamy Sarathy <gsar@cpan.org>
Tue, 9 Mar 1999 02:50:43 +0000 (02:50 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Tue, 9 Mar 1999 02:50:43 +0000 (02:50 +0000)
my(LIST) don't confuse globals with lexicals

p4raw-id: //depot/perl@3097

op.c
toke.c

diff --git a/op.c b/op.c
index 560a50e..8868057 100644 (file)
--- a/op.c
+++ b/op.c
@@ -147,7 +147,7 @@ pad_allocmy(char *name)
            name[2] = toCTRL(name[1]);
            name[1] = '^';
        }
-       croak("Can't use global %s in \"my\"",name);
+       yyerror(form("Can't use global %s in \"my\"",name));
     }
     if (ckWARN(WARN_UNSAFE) && AvFILLp(PL_comppad_name) >= 0) {
        SV **svp = AvARRAY(PL_comppad_name);
@@ -170,7 +170,8 @@ pad_allocmy(char *name)
     sv_setpv(sv, name);
     if (PL_in_my_stash) {
        if (*name != '$')
-           croak("Can't declare class for non-scalar %s in \"my\"",name);
+           yyerror(form("Can't declare class for non-scalar %s in \"my\"",
+                        name));
        SvOBJECT_on(sv);
        (void)SvUPGRADE(sv, SVt_PVMG);
        SvSTASH(sv) = (HV*)SvREFCNT_inc(PL_in_my_stash);
diff --git a/toke.c b/toke.c
index f1aca91..d6fc1b8 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -1638,7 +1638,7 @@ int yylex(PERL_YYLEX_PARAM_DECL)
        */
        if (PL_in_my) {
            if (strchr(PL_tokenbuf,':'))
-               croak(PL_no_myglob,PL_tokenbuf);
+               yyerror(form(PL_no_myglob,PL_tokenbuf));
 
            yylval.opval = newOP(OP_PADANY, 0);
            yylval.opval->op_targ = pad_allocmy(PL_tokenbuf);