in reply to Re^2: A simple import() for those special moments
in thread A simple import() for those special moments
it exports the entire typeglob
ihb
I thought that was intentional. :)
If an importing package already has a $foo_bar, this routine will overwrite the typeglob in the process of exporting &foo_bar, even if it never exports a $foo_bar of its own.It's more likely to be the other way around, i.e.
It's easy to check if a glob gets overwritten though.sub foo_var { 'a' } use Foo; foo_var(); # Undefined subroutine called.
This isn't such a big issue as you seem to think. Problems will only occure when you import after defining your own data types. Special exception for subroutines though. They can be declared and that (including the prototype) can disappear. E.g.
complains under strict because &foo_var isn't declared anymore when foo_var; is found.sub foo_var ($$); use Foo; foo_var;
Anyway, usually modules are use()d before subroutines are defined, and subroutines are usually defined before variables. So it's not that bad. This works perfectly (albeit a bit dangerous):
Cheers,use Foo; sub foo_var { 1 } foo_var();
ihb
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: A simple import() for those special moments
by Aristotle (Chancellor) on Jan 20, 2003 at 22:45 UTC | |
Re^4: A simple import() for those special moments
by Aristotle (Chancellor) on Jan 21, 2003 at 18:50 UTC | |
by ihb (Deacon) on Jan 22, 2003 at 19:53 UTC | |
by Aristotle (Chancellor) on Jan 22, 2003 at 22:45 UTC |
In Section
Meditations