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

RE: lexical warnings bug?



From: Tom Christiansen [mailto:tchrist@jhereg.perl.com]
 
 
> Shouldn't both of these two warnings be controlled by 
> the "use warnings qw/exec/" pragma?  This is 5.005_63.

Yep.

>     % ./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?

Nope, looks like "Statement unlikely to be reached" warning should be in the
WARN_EXEC rather than the WARN_SYNTAX category.
 
I suspect this is the tip of the iceberg - a complete audit of all the
warning categories and warnings that have been assigned to each needs to be
done. Right now I'm suffering from a complete lack of tuits, so if anyone
has a few to spare this is a job that really needs doing before 5.6

Paul


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