in reply to Re: Use of typeglob in package import subroutine
in thread Use of typeglob in package import subroutine

Taking the points from both replies, I summarize the following given below.

In the example 1,

The variable $main::pet is never declared. But, the typeglob assignment made it as an alias for $Zoo:pet which has indeed been declared with our. So 'use strict' didn't throw error since somehow $main::pet got indirectly declared.


In the example 2,

Here too, the variable $main::pet is never declared. The symbolic assignment just created $main::pet. So 'use strict' threw error since it could not find any declaration for $main::pet either direct or indirect.


Any other explanation that better explain the behavior?

- GG1985
  • Comment on Re^2: Use of typeglob in package import subroutine

Replies are listed 'Best First'.
Re^3: Use of typeglob in package import subroutine
by LanX (Saint) on Apr 29, 2014 at 18:33 UTC
    > $main::pet got indirectly declared.

    you can't "declare" fully qualified pkg vars, the declaration of our and my just "links" _unqualified_ vars to a slot (be in a stash or a pad) for the compiler.

    I.e. there is no need for an "implicit" declaration. It's just the same initialization like for hash-entries.

    Cheers Rolf

    ( addicted to the Perl Programming Language)