[Israel.pm] help with "use base"

Scott Weisman sweisman at pobox.com
Sun Aug 8 20:48:29 PDT 2004


Mikhael Goikhman wrote:

> This module dependancy is a bit strange. In one class you create an
> instance of another class, that in turn inherits from the first one.
> I don't see why you need an inheritance here. I may think about the
> following possible way to break this circular dependancy. (Here I use
> capitalized class names to distinuguish them from the method names.)

It is strange, but as I said above, this setup works fine on my personal 
box. It looks strange because I'm not going to spend pages describing 
the design I've created. But to summarize, I'm using sort of an MVC 
design (hence the word "control" in the package name), with the ability 
to support multiple sites using the same code base, with minimal 
configuration changes required to add new sites. And one site or even 
multiple sites are handled by a single controller (so I have 
cmf::control::web::front, and cmf::control::web::lnt, for example).

In Perl it is perfectly acceptable to create an instance of one class in 
another, and since I've pre-loaded the modules in my startup.pl, there 
shouldn't be a problem. Where is the circular reference if I've 
preloaded the module? Besides, as I've said above, it works on my own 
box. I'm not trying to be repetitive here. I just want to emphasize I'm 
using tested, working code that breaks for some reason on another box.

I did just check, and for some reason @cmf::control::web::front::ISA is 
NOT set, even though it should be, regardless of whether I do 'use base' 
or the old method of "use cmf::control::web; our @ISA = 
qw(cmf::control::web);". It doesn't make sense to me, but perhaps 
something in Red Hat does not like pre-loading modules?

> P.S. Interesting, you asked a very similar question a year ago:
> 
>   http://perl.org.il/pipermail/perl/2003-November/003474.html
> 
> Note that you use an old Perl, the new versions suggest the solution in
> the error message: (perhaps you forgot to load 'class::name').

Back then I wasn't using mod_perl, although I was using a somewhat 
similar design in anticipation of migrating to it. Plus, I didn't have 
the design tested on another non-Red-Hat Linux distro.

Regards,

Scott



More information about the Perl mailing list