Hi,

Yesterday I wrote about a deep recusrion problem. The post wasn't very clear
and I still haven't been able to solve it. Here is a more accurate description:

OS Linux 2.2.12 (RedHat 6.1)
perl 5.005_03 (own build, no threads)
modperl 1.21
apache 1.3.9

I've got 2 test modules :
#----------------------------
package RFL::Level1;
use strict;
use RFL::Level1::SubLevel1;
1;

sub new {
  my ($class) = shift;
  my ($self) = {};
  bless $self,$class;
  $self->{'DATA'} = 'In RFL::Level1';
  $self;
}

sub Data { shift->{'DATA'} }

sub SubLevel1 { RFL::Level1::SubLevel1->new( @_ ) }
#----------------------------
 
package RFL::Level1::SubLevel1;

use strict;

BEGIN {
  @RFL::Level1::SubLevel1::ISA = qw(RFL::Level1);
}

1;

sub new {
  my ($class) = shift;
  my ($self) = {};
  bless $self,$class;
  $self->{'DATA'} = 'RFL::Level1::SubLevel1';
  $self;
}
#----------------------------

And a very basic handler :

package RFL::Handler;

use strict;
use Apache::Constants qw(:common);
use RFL::Level1;

sub handler {
  my ($r) = shift;
  my ($level1) = new RFL::Level1;
  my ($sublevel1) = $level1->SubLevel1;
  $r->content_type('text/html');
  $r->send_http_header;
  $r->print("<html><body>Begin<p>");
  $r->print($level1->Data . "<p>");
  $r->print($sublevel1->Data . '<p>');
  $r->print("</body></html>");
}

1;
#----------------------------

When I load the page of this handler in the browser The httpd process grows
until it has drained my virtual memory. The problem lies in the method
SubLevel1 in the module RFL::Level1. It's supposed to call the new constructor
of the module RFL::Level1::SubLevel1 but instead keeps calling itself. A script
works fine:

#!/usr/bin/perl
use strict;
use RFL::Level1;

my ($level1) = new RFL::Level1;
my ($sublevel1) = $level1->SubLevel1;
print $sublevel1->Data . "\n";
#-----------------------------

To be honest I've got no idea where to look anymore. Does anyone have an idea
what this could be. I've running the script in an eval block and it still works.

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