This should work... I haven't tried it, though :o)

package ThingA;

use strict;
use ThingB;

sub new { return bless {}, shift; }

sub ThingB { return ThingB->new( @_ ); }

---------------
package ThingB;

use strict;

# Note, the next 3 lines will only be necessary if you want to override
# ThingA's methods in ThingB and/or make ThingA's methods
# available to ThingB objects
use ThingA;
use vars qw(@ISA);
@ISA = qw(ThingA);

sub new {
  my($class,$thinga,$id) = @_;
  return bless {THINGA=>$thinga, ID=>$id}, $class;
}

--------------
In the script...
use ThingA;
$thinga = new ThingA;
$thingb = $thinga->ThingB;



Thanks,

Tim Tompkins
----------------------------------------------
Programmer / IS Technician
http://www.arttoday.com/


----- Original Message -----
From: Ronald F. Lens <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, November 10, 1999 8:00 AM
Subject: Deep recursion problem (Namespace?) modperl 1.21 with perl 5.00503


> Hi.
>
> I'm running into a strange problem with the combination Apache 1.3.9,
modperl
> 1.21 and perl 5.005.03. This problem doesn't occur with perl 5.004 with
modperl
> 1.14 and apache 1.3.1.
>
> I have 2 modules :
> -----------------
> package ThingA;
>
> use ThingB;
>
> sub new ....
>
> sub ThingB { ThingA::ThingB->new( @_ ) }
>
> ---------------
> package ThingB;
>
> @ThingA::ThingB::ISA = qw(ThingA);
>
> sub new {
>   my ($class,$thinga,$id) = @_;
>   $self = {};
>   bless $self,$class;
>
>   $self->{'THINGA'} = $thinga;
>   $self;
> }
> ---------------
> Now, if I write a normal perl script :
>
> use ThingA;
> $thinga = new ThingA;
> $thingb = $thinga->ThingB;
>
> This runs fine, but if I do the same in the modperl environment and set
> PerlWarn On in the conf file, I get the warning 'Deep recursion' and the
httpd
> process grows until I'm out of memory. Does anyone have a clue what kind
of
> problem this could be? I would think some sort of namespace problem but
cannot
> imagine why.
>
> Thanks in advance
>
> Ronald Lens
>
> System developer
> xxLINK Internet Services
> -------------------------------------
> Tel:    020-6005700
> Fax:    020-6001825
> Email:  [EMAIL PROTECTED]
> Web:    http://www.xxLINK.nl/
> Fysiek: Postbus 2739
>         1000 CS Amsterdam
>         The Netherlands
> -------------------------------------
>

Reply via email to