Re: Exporter and subroutine circular dependencies between modules

2022-03-13 Thread David Christensen
On 3/13/22 16:12, Shawn H Corey wrote: 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. AIUI that is the view from 20,000 ft.. But, there are

Re: Exporter and subroutine circular dependencies between modules

2022-03-13 Thread David Christensen
On 3/13/22 15:44, Diab Jerius wrote: On Sun, Mar 13, 2022, 18:19 Shawn H Corey wrote: use Exporter qw( import ); our @EXPORT = qw( foo ); our @EXPORT_OK = qw( ); our %EXPORT_TAGS = ( all => [ @EXPORT, @EXPORT_OK ], ); This automatically creates a tag for `:all`. I

Re: Exporter and subroutine circular dependencies between modules

2022-03-13 Thread David Christensen
ok 9 - foo44 1..9 # Looks like you failed 2 tests of 9. Exporter-circular-use-20220313-185149.tar.gz Description: application/gzip

Re: Exporter and subroutine circular dependencies between modules

2022-03-13 Thread David Christensen
ed subroutine ::foo called at Bar12.pm line 23. not ok 5 - foo12 # Failed test 'foo12' # at ./Exporter-circular-use.t line 24. # got: 'main=7 # foo=6 # bar=5 # ' # expected: 'main=7 # foo=6 # bar=5 #foo=4 # bar=3 # foo=2 # bar=1 # ' ok 6 - foo21 ok 7 - foo22

Re: Exporter and subroutine circular dependencies between modules

2022-03-13 Thread David Christensen
On Sun, Mar 13, 2022 at 1:14 PM David Christensen wrote: module-authors: I have been wrestling with the Exporter module and subroutine circular dependencies between modules for a number of years. I have yet to find On 3/13/22 14:57, Karen Etheridge wrote: > I haven't looked at your code,

Re: Exporter and subroutine circular dependencies between modules

2022-03-13 Thread Diab Jerius
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

Re: Exporter and subroutine circular dependencies between modules

2022-03-13 Thread Shawn H Corey
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

Re: Exporter and subroutine circular dependencies between modules

2022-03-13 Thread Diab Jerius
On Sun, Mar 13, 2022, 18:19 Shawn H Corey wrote: > On 2022-03-13 18:08, Diab Jerius via module-authors wrote: > > require Exporter; > our @ISA= qw( Exporter ); > our @EXPORT= qw( foo ) > > I prefer this way: > > # -- > # Exports > use Exporter

Re: Exporter and subroutine circular dependencies between modules

2022-03-13 Thread Shawn H Corey
On 2022-03-13 18:08, Diab Jerius via module-authors wrote: require Exporter; our @ISA    = qw( Exporter ); our @EXPORT    = qw( foo ) I prefer this way: # -- # Exports use  Exporter  qw( import ); our @EXPORT  = qw( foo ); our

Re: Exporter and subroutine circular dependencies between modules

2022-03-13 Thread Diab Jerius via module-authors
On 3/13/22 16:13, David Christensen wrote: module-authors: I have been wrestling with the Exporter module and subroutine circular dependencies between modules for a number of years.  I have yet to find a satisfactory solution. [...] What is the "proper" way to avoid or solve the problem

Re: Exporter and subroutine circular dependencies between modules

2022-03-13 Thread Karen Etheridge
I haven't looked at your code, but I assume what you're doing is exporting a sub from each module, and something in each of those modules is calling each of those subs in turn, using the exported symbol. This is indeed an unresolvable circular dependency because unqualified sub names must be

Exporter and subroutine circular dependencies between modules

2022-03-13 Thread David Christensen
xporter-circular-use-20220313-113141.tar.gz Description: application/gzip