in reply to Re^3: Detecting an imported function (exclude time)
in thread Detecting an imported function
Programmers traditionally put their "use" statements near the top of a package. If they do that and put the BEGIN near the bottom, I'm back where I started. Having an arbitrary convention to handle this problem breaks as soon as someone forgets/ignores the convention.
package Trait::Foo; use strict; use warnings; use Some::Other::Module::Which::Exports::Stuff; sub foo { ... } sub bar { ... } BEGIN { # S:O:M:W:E:S's exported stuff will get picked up # here. That's bad. }
Otherwise, you're saying subs first, then BEGIN blocks and then other "use" statements. That basically means telling trait authors to write their traits upside down.
Cheers,
Ovid
New address of my CGI Course.
|
|---|