in reply to Behaviour on recursive use
It's not a problem from perl's perspective, but behaviour in the case of circular requires can sometimes be a little unintuitive:
# foo.pm package foo; use bar; sub import { printf("%s loaded foo\n", scalar caller) } 1;
# bar.pm package bar; use foo; sub import { printf("%s loaded bar\n", scalar caller) } 1;
# script.pl use foo;
Running the script, generates the following output:
foo loaded bar main loaded foo
Did you expect to see bar loaded foo somewhere in that output?
With careful consideration of compile time versus runtime, etc, etc, you'll realise why that line was not output, and that this is proper and documented behaviour. Just not necessarily very intuitive.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Behaviour on recursive use
by locinus33 (Initiate) on Mar 10, 2014 at 10:32 UTC | |
by Anonymous Monk on Mar 10, 2014 at 10:57 UTC | |
by locinus33 (Initiate) on Mar 10, 2014 at 15:47 UTC |