Mutual Circular Module Dependencies

Mutual Circular Module Dependencies

am 29.11.2007 12:03:40 von Tim Milstead

How do I avoid problems with modules that depend on each other -
without getting function redefined errors etc.

e.g. I have two classes in two modules. Once called country one called
town. Both call functions in the other so both have to 'use' the other
- which causes the errors. I could turn off strict and warnings but
I'd rather fix it properly.

Is there a solution?

Thanks in advance,

Tim.

P.S. Please I'm not interested in an argument about whether I should
have the mutual dependency in the first place - if you want that start
another thread!

Re: Mutual Circular Module Dependencies

am 29.11.2007 20:23:50 von Jim Gibson

In article
<5253e03b-2c3a-4751-804b-4f2ce641b801@j20g2000hsi.googlegroups.com>,
Tim M wrote:

> How do I avoid problems with modules that depend on each other -
> without getting function redefined errors etc.
>
> e.g. I have two classes in two modules. Once called country one called
> town. Both call functions in the other so both have to 'use' the other
> - which causes the errors. I could turn off strict and warnings but
> I'd rather fix it properly.
>
> Is there a solution?
>
> Thanks in advance,
>
> Tim.
>
> P.S. Please I'm not interested in an argument about whether I should
> have the mutual dependency in the first place - if you want that start
> another thread!

What errors? Can you post a short program that demonstrates the problem
you are having? It is possible for two modules to 'use' each other.
Perl will 'use' a module only once.

Possible solutions:

1. Combine the two modules into one.
2. Extract common members or methods and put them in a third module.

--
Jim Gibson

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com