in reply to Re: Which "use" statements in a module do "bubble up" to the callers? (updated)
in thread Which "use" statements in a module do "bubble up" to the callers? [SOLVED]
Thank you very much for that fantastic explanation!
You are right, it's all there. I don't know what my problem was; I have read the documentation for "use warnings;" and "use strict;" multiple times before asking, and both quite at the beginning state they are lexically scoped. The documentation for "use warnings;" even states the reason: To prevent "leaking" to callers and other packages ... no idea what has been wrong with me. Probably I have got wrong the term "lexically scoped".
My next problems were "use utf8;" and "use feature unicode_strings", but I now know that "use utf8;" and "use feature ..." are lexically scoped as well.
In my module, there are also some commands to set the binmode for STDIN, STDOUT and STDERR. Since I now have understood that there will run a do(module_file_name) when the module is loaded, I can be sure that those commands will be run whenever that module is used - one more understanding problem solved.
The only thing which I am still wondering about is that the constants are indeed in my script.pl, without having them exported from the module. But I think this is due to the fact that I have no "package ..." statement in that module (yet). Yes, I know, bad style, but still just testing at the moment ...
And finally, I have decided that I (for the moment) just copy all common "use ..." statements from my module into every script. It is ugly, but it is not too much work. It is very good to know how I could solve this in a clean way, though. I'll do that later.
Again, thank you very much!
Nocturnus
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Which "use" statements in a module do "bubble up" to the callers?
by haukex (Archbishop) on Aug 31, 2017 at 17:06 UTC | |
by Nocturnus (Scribe) on Sep 01, 2017 at 07:35 UTC | |
by choroba (Cardinal) on Sep 01, 2017 at 09:15 UTC | |
by haukex (Archbishop) on Sep 01, 2017 at 12:23 UTC | |
by Nocturnus (Scribe) on Sep 02, 2017 at 10:04 UTC | |
by haukex (Archbishop) on Sep 02, 2017 at 10:56 UTC | |
|