[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

lexical warnings bug?



Shouldn't both of these two warnings be controlled by 
the "use warnings qw/exec/" pragma?  This is 5.005_63.

    % ./perl -wle 'exec "fred"; print "darnit"'
    Statement unlikely to be reached at -e line 1.
    (Maybe you meant system() when you said exec()?)
    Can't exec "fred": No such file or directory at -e line 1.
    darnit

    % ./perl -Wle 'exec "fred"; print "darnit"'
    Statement unlikely to be reached at -e line 1.
    (Maybe you meant system() when you said exec()?)
    Can't exec "fred": No such file or directory at -e line 1.
    darnit

    % ./perl -le 'use warnings "exec"; exec "fred"; print "darnit"' 
    Can't exec "fred": No such file or directory at -e line 1.
    darnit

    % ./perl -le 'use warnings; no warnings "exec"; exec "fred"; print "darnit"'
    Statement unlikely to be reached at -e line 1.
    (Maybe you meant system() when you said exec()?)
    darnit


There are two warnings involved here:

    1) Statement unlikely to be reached at -e line 1.
       (Maybe you meant system() when you said exec()?)

    2) Can't exec "fred": No such file or directory at -e line 1.

Number one is of class "syntax", and number two is of class "exec".

From op.c:

    Perl_warner(aTHX_ WARN_SYNTAX, "Statement unlikely to be reached");
    Perl_warner(aTHX_ WARN_SYNTAX, "(Maybe you meant system() when you said exec()?)\n");

From doio.c:

        if (ckWARN(WARN_EXEC))
            Perl_warner(aTHX_ WARN_EXEC, "Can't exec \"%s\": %s", 
                PL_Argv[0], Strerror(errno));

Is this really the way it is meant to be?

--tom


[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]