A
asokoloski
So I have two modules:
=== a.pm ===
package a;
use b;
sub import {
print "import in $_[0] called from ". (caller(1))[3] ." \n";
}
1;
=== b.pm ===
package b;
use a;
sub import {
print "import in $_[0] called from ". (caller(1))[3] ." \n";
}
1;
==========
and a script:
=== test.pl ===
#!/usr/bin/perl
use strict;
use warnings;
use a;
==========
Running this script prints:
--------------
import in b called from a::BEGIN
import in a called from main::BEGIN
--------------
Whereas I would expect there to be another "import in a called from
b::BEGIN" at the beginning, from the "use a;" in b.pm. I know that
each module is only compiled once, but import should be called each
time, and there are three "use" statements, so shouldn't there be three
imports?
What am i missing here?
Thanks,
Aaron
=== a.pm ===
package a;
use b;
sub import {
print "import in $_[0] called from ". (caller(1))[3] ." \n";
}
1;
=== b.pm ===
package b;
use a;
sub import {
print "import in $_[0] called from ". (caller(1))[3] ." \n";
}
1;
==========
and a script:
=== test.pl ===
#!/usr/bin/perl
use strict;
use warnings;
use a;
==========
Running this script prints:
--------------
import in b called from a::BEGIN
import in a called from main::BEGIN
--------------
Whereas I would expect there to be another "import in a called from
b::BEGIN" at the beginning, from the "use a;" in b.pm. I know that
each module is only compiled once, but import should be called each
time, and there are three "use" statements, so shouldn't there be three
imports?
What am i missing here?
Thanks,
Aaron