If there is to be a %MY, how does its semantics pan out?

for example, what (if anything) do the following do:

sub Foo::import {
    my %m = caller(1).{MY}; # or whatever
    %m{'$x'} = 1;
}

sub Bar::import {
    my %m = caller(1).{MY}; # or whatever
    delete %m{'$x'};
}


sub f {
    my $x = 9;
    use Foo; # does $x become 1, or $x redefined, or runtime error, or ... ?
    {
        # is this the same as 'my $x = 1' at this point,
        # or is the outer $x modified?
        use Foo;
        ...
    }
    use Bar; # is $x now still in scope?
    print $x; #compile error? or runtime error? or prints 9 (or 1...) ????
    
    Bar::import(); # any difference calling it at run time?
}

and so on....

IE what effects to do the standard hash ops of adding, modifying,
deleting, testing for existence, testing for undefness, etc etc map onto
when applied to some sub's %MY, at either compile or run time.

????

I'd be a lot happier about this concept if I knew how it was supposed
to behave!

Dave M.

Reply via email to