On 3/13/22 19:12, Shawn H Corey wrote:
On 2022-03-13 18:44, Diab Jerius wrote:
I prefer yet another fashion (everything is driven by what's in
%EXPORT_TAGS), but back to the point of the OP's problem, this
doesn't initialize @EXPORT until runtime, so I think will have the
same issue (I'm away from keyboard at the moment).
Each module has its own runtime. That is, a module is loaded, compiled
and run; all before the main program. In other words, when the module
returns from its `use` statement, it has already run.
Except that in this case, the two modules are importing each other, so
that this linear model does not hold.
I'm back at my keyboard, so can implement your suggestion.
$ diff Exporter-circular-use{.orig,.new}
diff Exporter-circular-use.orig/Bar11.pm
Exporter-circular-use.new/Bar11.pm
9,10c9
< require Exporter;
< our @ISA = qw( Exporter );
---
> use Exporter 'import';
diff Exporter-circular-use.orig/Foo11.pm
Exporter-circular-use.new/Foo11.pm
9,10c9
< require Exporter;
< our @ISA = qw( Exporter );
---
> use Exporter 'import';
With the same unfortunate result:
$ perl foo11
main=7
foo=6
bar=5
Undefined subroutine &Bar11::foo called at Bar11.pm line 21.