Mutual Circular Module Dependencies

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!
Tim Milstead [ Do, 29 November 2007 12:03 ] [ ID #1882206 ]

Re: Mutual Circular Module Dependencies

In article
<5253e03b-2c3a-4751-804b-4f2ce641b801 [at] j20g2000hsi.googlegroups.com>,
Tim M <tim_milstead [at] yahoo.co.uk> 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
Jim Gibson [ Do, 29 November 2007 20:23 ] [ ID #1882209 ]
Perl » comp.lang.perl.modules » Mutual Circular Module Dependencies

Vorheriges Thema: To publish on CPAN or not? And architectural q. on modules.
Nächstes Thema: Batch Renaming a group of files in a directory.