in reply to Re: Logic for importing and strict vars?
in thread Logic for importing and strict vars?

Eily: All I can say is that with B::Deparse the package prefix seems to be removed,

No, that is turned around reasoning. I would say: The package prefix is not added.

The problem that is described here is not in the BEGIN block but the last $x++ statement which should be explicitly mentioned: $main::x++; because $x is not exported imported. The Parser translates to '$main::x' automatically because the package statement resides in the BEGIN block. When it is outside the BEGIN block, it doesn't do that. In none of the cases, the variable $x is exported imported.

edit: As far as documentation concerned I believe it can be found under: package, paragraph 2, the promise that a package statement does not affect lexically-scoped variables

Replies are listed 'Best First'.
Re^2: Logic for importing and strict vars?
by Eily (Monsignor) on Feb 27, 2019 at 13:22 UTC

    The prefix was there, and then it's not. I'm not sure why I couldn't call that being removed.

    In none of the cases, the variable $x is imported
    Importing is just writing in the glob slot from another package, which is what Exporter does (and it doesn't do anything else, the only special thing is that it is called implicitly, but you can call it explicitly and still have it work). The part that I missed on first read was the "from another package". Which means the variable is imported in the third case (edit: which is why the third one works).