in reply to A feature of use

Replies are listed 'Best First'.
Re^2: A feature of use
by bart (Canon) on Aug 21, 2008 at 09:22 UTC
    Ah, you gave me enough clues...
    use strict is turned into require strict; which loads the module, followed by strict->import;. But Perl now knows strict as a filehandle, so this syntax is treated as an object method call to the filehandle object associated with the filehandle with the name "strict".

    Since either there is a method for the package IO::Handle (or else, import has a special status so perl won't complain if it can't find it), it works but actually doesn't do much. What it definitely doesn't do is call import for the package strict. That's why strict checks are still off.

    So it's all caused by the ambiguous syntax of word->method, which may represent either a class method call, or an object method call.

Re^2: A feature of use
by ambrus (Abbot) on Aug 21, 2008 at 07:36 UTC