in reply to Re^2: Strict isn't strict enough
in thread Strict isn't strict enough

*ANYTHING* can be typoed, and then cut-and-pasted. If your coding style is to randomly hit the keyboard, and then ask perl whether you did a good job, don't expect use strict; to be a silver bullet.

Perhaps you should replace /usr/bin/perl with

#!/usr/bin/sh echo "Possible typo detected at line 1. Please fix." exit 1
BTW, what should perl do if you did my $hwatever and then cut-and-pasted the $hwatever?

Replies are listed 'Best First'.
Re^4: Strict isn't strict enough
by davies (Monsignor) on Dec 31, 2011 at 17:31 UTC
    what should perl do if you did my $hwatever and then cut-and-pasted the $hwatever?

    Give a compile time error when I use $whatever. Obviously it isn't a problem if the same typo is used throughout, but if a variable can be used in two places then there is scope for typos that I expected strict to catch before I read the docs. I still want to catch it if I can.

    Regards,

    John Davies

      So, what should happen at:
      package Foo; declare $slave::whatever; # Inventing a keyword to declare fully qual +ified names. $slave::whatever = 1; __END__ package Bar; declare $slave::hwatever; print $slave::hwatever; __END__
      Typo, or intentional?

        It must depend on declare's documented behaviour.

        I think you're trying to have a Socratic dialogue with me, for which I'm grateful, but I'm not clear where it's leading, meaning that my confusion is increasing. Tye has given me a workaround, but no-one has answered outright my original question "Is there anything that will report the use of undeclared fully qualified variable names?". From the help I have received, I'm pretty sure that the answer is "no". I'm used to having to use fully qualified names to avoid "Bill Gates knows best" problems, so I was not expecting the behaviour I experienced until I read the docs, and I was expecting it to be the sort of issue that had been resolved by others. If (as seems to be the case) not, I shall have different expectations in future. But as I say, I'm not certain where this is leading. If it's somewhere useful, I shall be duly grateful.

        Regards,

        John Davies

        Update: fixed minor typo