in reply to Re^7: use has it's own scope?
in thread use has it's own scope?

I can still imagine a bizarre module interface which closes over the using scope's lexical

I can, too; but I tried, and I don't think it can be done -- at least not without resorting to something in the B namespace. You could probably do it, though. ;-)

I reckon we are the only monastery ever to have a dungeon stuffed with 16,000 zombies.

Replies are listed 'Best First'.
Re^9: use has it's own scope?
by Eily (Monsignor) on Sep 08, 2017 at 13:41 UTC

    Doesn't keeping the elements in @_ basically have the same effect since they are aliases to the values in the use statement?

    package Set; sub import { our $var = \$_[1]; } 1;
    With this module, perl -e "use Set (my $x = 6,); $$Set::var++; will work but perl -e "use Set (6,); $$Set::var++;

    will fail because "Modification of a read-only value attempted at -e line 1."

      ( /me diabolic laughter ;-)

      yes, I will link to my YAPC talk as soon that I find it on youtube. :)

      Cheers Rolf
      (addicted to the Perl Programming Language and ☆☆☆☆ :)
      Je suis Charlie!

Re^9: use has it's own scope?
by LanX (Saint) on Sep 06, 2017 at 09:30 UTC
    > resorting to something in the B namespace.

    That's my plan ... ;)

    Cheers Rolf
    (addicted to the Perl Programming Language and ☆☆☆☆ :)
    Je suis Charlie!