Damian Conway wrote:


> proper lexically-scoped modules.

        sub foo { print "outer foo\n"};
        {
                local *foo = sub {print "inner foo\n"};
                foo();
        };
        foo();


did what I wanted it to.   Should I extend Pollute:: to make
this possible:

in file Localmodules.pm:

        use Pollutte::Locally;
        use Carp;

and in blarf.pl:

        sub Carp {print "outer carp\n"};

        {
                use Localmodules.pm;
                local *{$_} foreach @PolluteList;
                Pollute();
                Carp("Inner Carp");     # goes to STDERR

        }

        Carp(); #prints "outer carp\n"



Or is that just too complex.  Local must be visible at compile-time
I suppose.

        local use Carp;

is how local import should look IMO, that might have gotten into an RFC




-- 
                                           David Nicol 816.235.1187
Refuse to take new work - finish existing work - shut down.

Reply via email to